CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to test 11LC160.c?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sermsak



Joined: 27 Oct 2009
Posts: 2

View user's profile Send private message

How to test 11LC160.c?
PostPosted: Tue Oct 27, 2009 9:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 27, 2009 2:25 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 27, 2009 9:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Oct 28, 2009 3:56 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Nov 01, 2009 5:22 pm     Reply with quote

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:
Quote:
AA AA

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

View user's profile Send private message

PostPosted: Tue Nov 03, 2009 1:43 pm     Reply with quote

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);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group