Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

i2c problem in pic 18f4620

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
344
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
3,881
i connected a ds3231 rtc to pic 18f4620
if i use soft i2c ( ccs complier) the rtc is working good if i switch off and on the main power for 3 are 4 times one time the day or time changes how to solve this problem.

the soft i2c settings are :
#include <18F4620.h>
#device ADC=16

#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
//#use I2C_Speed (400000);
#use delay(crystal=12MHz)
#use I2C(Master, SDA = pin_C4, SCL = pin_C3,NOINIT,Fast=300000) // software

if i use the hard ware i2c every thing working fine if i intrupt the main power 3 are 4 times one time the pic chip gets hanged no data in lcd even if i press the reset button no change after some 5 minutes of power off and on i can get the data
in hard ware i2c the date and time is not changing.
how to solve this

#use i2c(Master,Fast=300000,I2C1,force_hw) // hardware

the rtc is backed up with 3.3v batt

regards
kalyan
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Zip and post the complete CCS C Project files. Are you using development board or prototype board ?

Not related to your issue.

Code:
#device ADC=16
is wrong. It should be

Code:
#device ADC=10
Are you using licensed compiler ? If you are using cr****d compiler then it might be generating wrong .hex code.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top