10.07.2015 Views

CHAPTER 3 METHODOLOGY 3.1 Overview The Water Monitoring ...

CHAPTER 3 METHODOLOGY 3.1 Overview The Water Monitoring ...

CHAPTER 3 METHODOLOGY 3.1 Overview The Water Monitoring ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AT89S52Table 9. Serial Programming Instruction SetInstructionInstructionFormatByte 1 Byte 2 Byte 3 Byte 4Programming Enable 1010 1100 0101 0011 xxxx xxxx xxxx xxxx0110 1001(Output)OperationEnable Serial Programmingwhile RST is highChip Erase 1010 1100 100x xxxx xxxx xxxx xxxx xxxx Chip Erase Flash memoryarrayRead Program Memory(Byte Mode)Write Program Memory(Byte Mode)0010 0000 xxx Read data from Programmemory in the byte modeA120100 0000 xxx Write data to Programmemory in the byte modeA12A11A10A9A8A11A10A9A8Write Lock Bits (2) 1010 1100 1110 00 xxxx xxxx xxxx xxxx Write Lock bits. See Note (2).B1B2Read Lock Bits 0010 0100 xxxx xxxx xxxx xxxx xx xx Read back current status ofthe lock bits (a programmedlock bit reads back as a ‘1’)Read Signature Bytes (1) 0010 1000 xxx xxx xxxx Signature Byte Read Signature ByteA5A4A3A2A1A0A7A6A5A4A3A2A1A0A7A6A5A4A3A2A1A0D7D6D5D4D3D2D1D0D7D6D5D4D3D2D1D0LB3LB2LB1Read Program Memory(Page Mode)Write Program Memory(Page Mode)0011 0000 xxx Byte 0 Byte 1...Byte 2550101 0000 xxx Byte 0 Byte 1...Byte 255Notes: 1. <strong>The</strong> signature bytes are not readable in Lock Bit Modes 3 and 4.2. B1 = 0, B2 = 0 ---> Mode 1, no lock protection}B1 = 0, B2 = 1 ---> Mode 2, lock bit 1 activated Each of the lock bits needs to be activated sequentially beforeB1 = 1, B2 = 0 ---> Mode 3, lock bit 2 activated Mode 4 can be executed.B1 = 1, B1 = 1 ---> Mode 4, lock bit 3 activatedAfter Reset signal is high, SCK should be low for at least 64system clocks before it goes high to clock in the enabledata bytes. No pulsing of Reset signal is necessary. SCKshould be no faster than 1/16 of the system clock atXTAL1.A12A12A11A10A9A8A11A10A9A8Read data from Programmemory in the Page Mode(256 bytes)Write data to Programmemory in the Page Mode(256 bytes)For Page Read/Write, the data always starts from byte 0 to255. After the command byte and upper address byte arelatched, each byte thereafter is treated as data until all 256bytes are shifted in/out. <strong>The</strong>n the next instruction will beready to be decoded.21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!