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

12F675 VS DS1307

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



Joined: 07 May 2005
Posts: 3

View user's profile Send private message

12F675 VS DS1307
PostPosted: Fri Jun 03, 2005 9:00 am     Reply with quote

I use code form http://www.ccsinfo.com/forum/viewtopic.php?t=19926&highlight=ds1307 for 16F819 it work but why i modified that code for 12F675 it not work

original
Code:

#include <16F876.h>
#fuses HS,NOWDT,NOPROTECT,PUT,BROWNOUT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#use i2c(Master, SDA=PIN_B7, SCL=PIN_B6)
#include <ds1307.c>

========================================
modified for 16F819 it work
Code:

#include "16F819.h"
#fuses NOWDT,XT,NOPUT,NOPROTECT
#use delay (clock=4000000)
#use rs232(baud=2400,xmit=PIN_A2,rcv=PIN_A3)
#use i2c(Master, SDA=PIN_B1, SCL=PIN_B0)
#include "ds1307.c"

========================================
modified for 12F675 it not work
Code:

#if defined(__PCM__)
#include <12F675.h>
#fuses INTRC_IO,NOWDT,NOPROTECT,NOMCLR,PUT
#use delay(clock=4000000)
#use rs232(baud=2400,xmit=PIN_A5)
#use i2c(Master,SDA=PIN_A0,SCL=PIN_A1)
#include "ds1307.c"


i connect
12F675
pin1-->gnd
pin 2-->TX
pin6-->SCK(ds1307 pin6)
pin7-->SDA(ds1307 pin5)
pin8-->vcc

ds1307
pin1,pin2-->OSC 32.768 K
pin 3-->3v
pin 4-->gnd
pin5-->(12f675 pin7 pull up)
pin6-->(12f675 pin6 pull up)
pin8-->vcc

i so confuse why it not work on 12F675 (it not send anything to hyper or lcd) but it work on 16F819

PS. sorry about my english skill and thank you for your help


Last edited by offy11 on Sat Jun 04, 2005 8:06 am; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 9:30 am     Reply with quote

See this thread regarding disabling the comparators. This thread
is for the 12F629, but they are very similar chips.
http://www.ccsinfo.com/forum/viewtopic.php?t=21739&highlight=cmcon
offy11



Joined: 07 May 2005
Posts: 3

View user's profile Send private message

..
PostPosted: Sat Jun 04, 2005 1:36 am     Reply with quote

thank for your help but when i review follow you suggest i can not make it work Sad
i use IDE v3.43 PCB,PCM,PCH v 3.2.0.2

Code:
#if defined(__PCM__)
#include <12F675.h>
#fuses INTRC_IO,NOWDT,NOPROTECT
#use delay(clock=4000000)
#use rs232(baud=2400,xmit=PIN_A5)
#use i2c(Master,SDA=PIN_A0,SCL=PIN_A1)

#byte CMCON=0x19

#include "ds1307.c"
void ds1307_set_date_time(void);
void ds1307_read_date_time(void);

void ds1307_write_byte(char addr, char value);
char ds1307_read_byte(char addr);

char bin2bcd(char binary_value);
char bcd2bin(char bcd_value);

//=============================================
main()
{
char sec;
char min;
char hrs;
char day;
char date;
char month;
char yr;

CMCON=7;

gca_ds1307_regs[DS1307_SECONDS_REG] = 0;
gca_ds1307_regs[DS1307_MINUTES_REG] = 10;
gca_ds1307_regs[DS1307_HOURS_REG] = 8;
gca_ds1307_regs[DS1307_DAY_OF_WEEK_REG]= 0;
gca_ds1307_regs[DS1307_DATE_REG] = 19;
gca_ds1307_regs[DS1307_MONTH_REG] = 4;
gca_ds1307_regs[DS1307_YEAR_REG] = 05;

ds1307_set_date_time();


 
while(1)
 {
 delay_ms(1000);
 ds1307_read_date_time();

 sec = gca_ds1307_regs[DS1307_SECONDS_REG];
 min = gca_ds1307_regs[DS1307_MINUTES_REG];
 hrs = gca_ds1307_regs[DS1307_HOURS_REG];
 day = gca_ds1307_regs[DS1307_DAY_OF_WEEK_REG];
 date = gca_ds1307_regs[DS1307_DATE_REG];
 month = gca_ds1307_regs[DS1307_MONTH_REG];
 yr = gca_ds1307_regs[DS1307_YEAR_REG];

 printf("\%d/\%d/\%02d \%d:\%d:\%02d\n\r",month,date,yr,hrs,min,sec);
 }
}
offy11



Joined: 07 May 2005
Posts: 3

View user's profile Send private message

thank
PostPosted: Sat Jun 04, 2005 8:40 am     Reply with quote

thank PCM programmer.the first part is work.thank you very much.i will to next part (24L08,PCF8591).when i have some problem i will come here and consult to you. if you have some suggest about 24L08,PCF8591 interface with 12f675 please tell me (because my work is so late some suggestion may be make me go quick)thank again.
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