Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Yuanming

  • Rank
  1. Hi, In my program, I use pointer in C function, this function usually working well. but when the program is long ( Hex file about 5K Byte), program will be running in unending cycle. I check in step mode, the problem is the pointer does not point to the right place. but I am sure this function working well at the early place in my program. But, when I change some function's place (change the order) in the program, the program working well. I don't know it is why. How can I solve this problem. my functio is: /*******************************************/ /* Write a const string to the LCD */ /*******************************************/ void WriteString( const char *lcdpoint ) { char pi; char ch; pi = 0; while( lcdptr[pi] != 0 ) // Check for end of string {ch = lcdpoint[pi++]; Write_Data_LCD( ch ); // Display on LCD } }
  2. Hi, I use MAPIDE for Win/16 5.70.00, MAPICD Versin 1.44.00. I program to write/read data to internal EEPROM in 16F877. but it can only read, (I use LCD display data which I store before program MAPICD), I try many options of PAMICD, set Code Protect and Code Protect Data EE as OFF, both debug mode and un-debug mode is not workng for writing. my code below: char EEECON1@0x18c; char EEECON2@0x18d; char EEEADR@0x10D; char EEEDATA@0x10C; char EEEADRH@0x10f; void write_eeprom ( char addr, char data ) //---- Write eeprom ----- { EEEADR = addr; // set address register EEEDATA = data; // set data register set_bit( STATUS, RP0 ); disable_interrupt( GIE ); // close interrupt clear_bit ( EEECON1,WRERR); clear_bit ( EEECON1, EEPGD ); set_bit( EEECON1, WREN ); set_bit( EEECON1, WR ); // write command EEECON2 = 0x55; EEECON2 = 0xAA; set_bit( EEECON1, WREN ); set_bit( EEECON1, WR ); clear_bit( EEECON1, WREN ); // inhibit further writing clear_bit(PIR2,EEIF); clear_bit( STATUS, RP0 ); enable_interrupt( GIE ); // open interrupt } char read_eeprom ( char addr ) //---- Read eeprom ----- { EEEADR = addr; // set address register set_bit( STATUS, RP0 ); clear_bit (EEECON1, EEPGD ); set_bit(EEECON1, RD ); // read command return (EEEDATA); }
  3. Hi, all: I am trying to use C language to write and read internal EEPROM on 16f877 to store some information, but it can not working. I have did it for a whole week,But both read and write is not working, I open EEPROM Windows in MPLAB, each byte is 0xff. I use C2C-plus IDE, MPASM and MPLAB IDE. I think program maybe no problem,( I use the sample in http://www.picant.com/c2c/examples/eeprom.html ) , is it necessary to set CONFIG register ( address: 0x2007) CPD ( Data EE memory code protection bit), and I don't know how to set it as 1. Thanks in advance for your time. Yuanming Lu
  • Create New...