![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi,
How can i specify a variable in flash or ROM of PIC16F877A. (MicroC compiler) my variable is "unsigned char temp[1024];" but this is so larg for RAM. i want specify this variable in flash but i don't know how can i. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Thanks Nigle,
I have 512K EEPROM and i want to write 1024 byte of EEPROM in ROM. i write this code : I2C_Start(); I2C_Wr(0xA2); // send byte via I2C (device address + W) I2C_Wr(2); // send byte (data address) I2C_Repeated_Start(); // issue I2C signal repeated start I2C_Wr(0xA3); // send byte (device address + R) for(i=0; i<1024; i++) temp[i] = I2C_Rd(0u); // Read the data (NO acknowledge) I2C_Stop(); but "temp" is larger than RAM size and error appeared. how can i write EEPROM data on ROM? |
|
|
|
|
|
|
(permalink) | |
|
Quote:
READ ONLY memory. |
||
|
|
|
|
|
(permalink) |
|
As Nigel says, you can't have variables in ROM but you can have constant in ROM.
In C18 you would do, Code:
rom char RomData[] = "This is character data"; rom char RomHex[]="\x23\x45\x67"; // will be bytes 0x23,0x45,0x67 Alternatively you could do a large table in asm using retlw. Edit, I just noticed you want to write to your variable. This can be done but you have to write the bit that does the writing in asm. Check out the EEPROM section in the data sheet. Mike. Last edited by Pommie; 4th February 2008 at 09:11 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Mike. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
Mike. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
But I would suggest he needs to rethink what he's doing?, I suspect he's a PC programmed and used to fairly unlimited resources. |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Logic circuit for two cameras and one flash. | Hermit | Electronic Projects Design/Ideas/Reviews | 30 | 10th December 2007 03:25 AM |
| Using Oscilloscopes | mechie | Electronic Theory | 9 | 29th November 2007 09:48 PM |
| Disposiable camera flash modification | HarveyH42 | Electronic Projects Design/Ideas/Reviews | 9 | 5th April 2006 04:24 PM |
| How to reset SCR used for triggering camera flash | shootfirst | Electronic Projects Design/Ideas/Reviews | 20 | 28th September 2005 08:40 PM |
| electronic switch to enable a camera to fire a flashgun | tony ellis | Electronic Projects Design/Ideas/Reviews | 10 | 30th September 2004 10:18 AM |