PFC8583 Connection and I2Cwrite I2cread!


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    You should use $A1 or $A0 as far as I know...

    Is you control register set to the right value??
    I2CWrite DPIN,CPIN, $A1,$00,[ $09 ] ( See datasheets for the value you need)

  2. #2
    Join Date
    Apr 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    thx!

    i can read and setup time !
    but , clock counts very slow !! I couldnt adjust with variable condansator !!

    please help !!

  3. #3
    Join Date
    Dec 2005
    Location
    Corum,Turkiye
    Posts
    15


    Did you find this post helpful? Yes | No

    Default hi Uludere

    i dont understand why it "slow" .. ..
    you write me..

    Hocam merhaba...
    Pcf de sorun yaşamaman lazım.. Ben ikisinide kullandım. ds1307 veya pcf8583 problemsiz entegreler bunlar. bana sıkıntını tam yazarsan yardımcı olabilirim.



    ------------------------------------
    Elektroline
    www.labarna.com
    [email protected]
    ------------------------------------

  4. #4
    Join Date
    Apr 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    thx elektroline!!
    i am going to send my problem on monday !!

  5. #5
    Join Date
    Apr 2005
    Posts
    32


    Did you find this post helpful? Yes | No

    Default ds1302 AND pfc8583

    pfc 8583 is counting 1 minute in 2 minute ?
    and second is counting to 99?
    Last edited by uludere72; - 24th February 2006 at 21:02.

  6. #6
    Join Date
    Feb 2006
    Posts
    4


    Did you find this post helpful? Yes | No

    Wink Help from Brazil

    Hi, I am a Brazilian Electronic Engineer and my website is www.fdai.net

    I would like to help my friends that have problems with PCF8583 and Melabs PICBasicPRO
    My code for this :
    '************************************************* ***************
    ' PCF 8583 APREDENDO_1.0
    ' programa para testar o chip PCF8583
    ' na placa do Distribuidor de Energia
    ' 26/Fev/2006
    '************************************************* ***************
    define OSC 20
    DEFINE ADC_BITS 10
    define ADC_CLOCK 1
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 2
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 3
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    symbol SCL = PORTC.3 ' I2C clock
    symbol SDA = PORTC.5 ' I2C data
    symbol UP = PORTA.4
    SYMBOL DOWN = PORTA.3
    SYMBOL ENTER = PORTA.2
    SYMBOL SEL = PORTA.1
    ;*******************************************
    ; Configuração do PIC
    ;*******************************************
    TRISA=%00111111
    TRISB=%00000000
    TRISC=%00100000
    TRISD=%00000000
    ADCON1 = $0E 'Configura somente RA0 como entrada de AD
    '******************************************
    PORTB=%00000000
    PORTC=%00000000
    PORTD=%00000000
    '*****************************************
    '------------------------
    ' VARIAVEIS DO PROGRAMA
    HOUR VAR BYTE
    MINUTE VAR BYTE
    DAY VAR BYTE
    MONTHY VAR BYTE
    YEAR VAR BYTE
    S VAR BYTE
    M VAR BYTE
    H VAR BYTE
    D var byte
    Mn var byte
    Y var byte
    TEMPO VAR WORD
    '-----------------------
    lcdout $fe,1 'limpa o display
    Pause 500
    lcdout "PCF8583 Aprender"
    Lcdout $fe,$c0
    LCDOUT "FDAI Eletronica"
    Pause 1500
    lcdout $fe,1 'limpa o display
    Pause 100

    Main:
    I2CREAD SDA,SCL,%10100001,2,[S]
    I2CREAD SDA,SCL,%10100001,3,[M]
    I2CREAD SDA,SCL,%10100001,4,[H]
    I2CREAD SDA,SCL,%10100001,5,[D]
    I2CREAD SDA,SCL,%10100001,6,[Mn]
    I2CREAD SDA,SCL,%10100001,7,[Y]

    IF PORTA.1=0 THEN GOSUB ACERTAR

    lcdout $fe,1 'Limpa o LCD
    lcdout $fe,2 'cursor n primeira posição
    lcdout "Hora: ", hex(H),":", hex2(M),":", hex2(S)
    lcdout $fe,$c0 'segunda linha do display
    lcdout "Data: ", hex2(D),".", hex2(Mn),".20",hex2(Y)

    IF PORTA.1=0 THEN GOSUB ACERTAR

    Pause 500
    goto Main 'VOLTA PARA O LOOP PRINCIPAL

    '************************************************* *****************
    ' Rotina de ajuste do relogio RTC
    ACERTAR:
    lcdout $fe,1
    Lcdout "Acertar hora"
    Pause 1000
    TEMPO = 1000
    'Verifica se algum botao de ajuste foi pressionado:
    '------------------------
    VER_BOTOES:

    IF TEMPO =0 THEN
    GOSUB GRAVAR_HORARIO
    RETURN
    ENDIF


    tempo = tempo -1
    ' Checa se algum botao de ajuste de h/min foi pressionado
    If PORTA.3 = 0 Then decmin
    If PORTA.4 = 0 Then incmin ' Last 2 buttons set minute
    If PORTA.1 = 0 Then dechr
    If PORTA.2 = 0 Then inchr ' First 2 buttons set hour
    pause 50
    Goto VER_BOTOES

    '*************************************************
    ' Increment minutes
    incmin: minute = minute + 1
    If minute >= 60 Then
    minute = 0
    Endif
    Goto debounce

    ' Increment hours
    inchr: hour = hour + 1
    If hour >= 24 Then
    hour = 0
    Endif
    Goto debounce

    ' Decrement minutes
    decmin: minute = minute - 1
    If minute >= 60 Then
    minute = 59
    Endif
    Goto debounce

    ' Decrement hours
    dechr: hour = hour - 1
    If hour >= 24 Then
    hour = 23
    Endif
    goto debounce
    '************************************
    'essa é uma parte da rotina de acerto do relogio
    debounce: 'atualiza o relogio na tela na hora do acerto do relogio
    pause 200
    tempo= 90
    lcdout $fe,1
    Lcdout $fe,2
    Lcdout "Acerte Horario:"
    lcdout $fe,$c0
    Lcdout dec2 hour, ":", dec2 minute, ":00"
    goto VER_BOTOES
    '************************************

    '*************************************
    GRAVAR_HORARIO:
    'Converte para Hexadecimal
    DAY = 26
    MONTHY = 4
    YEAR=06

    M = MINUTE/10*16 + MINUTE//10
    H= hour/10*16 + hour//10
    D= DAY/10*16 + DAY//10

    Mn= MONTHY/10*16 + MONTHY//10
    Y = YEAR/10*16 + YEAR//10

    I2cwrite SDA,SCL,%10100001,2,[0]
    I2Cwrite SDA,SCL,%10100001,3,[M]
    I2Cwrite SDA,SCL,%10100001,4,[H]
    I2CWRITE SDA,SCL,%10100001,5,[D]
    I2CWRITE SDA,SCL,%10100001,6,[Mn]
    I2CWRITE SDA,SCL,%10100001,7,[Y]
    RETURN
    '************************************
    End

Similar Threads

  1. PIC 18F4550 and MCP23017
    By DaveC3 in forum Code Examples
    Replies: 12
    Last Post: - 4th December 2010, 15:01

Members who have read this thread : 0

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