Hello All,
Can somebody tell me, how can I read and store the .inc file using Arduino? This .inc file has some sromTables with some hexadecimal values. I've to use this inc file to program a sensor.
Please help somebody.
Thanks!
Hello All,
Can somebody tell me, how can I read and store the .inc file using Arduino? This .inc file has some sromTables with some hexadecimal values. I've to use this inc file to program a sensor.
Please help somebody.
Thanks!
how can I read and store the .inc file using Arduino?
Read it from where? Store it where?
Please find the attached inc file from this post : http://arduino.cc/forum/index.php/topic,68531.0.html
I want to store this file (and later use) to Arduino or SD Card.
Please find the attached inc file from this post
OK, so now I know what an inc file looks like. I still have no idea where you want to read that file from. The Arduino can not read from your PC. It can read from the serial port, if you have something on the PC writing the file to the serial port.
That file is much too large to store on the Arduino, so you need an SD card. Writing data from a buffer, where Serial.read() was used to populate the buffer, to an SD card is easy. Opening the file is easy. Closing the file when all the data has been written is easy. There are examples with the SD library.
What about PROGMEM in Arduino? Can't I use to that to store the data from file ?
And, do you know any program that can send the data to Arduino (over rs 232) ?
I think your best way to get that into the Arduino is to edit the file and convert the table into a set of 8 256-byte arrays which are initialized with hex constants and add the PROGMEM qualifier so that they will fit.
There's a fair bit of editing needs to be done although some of it can be with a search&replace e.g. removing the "db" from each line is easy.
The main ugliness is converting each of the numbers from the form (e.g.) 44h to 0x44.
So, this:
sromTable1:
db 44h,00h,9eh,9eh,dfh,......
is converted to this:
PROGMEM unsigned char sromTable1 = {
0x44,0x00,0x9e,0x9e,0xdf,......
};
and then the same thing for the other 7 tables.
Pete
At the same location, you can also see a file with same file name but with txt location. This txt file contain only hexadecimal value but with "0x" prefix. I suspect that the data in inc file and txt file are same. I don't even know, what these sromTable mean.
Actually, I have once converted all values in txt file to hexadecimal with "0x" prefix and stored into PROGMEM as an array. But, somehow it didn't work or I don't know, what actually happened. Space limitation (whole data is just 1986 byte, should be a problem for Arduino's 32KB flash,right)?
The .txt file does appear to contain the same data as the .inc file.
1986 bytes wouldn't be a problem for PROGMEM as long as you don't have lots of PROGMEM strings and code.
I don't even know, what these sromTable mean.
So why do you need to get them into an Arduino?
Pete
Because this is the program that I must save on microcontroller or eeprom and then download it to the sensor chip. As I have tried the data from txt file and the process didn't work, I thought these file (inc and txt) must have a difference. Some people said on some forums that sromTables should be mapped to memory locations and each sromTable is devoted to a particular function.
Yes, except this sromTable and db thing, the data appears to be same. I will try again. This time, maybe with SD card as I have it.
I had a success in storing txt file (which was same of inc file). I had saved all hexadecimal value as an array in progmem.
My sensor is also working.