PDA

View Full Version : Help: how to store a hexadecimal file in flash memory



Sakai
- 17th April 2007, 05:30
Hello,

I have just started with pic's. I am using pic18f258. It has 32k of flash memory. I would like to store a file in a determined space. I tried to find for functions in pdf's, but I couldn't. If anyone could help me!?

I am using MPLAB IDE V7.30 and C programming.
This is a file to send by CAN communication.

Thanks,

Rodrigo Sakai

skimask
- 17th April 2007, 11:34
I have just started with pic's.

This is the key phrase right here. What have you done with PIC's so far? What have you done with MCU's in general? What do you really want to do with the '258? Storing a file is a very vague statement. There's a lot of ways to store a file, and a lot of places to store it.


I am using MPLAB IDE V7.30 and C programming

And you might want to find yourself a nice C forum to help you out with it all.

Sakai
- 17th April 2007, 17:55
>>This is the key phrase right here. What have you done with PIC's so far?

Just sent some CAN messages (J1939 Standard)

>>What have you done with MCU's in general?

I am trying to buid a CANbus with some Nodes..

>>What do you really want to do with the '258?

People from my lab was using 258 for CAN communication and embedded systems pourposes..

>>Storing a file is a very vague statement. There's a lot of ways to store a file, and a lot of places to store it.

I need to send data from one node (pic) to another one. This data is in a file (hexadecimal) and is about 15k long. I don't know how to save this "big" array of data in flash memory, or another better place..

Thanks
Regards

skimask
- 17th April 2007, 17:59
I am using MPLAB IDE V7.30 and C programming

????????????????

Sakai
- 17th April 2007, 18:42
Ok, thanks

Sakai
- 19th April 2007, 02:40
Ok, here is one way to solve my problem:

------------
#pragma romdata const_table

const rom unsigned char my_const_array [] = {
0,0,0,1,1,232,3,0,0,0,
1,0,28,8,0,173,0,0,232,3,
...
82,0,0,0,0,0,0,0,0,0,
0,128,63,0,0,2,0};

#pragma romdata
---------------------

This array of data is from a .txt file (notepad).

Bye

skimask
- 19th April 2007, 04:06
#pragma romdata const_table

const rom unsigned char my_const_array [] = {
0,0,0,1,1,232,3,0,0,0,
1,0,28,8,0,173,0,0,232,3,
...
82,0,0,0,0,0,0,0,0,0,
0,128,63,0,0,2,0};

#pragma romdata

I don't recognize any of those commands or statements...I'll bet PBP doesn't either.