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 CCS Technical Support

I2C built-in function is OK on 12c5x series????

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







I2C built-in function is OK on 12c5x series????
PostPosted: Fri Dec 13, 2002 3:20 pm     Reply with quote

Sigh...please help me!!!
I'm new in pic programming, i'm not able to use write_ext_eeprom and read_ext_eeprom on my project using pic12c509a, the same projet compiled for 16f84 work right.

look a little portion of code.

#include "12c509a.h"
#use delay(clock=4000000)
#include <2404.c>
// *************MAIN !!!!!!!!!!!!!!!!!!!!!!
void main(){
int x;
init_ext_eeprom();
x=5;
write_ext_eeprom(0,x);
}


Of course i have customized 2404.c file setting sda pinb5 and scl pinb4.

Please someone can help me????
___________________________
This message was ported from CCS's old forum
Original Post ID: 10042
R.J.Hamlett
Guest







Re: I2C built-in function is OK on 12c5x series????
PostPosted: Fri Dec 13, 2002 3:39 pm     Reply with quote

:=Sigh...please help me!!!
:=I'm new in pic programming, i'm not able to use write_ext_eeprom and read_ext_eeprom on my project using pic12c509a, the same projet compiled for 16f84 work right.
:=
:=look a little portion of code.
:=
:=#include "12c509a.h"
:=#use delay(clock=4000000)
:=#include <2404.c>
:=// *************MAIN !!!!!!!!!!!!!!!!!!!!!!
:=void main(){
:=int x;
:= init_ext_eeprom();
:=x=5;
:= write_ext_eeprom(0,x);
:= }
:=
:=
:=Of course i have customized 2404.c file setting sda pinb5 and scl pinb4.
:=
:=Please someone can help me????
Obvious questions, are what configuration settings are you using?. This will only work on b4, and b5, with the INTRC setting, and only with B4, set as I/O, not OSC2. By default the configuration for a 12C671 (which I use more than the 509), if set to 'INTRC', sets the chip up with B4 set as OSC2. If this was happening, the interface wouldn't work, because there would be the processor clock on this pin, rather than the required data!.
Check in your programmer that the bits are set correctly.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 10044
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

Re: I2C built-in function is OK on 12c5x series????
PostPosted: Sun Dec 15, 2002 6:09 am     Reply with quote

Hi, Can I just add that your main() function does not have a loop in it. After the write_ext_eeprom line, you should add a 'while(TRUE) {}' so that when the last instruction has been executed, the processor loops forever. If this is not present, the processor (I think) will run off the end of the code into unprogrammed ROM space and just keep wrapping around to the beginning. You would probably see an effect like the PIC keeping resetting itself.

Also, just mentioning this in case you forgot... Do you have pullup resistors on your SDA and SCL lines? The best values to use is 1K - 2.2K. The internal port B pullups on the PIC (if configured) are too high a resistance to be effective with I²C.

:=Sigh...please help me!!!
:=I'm new in pic programming, i'm not able to use write_ext_eeprom and read_ext_eeprom on my project using pic12c509a, the same projet compiled for 16f84 work right.
:=
:=look a little portion of code.
:=
:=#include "12c509a.h"
:=#use delay(clock=4000000)
:=#include <2404.c>
:=// *************MAIN !!!!!!!!!!!!!!!!!!!!!!
:=void main(){
:=int x;
:= init_ext_eeprom();
:=x=5;
:= write_ext_eeprom(0,x);
:= }
:=
:=
:=Of course i have customized 2404.c file setting sda pinb5 and scl pinb4.
:=
:=Please someone can help me????
___________________________
This message was ported from CCS's old forum
Original Post ID: 10048
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