ds1307 from f877 to f452 not work


Results 1 to 24 of 24

Threaded View

  1. #1
    microkam's Avatar
    microkam Guest

    Angry ds1307 from f877 to f452 not work

    this code is run ok on 16f877,when i download this code on 18f452 there is one problem that the ds1307 not work, in the same time the 24lc256 on the same bus is working good...whats the problem!!!!


    define osc 4
    DEFINE LOADER_USED 1

    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 3
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 2
    DEFINE LCD_BITS 4
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    DEFINE LCD_LINES 2


    DPIN var PORTC.4 'I2C DATA PIN 24LC256 and ds1307,with 4K7 pull up
    CPIN var PORTC.5 'I2C CLOCK PIN with pulled up resister 4K7


    add var word
    d1 var byte
    d2 var byte
    B0 var byte
    sec var byte
    sec0 var byte
    sec1 var byte
    rtcco var byte
    rtcad var byte

    pause 500
    rtcco=$D0
    rtcad=0
    B0=0
    I2CWRITE DPIN,CPIN,rtcco,rtcad,[B0,B0,B0,B0,B0] ' intilization of ds1307
    lcdout $FE,1," start"
    main:
    pause 1000
    add=0
    d1=9
    I2cWRITE DPIN,CPIN,$A0,add,[d1] 'eeprom write
    pause 30
    I2CREAD DPIN,CPIN,$A1,add,[d2] 'eeprom read
    gosub readtime
    lcdout $FE,1,#d2," ",#sec
    goto main

    readtime:
    rtcco=$D0
    rtcad=0
    I2CREAD DPIN,CPIN,rtcco,rtcad,[B0] 'ds1307 read
    sec0=B0&%00001111
    sec1=B0&%01110000 : sec1=sec1>>4
    sec=sec0+sec1*10
    return
    Last edited by microkam; - 6th July 2005 at 13:37.

Similar Threads

  1. pls help me verify my code not work, why???
    By chai98a in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th January 2010, 09:19
  2. Can't get switch to work
    By JeffnDana in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th April 2007, 20:44
  3. DS1307 on fire
    By brid0030 in forum General
    Replies: 6
    Last Post: - 25th November 2006, 02:44
  4. How to set ICD-2 clone to work with PBP?
    By G-R-C in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th October 2006, 02:50
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts