TXT

9.write id page

By Jeanette Lawrence,2014-10-13 07:11
22 views 0
9.write id page

//EE_512k (IIC) 24C512 Write ID Page test script

    //Author: Denny Ding

    //Time: 2013/7/29

EEPROM_AVT,

     //512K EE ID Page test

     //Page:128byte

     //Page 地址范围;FB10~FBFF

     //指令头;1011 A2 A1 A0 XX (B0 B1)

Common_SetEEType,50 //512K EE Test

    Common_Firmware_version, IIC_A0, 00

    IIC_A1, 00

    IIC_A2, 00

    IIC_WP, 00

define var pattern

    define var address

//1.1ID Page0x00 再读回确认

    IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

//开始写入数据

    $pattern = 0x00

     $address=0x00 $loop1:

     IIC_ShiftOutNBit, %02x$pattern 08

     IIC_TestACK,

     Common_Compare,00

     $address=$address+0x01

     if $address<=0x7f

     goto $loop1

    IIC_Stop,

////读出数据进行确认

IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_Start,

    IIC_ShiftOutNBit, B108 IIC_TestACK,

//开始读取数据

     $address=0x00 $loop2:

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

     IIC_ACK,

     $address=$address+0x01

     if $address<=0x7e

     goto $loop2

    //最后一个字节 NoACK

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

IIC_NoACK,

    IIC_Stop,

//pause

//1.2ID Page0x55 再读回确认

IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

//开始写入数据

    $pattern = 0x55

     $address=0x00 $loop3:

     IIC_ShiftOutNBit, %02x$pattern 08

     IIC_TestACK,

     Common_Compare,00

     $address=$address+0x01

     if $address<=0x7f

     goto $loop3

    IIC_Stop,

////读出数据进行确认

IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_Start,

    IIC_ShiftOutNBit, B108 IIC_TestACK,

//开始读取数据

     $address=0x00 $loop4:

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

     IIC_ACK,

     $address=$address+0x01

     if $address<=0x7e

     goto $loop4

    //最后一个字节 NoACK

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

IIC_NoACK,

    IIC_Stop,

//pause

//1.3ID Page0xAA 再读回确认

    IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

//开始写入数据

    $pattern = 0xAA

     $address=0x00 $loop5:

     IIC_ShiftOutNBit, %02x$pattern 08

     IIC_TestACK,

     Common_Compare,00

     $address=$address+0x01

     if $address<=0x7f

     goto $loop5

    IIC_Stop,

////读出数据进行确认

IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008

IIC_TestACK,

    IIC_Start,

    IIC_ShiftOutNBit, B108 IIC_TestACK,

//开始读取数据

     $address=0x00 $loop6:

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

     IIC_ACK,

     $address=$address+0x01

     if $address<=0x7e

     goto $loop6

    //最后一个字节 NoACK

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

IIC_NoACK,

    IIC_Stop,

//1.4ID Page0xFF 再读回确认

    IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

//开始写入数据

    $pattern = 0xFF

     $address=0x00 $loop7:

     IIC_ShiftOutNBit, %02x$pattern 08

     IIC_TestACK,

     Common_Compare,00

     $address=$address+0x01

     if $address<=0x7f

     goto $loop7

IIC_Stop,

////读出数据进行确认

IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_Start,

    IIC_ShiftOutNBit, B108 IIC_TestACK,

//开始读取数据

     $address=0x00 $loop8:

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

     IIC_ACK,

     $address=$address+0x01

     if $address<=0x7e

     goto $loop8

    //最后一个字节 NoACK

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

IIC_NoACK,

    IIC_Stop,

//1.5ID Page0x00~0x7f 再读回确认

    IIC_Start,

    IIC_ShiftOutNBit, B008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008 IIC_TestACK,

    IIC_ShiftOutNBit, 0008

IIC_TestACK,

//开始写入数据

    $pattern = 0x00

     $address=0x00

    $loop9:

     IIC_ShiftOutNBit, %02x$pattern 08

     IIC_TestACK,

     Common_Compare,00

     $address=$address+0x01

     $pattern=$pattern+0x01

     if $address<=0x7f

     goto $loop9

    IIC_Stop,

////读出数据进行确认

IIC_Start,

    IIC_ShiftOutNBit, B008

    IIC_TestACK,

    IIC_ShiftOutNBit, 0008

    IIC_TestACK,

    IIC_ShiftOutNBit, 0008

    IIC_TestACK,

    IIC_Start,

    IIC_ShiftOutNBit, B108

    IIC_TestACK,

//开始读取数据

    $pattern = 0x00

     $address=0x00

    $loop10:

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

     IIC_ACK,

     $address=$address+0x01

     $pattern=$pattern+0x01

     if $address<=0x7e

     goto $loop10

//最后一个字节 NoACK

     IIC_ShiftInNBit,08

     Common_Compare,%02x$pattern 08

IIC_NoACK,

IIC_Stop,

Report this document

For any questions or suggestions please email
cust-service@docsford.com