View previous topic :: View next topic |
Author |
Message |
sermsak
Joined: 27 Oct 2009 Posts: 2
|
How to test 11LC160.c? |
Posted: Tue Oct 27, 2009 9:54 am |
|
|
I just tried to use 11AA040, a part that is EEPROM, UNI/O protocol and
try with EX_EXTEE.c
#include device 11LC160.c and then burn in chip, but its not working.
This code has a bug or not? I am using compiler 4.099. Someone help
me please. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 27, 2009 2:25 pm |
|
|
1. What PIC are you using ?
2. What is the Vdd voltage for your PIC and the eeprom ?
3. What is the size of the pull-up resistor on the SCIO pin of the eeprom ?
4. What PIC pin are you using for the SCIO signal ? The 11LC160.c file
defaults to using Pin D0. Did you specify a different pin ?
This line is in the 11LC160.c file:
Code: | #define PIN_UNIO_TRANSFER PIN_D0 |
|
|
|
sermsak
Joined: 27 Oct 2009 Posts: 2
|
|
Posted: Tue Oct 27, 2009 9:47 pm |
|
|
Hi PCM programmer
Thank you so much for your reply, yes
1. I am using PIC16F877A
2. The Both of VDD are feed by 5V
3. 20K ohm
4. Sure, I define PIN_DO
I saw on 11LC160.c code, Why does it not have a START HEAD section?
Refer as datasheet of Microchip 11XXXX. And also I define device_address = 0xA0
I think this code may has a bug........ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 28, 2009 3:56 pm |
|
|
I ordered an 11LC160 chip. I was curious about these chips anyway.
It will get here in a few days and I'll test it. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Nov 01, 2009 5:22 pm |
|
|
I tried the 11LC160.c driver (vs. 4.099 compiler) and I could not get it to
work. I tried the test program shown below. I always get back the last
byte that was written:
I agree that it doesn't appear that CCS writes the Start Header (0x55)
to the eeprom. The sample code for C18 shows that they always write
the Start Header at the beginning of an operation.
I'll email CCS about this.
Code: |
#include <16F877.H>
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#define PIN_UNIO_TRANSFER PIN_C0
#include <11LC160.c>
//======================================
void main()
{
int16 addr;
int8 data;
init_ext_eeprom();
write_ext_eeprom(0, 0x55);
write_ext_eeprom(1, 0xAA);
data = read_ext_eeprom(0);
printf("%X ", data);
data = read_ext_eeprom(1);
printf("%X ", data);
printf("\n\r");
while(1);
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 03, 2009 1:43 pm |
|
|
CCS sent me a new 11LC160.c driver file which does work.
If you need the driver, then email CCS support.
Here's the output of the program shown below:
Quote: |
00: 00
01: 01
02: 02
03: 03
04: 04
05: 05
06: 06
07: 07
08: 08
09: 09
|
Test program:
Code: | #include <16F877.H>
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#define PIN_UNIO_TRANSFER PIN_D7
#include <11LC160_latest_4MHz.c>
//======================================
void main()
{
int16 addr;
int8 data;
int8 i;
init_ext_eeprom();
// Fill the first 10 bytes in the eeprom
// with values from 0 to 9.
for(addr=0; addr < 10; addr++)
{
write_ext_eeprom(addr, (int8)addr);
}
// Now read them back.
for(addr=0; addr < 10; addr++)
{
data = read_ext_eeprom(addr);
printf("%2X: %2X\n\r", addr, data);
}
while(1);
} |
|
|
|
|