Originally Posted by
mackrackit
Try skipping a location when writing to the EEPROM.
I tried your suggestion, Dave, and it doesn't appear to make any difference.
I have posted my latest code below and still have the same problem.
Hopefully someone can review this code and tell me why the HEX version of the serial_no is not being read or posted as it really is in the chip. I know the code from the chip because of use of the ConfigUtility from ConnectOne that reads the code from the chip separately from my code. It is 14 04 26 88 but is being read and posted by my code as 48 28 13 13. Any help appreciated!
I first use the following code to read the iChip serial_no from the MiniSocket module and store it in the EEPROM of my MCU so I can see it on a post-run test to see what was read/stored.
Code:
SEROUT2 TX, 84, [ "AT+iRP5",$d ,$a ] ' Command the Minisocket to report the chip serial number and write it to EEPROM in MCU
SERIN2 RX ,84, 8000 ,BOOT ,[ serial_no(0),serial_no(1),serial_no(2),serial_no(3) ]
WRITE 51,serial_no(0)
WRITE 52,serial_no(1)
WRITE 53,serial_no(2)
WRITE 54,serial_no(3)
Then when I receive an hourly driven alarm interrupt from my RTC I execute the following FTP routine to send the serial_no to my web site for posting and usage in PHP code on the website. It shows up on the website as the same values that were stored in the EEPROM as described above and not what the actual serial_no is known to be. The extra labels listed in this routine are to provide repeat paths for each SERIN2 statement in case of the WAIT failure in order to improve the reliability of the over all code in making a complete communications session.
Code:
FTP_serial_no: 'FTP the chip serial number
'============
Session2: ' Command MiniSocket to Open Session 2
SEROUT2 TX,84,["AT+iFOPN:lodestarassoc.com:jellis00,password",$d,$a]
SERIN2 RX,84,4000,Session2,[WAIT("I/000")] :PAUSE 100
Directory2: ' Command MiniSocket to set the target directory name
SEROUT2 TX,84,["AT+iFCWD:000,TempAlarm",$d,$a]
SERIN2 RX,84,1000,Directory2,[WAIT("I/OK")]
File2: ' Command MiniSocket to set the target file name abd send serial_no in HEX format
SEROUT2 TX,84,["AT+iFSTO:000,","serial_no.txt",$d,$a]
SERIN2 RX,84,1000,File2,[WAIT("I/OK")]
SEROUT2 TX,84,["AT+iFSND:000,8:",HEX2 serial_no(0),HEX2 serial_no(1),HEX2 serial_no(2),HEX2 serial_no(3),$d,$a]:PAUSE 200
Close2: 'Close file
SEROUT2 TX,84,["AT+iFCLF:000",$d,$a]
SERIN2 RX,84,1000,Close2,[WAIT("I/OK")]:PAUSE 100
Off2: 'Close Session
SEROUT2 TX,84,["AT+i!FCLS:000",$d,$a]
SERIN2 RX,84,1000,Off2,[WAIT("I/ONLINE")]:PAUSE 100
RETURN
Bookmarks