S19 Hex Converter program.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S19 Hex Converter program.

29,582 Views
priyanto
Contributor II
Hi,
 
I'm trying to convert raw data bytes into S19 Motorola format. I downloaded several S19 converter programs from the website such as BIN2S19, Bin2Mot, but I already tried using these programs, they convert the raw data bytes into S19 format in ASCII mode which is not what I want. For example, raw data bytes : 0x01, 0x02, 0x03 becomes 0x31, 0x32, 0x33. I want the exact raw bytes to be programmed into the flash, e.g: 0x01, 0x02, and so on. I would appreciate if anybody can help. Thanks.
 
Regards,
-priyanto.
 
 
Labels (1)
0 Kudos
Reply
6 Replies

3,167 Views
bigmac
Specialist III

Hello priyanto,

I assume that your "raw data bytes" are a binary image of the contents of (flash/PROM/RAM) memory.  A problem you may be encountering is that the first byte of the data would be assumed to commence at address 0.  However, this is probably not what you require - you probably need to offset the data to start at a specific non-zero location.  The simple utilities that you mention may not have the capability to provide an offset for the data, required for the S19 file.

Also note that the S19 format (and also the Intel hex format) represent all data as printable ASCII characters.  So the byte value 0x01 is represented by the character sequence "01" (0x30, 0x31).  However, when an S19 file is loaded, each byte value will be decoded from its two-character sequence.  There may be some confusion about this.

Regards,
Mac

PS
I have subsequently done some quick tests with BIN2S19 and BIN2MOT utilities.  Both seem to have the ability to provide data offset.  I had no problem with BIN2S19, and it produced the expected result with the command line "BIN2S19  file.bin  offset", with the offset expressed in hex.

However, I could not get BIN2MOT to produce the correct offset - but perhaps I did not correctly set up the command line options.

 

Message Edited by bigmac on 2006-06-22 04:22 PM

0 Kudos
Reply

3,167 Views
priyanto
Contributor II

Hi Mac,

Now I use the binary file format instead of hex file, and run BIN2S19.EXE again. Then I use CW hiwave to download the program into the flash, and everything works great. The problem is that everytime I download the code, CW always asks me to erase the FLASH, so I have no choice. Like David said, I have to download the program first, then program the data into the blank portion of the flash. BTW, we have 32K bytes of data. It will occupy half of the flash of HC9S08GT60.

During our production, we will have thousands of tags each has HC9S08GT60 microcontroller. I'm still trying to find out the best way to do this since later on the manufacturing guys will do the job. Furthermore, each tag has its own unique ID preprogrammed into the flash of each microcontroller. Do you know the best way or any tool for automating the process in the production ?

Appreciate any helpful responses.

-priyanto.

3,167 Views
irob
Contributor V
Have you looked at BINCVT? I haven't personally, but it claims to do what you want.

I'm curious, why do you need this? Don't you have a compiler or assembler which makes your machine code for you?
0 Kudos
Reply

3,167 Views
priyanto
Contributor II

Hi Irob,

Thanks for your reply. I need a program to convert bin or hex to S19 Motorola format so that 'hiwave' program can download it into the flash. Hiwave expects the S19 Motorola format. I have 16K bytes of raw data that needs to be burnt into the flash separately from my code. BTW, I use HC9S08 and CodeWarrior 5 IDE. BINCVT is converting into binary as far as I know.

Regards,

priyanto.

 

0 Kudos
Reply

3,167 Views
irob
Contributor V
I see. Here's a write up on the Mot S record standard.
0 Kudos
Reply

3,167 Views
peg
Senior Contributor IV

Hi,

Failing everything else a bit of search/replace in a good editor should yield you source code that can then be assembled into a S19.

Replace ,0x with /nDB $   in your data file example, then stick an ORG statement on top and off you go!

Regards David

Message Edited by peg on 2006-06-22 09:01 AM

0 Kudos
Reply