View previous topic :: View next topic |
Author |
Message |
foodwatch
Joined: 18 Apr 2006 Posts: 66
|
#serialize question for 18F4550 |
Posted: Tue Jul 15, 2008 9:10 pm |
|
|
I am trying to use the #serialize function but cannot get it right. I am looking to write a "long" numeric serial number in the internal eeprom locations 1 and 2. I try the below line, but it starts with serial number 256
#serialize(dataee=1,binary=2,next="1",prompt="Enter Sensor ESN 1-60000")
With the above example I wish the file to present the last serial number +1 and allow me to accept or type over it with a new number.
Later in the program I read it from eeprom into a long variable nSSN
nSSN = make16(read_eeprom(1),read_eeprom(2));
I'm sure I am doing something simple wrong. I have tried this with both MachX and ICD
Thanks |
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jul 16, 2008 10:00 am |
|
|
Could it be as simple as swapping the bytes? Try swapping the arguments of make(16).
nSSN = make16(read_eeprom(2),read_eeprom(1)); _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
foodwatch
Joined: 18 Apr 2006 Posts: 66
|
|
Posted: Wed Jul 16, 2008 10:04 pm |
|
|
Thanks for the suggestion... I made the mistake of downloading the latest software for the ICDU and the PWH compiler and now nothing writes to the eeprom no matter which form I choose.
If I use:
#rom int 0xf00001 = {0,5}
I am able to write the eeprom each and every time. (but a pain to implement)
Next I tried to use the serialize function in the MachX programmer software. It asks for my serial number and other details and then the window below says it is writing two bytes to eeprom, but in reality, when I program the 18f4550, nothing happens(in the data eeprom).... no write takes place at all. The non-data eeprom code programs fine. Both ICD and MachX show eeprom data to be written, but when I view the eeprom contents after programming in MachX, no eeprom values are written at all.
Time for a beer and bed :-) |
|
![](templates/subSilver/images/spacer.gif) |
|