![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
offy11
Joined: 07 May 2005 Posts: 3
|
12F675 VS DS1307 |
Posted: Fri Jun 03, 2005 9:00 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
offy11
Joined: 07 May 2005 Posts: 3
|
.. |
Posted: Sat Jun 04, 2005 1:36 am |
|
|
thank for your help but when i review follow you suggest i can not make it work
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);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
offy11
Joined: 07 May 2005 Posts: 3
|
thank |
Posted: Sat Jun 04, 2005 8:40 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|