??? 11/21/08 13:09 Read: times |
#160171 - Probable answer for serial re-program EEPROM Responding to: ???'s previous message |
Hi Hans,
I think you have a crucial point there. That information had been only mentioned in AT89S8252 datasheet but in AT89S8253's. The Code and Data memory arrays are mapped via separate address spaces in the serial programming mode. In the parallel programming mode, the two arrays occupy one contiguous address space: 0000H to 1FFFH for the Code array and 2000H to 27FFH for the Data array. If we apply the same to AT89S8253 where 12K Flash is from 0000h-2FFFFh (code array) then address from 3000h-37FFh must be for data array (see page 1, AT89S8253 primer - www.atmel.com/dyn/resources/prod_documents/doc3655.pdf). I use EMP21 (Neddhams) to program user code and default EEPROM data to AT89S8253, it works fine as normal (as explained in previous post). But when using serial programming (RS232) to re-program the EEPROM then it does not work properly (still can write the new data but but could not display properly like when program to AT89S8252) because the program may only program in the area of 2000h which suit AT89S8252. I attach the serial program code here to see if anyone can suggest how to write the data to EEPROM address in AT89S8253 when still the same serial PC program, or have any different idea about this problem: ...;**** Interupt RXTX RXTX: mov DPTR,#RxTxRunning mov 09h,DPH mov 08h,DPL mov SP,#09h ;Set new return address ;--- setb TR0 ;Turn timer0 on... setb RxTxTimerBit ;Start Timer mov RxTxTimer,#0h ;Reset timer jbc RI,Receive Transmit: clr TI clr TXRdy ajmp RxTxEnd Tx18: ;*** Send Display Type *** mov A,RxTxStepL cjne A,(Tx18End-Tx18Start),Tx18_1 mov RxTxStepL,#0h mov RxTxCode,#0h ajmp RxTxEnd ;All bytes sent Tx18_1: mov DPTR,#Tx18Start ;Send Data mov A,RxTxStepL movc A,@A+DPTR mov SBUF,A ajmp RxTxEnd Tx18Start: db " Hello from the display. " Tx18End: Receive: mov RxTxData,SBUF ;save the new data mov A,RxTxCode ;Are we busy with receive. jz Rx0 ;jmp new batch cjne A,#01h,RxTxCd2 ;If Code = 01 then we are in memory dump mode ajmp RxTest1 ; RxTxCd2: cjne A,#02h,RxTxCd3 ;If Code = 02 then we are writing a single address ajmp RxTest2 ; RxTxCd3: cjne A,#0ffh,RxTest1 ;If Code = ff then we are in idle mode waiting mov A,RxTxData ;for null to start incoming sequence. jz RxNew ; ajmp RxTxEnd ;Exit and wait... RxTest1: ;Code 1 receive memory dump mov A,RxTxStep jz Rx1_0 ;If step 0 of code 1 then jump and save High Step cjne A,#1h,RxTest1_3 ajmp Rx1_1 ;If step 1 of code 1 then jump and save Low Step RxTest1_3: cjne A,#2h,RxTest2 ajmp Rx1_2 ;If step 2 of code 1 then jump to save data RxTest2: ;Code 2 receive single address. 00 , 02 , add(h), add(l), data mov A,RxTxStep jz Rx1_0 ;If step 0 of code 1 then jump and save High address cjne A,#1h,RxTest2_3 ajmp Rx1_1 ;If step 1 of code 1 then jump and save Low address RxTest2_3: cjne A,#2h,RxTest2 ajmp Rx2_2 ;If step 2 of code 1 then jump to save data RxTxEndJmp: ajmp RxTxEnd RxTest18: cjne A,#18h,RxTxEndJmp ;Send Display Type mov RxTxCode,#18h mov RxTxStepL,#0h ajmp Tx18 RxNew: mov RxTxCode,#0h ;Set ready for new data coming mov RxTxStep,#0h ajmp RxTxEnd Rx0: mov RxTxCode,RxTxData ;Save instruction ajmp RxTxEnd Rx1_0: mov RxTxStepH,RxTxData ;Save second byte of code 1 as high byte ;of number of address to receive. mov RxTxStep,#1h ajmp RxTxEnd Rx1_1: mov RxTxStepL,RxTxData ;Save third byte of code 1 as low byte ;of number of address to receive. mov RxTxStep,#2h ajmp RxTxEnd Rx1_2: mov DPH,RxTxStepHx mov DPL,RxTxStepLx mov A,RxTxData clr EA ;disable Interrupts during write ; mov B,WMCON ; setb EEMWE ;Enable EEPROM write ; mov WMCON,B ;and save mov B,EECON setb EEMWE ;Enable EEPROM write mov EECON,B ;and save VCCREADY1: mov B, EECON jnb B.0,Vccready1 ;Vcc is not high enough for EEPROM writes, just wait further movx @DPTR,A ;WRITE EEPROM WRITESTART1: mov B, EECON jb B.1,Writestart1 ; RDY/BSY=low WAIT1: mov B, EECON jnb B.1,Wait1 ; RDY/BSY=high ; mov B,WMCON ; clr EEMWE ;Disable EEPROM write ; mov WMCON,B ;and save mov B,EECON clr EEMWE ;Disable EEPROM write mov EECON,B ;and save setb EA ;enable Interrupts after write inc DPTR ;inc to next address to write to mov RxTxStepLx,DPL ;and save mov RxTxStepHx,DPH ; mov A,DPL ;test if written to all address's cjne A,RxTxStepL,RxTxEnd ;no jmp mov A,DPH cjne A,RxTxStepH,RxTxEnd ;no jmp reti Rx2_0: ;same as Rx1_0 Rx2_1: ;same as Rx1_1 Rx2_2: mov DPL,RxTxStepL ;Load EEProm address to write. mov DPH,RxTxStepH mov A,RxTxData ;Load new data clr EA ;disable Interrupts during write ; mov B,WMCON ; setb EEMWE ;Enable EEPROM write ; mov WMCON,B ;and save mov B,EECON setb EEMWE ;Enable EEPROM write mov EECON,B ;and save VCCREADY2: mov B, EECON jnb B.0,Vccready2 ;Vcc is not high enough for EEPROM writes, just wait further movx @DPTR,A WRITESTART2: mov B, EECON jb B.1,Writestart2 ; RDY/BSY=low WAIT2: mov B, EECON jnb B.1,Wait2 ; RDY/BSY=high ; mov B,WMCON ; clr EEMWE ;Disable EEPROM write ; mov WMCON,B ;and save mov B,EECON clr EEMWE ;Disable EEPROM write mov EECON,B ;and save setb EA ;enable Interrupts after write RxTxEnd: reti ;Return from interupt ;***** ;--------------------------------------------- RxTxRunning: mov A,#00000010b ;reset watchdog timer ; orl WMCON,A ;and save orl WDTCON,A ;and save mov A,#RxTxTimeOut cjne A,RxTxTimer,RxTxRunning ajmp Inis Serial program to reprogram to these EEPROM address: e.g. ...cseg at 3082h; if AT89S8252: cseg at 2082h DB 06h ;3082h Scroll speed DB 20h ;3083h DB 01h ;3084h Scrolling off/on DB 20h ;3085h DB 080h ;3086h Flr Input brightness DB 20h ;3087h DB 01h ;3088h Arrow Type DB 20h ;3089h DB 05h ;308ah Message Speed DB 01h ;308bh Input type clock/direct DB 10d ;308ch OS Time in seconds Thanks, |
Topic | Author | Date |
AT89S8253: EEPROM programming via serial COM | 01/01/70 00:00 | |
simple example | 01/01/70 00:00 | |
Problem | 01/01/70 00:00 | |
No need to "increment"... | 01/01/70 00:00 | |
Problem in migrating from AT89S8252 to AT89S8253 - Pls help! | 01/01/70 00:00 | |
Confusion | 01/01/70 00:00 | |
It's Dataflash not EEPROM address, but... | 01/01/70 00:00 | |
I assume that you have external RAM | 01/01/70 00:00 | |
Problem in migrating from AT89S8252 to AT89S8253 - Pls help! | 01/01/70 00:00 | |
Probable answer | 01/01/70 00:00 | |
Probable answer for serial re-program EEPROM | 01/01/70 00:00 | |
AT89S8252, change in serial programing![]() | 01/01/70 00:00 | |
Problem in migrating from AT89S8252 to AT89S8253 - Pls hel | 01/01/70 00:00 | |
Please explain your hardware | 01/01/70 00:00 |