part 1 1186 bytes content-type:text/plain; charset=iso-8859-1; format=flowedAcabei encontrando um arquivo e selecionei algumas rotinas que lhe serco
zteis
{Quote hidden}
_________________________________________________________________
MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
part 2 4753 bytes content-type:text/plain; name="PCF8583.txt"; format=flowed
(unknown type 8bit not decoded)
;-------RxBytePCF ---------------------------------------------
;Rotina para receber um byte do barramento
;--------------------------------------------------------------
RxBytePCF
bsf STATUS,RP0
bsf TRISB,2
bcf STATUS,RP0
clrf DadoMemo
movlw 0x08
movwf ContaPulso
bsf SCL
NOP
NOP
btfsc PORTB,2
bsf DadoMemo,7
rlf DadoMemo
bcf SCL
decfsz ContaPulso
goto $-8
rlf DadoMemo
bsf STATUS,RP0
movlw 0xFB
andwf TRISB,1
bcf STATUS,RP0
bsf SDA ;Ack
call Dlay5u ;
bsf SCL ;
call Dlay5u ;
bcf SCL ;
return
;-------EscritaPCF-----------------------------------------------
;Rotina para escrever um byte alocado no Registro DadoMemo
;na Posigao de Memsria do PCF. O enderego da Posigao de Memsria
;deve estar no Registro PosiMemo
;----------------------------------------------------------------
EscritaPCF
bsf SDA
bsf SCL
call Dlay5u
bcf SDA ;Bit de start
call Dlay5u ;
bcf SCL ;
movlw 0xA0 ;Enderego do Relsgio
call TxBytePCF ;
movf PosiMemo,0 ;Enderego do Registro a ser escrito
call TxBytePCF ;
movf DadoMemo,0 ;Dado a ser escrito no Registro
call TxBytePCF ;
bcf SDA
bsf SCL ;Bit de stop
call Dlay5u ;
bsf SDA ;
return
;-------LeituraPCF -----------------------------------------------
;Rotina para Leitura de um byte da Posigao de Memsria do PCF(Registrado em
PosiMemo)
;e alocagco desse valor no Registro DadoMemo
;-----------------------------------------------------------------
LeituraPCF
bsf SDA
bsf SCL
call Dlay5u
bcf SDA ;Bit de start
call Dlay5u ;
bcf SCL ;
movlw 0xA0 ;Enderego do PCF
call TxBytePCF ;
movf PosiMemo,0 ;Enderego do Registro do PCF a ser lido
call TxBytePCF ;
bsf SDA
bsf SCL
call Dlay5u
bcf SDA ;Bit de start
call Dlay5u ;
bcf SCL ;
movlw 0xA1 ;Indica leitura do PCF
call TxBytePCF ;
call RxBytePCF ;O Dado lido estara disponmvel no registro DadoMemo
bcf SDA ;
bsf SCL ;Bit de stop
call Dlay5u ;
bsf SDA ;
return
;------------------------LerDataHora-----------------------
;Rotina que Lj e escreve a Data e Hora no LCD
;---------------------------------------------------------
LerDataHora
swapf DadoMemo,0 ;
andlw 0x0F ;
addlw 0x30 ;
bsf Controle,5 ;
call EnviaInstru ;
movf DadoMemo,0 ;
andlw 0xF ;
addlw 0x30 ;
bsf Controle,5 ;
call EnviaInstru ;
return
;------------------------EscreveData-----------------------
;Rotina que Lj e escreve a Data no LCD
;---------------------------------------------------------
EscreveData
movlw 0x80 ;Para a contagem do PCF
movwf DadoMemo ;
clrf PosiMemo ;
call EscritaPCF ;
movlw 0x05 ;Lj o Registro 05 do PCF
movwf PosiMemo ;
call LeituraPCF ;
bcf DadoMemo,7 ;
bcf DadoMemo,6 ;
call LerDataHora ;
bsf Controle,5 ;
call EnviaControle ;
movlw 0x2F ;Escreve o "/"
call EnviaInstru ;
movlw 0x06 ;
movwf PosiMemo ;
call LeituraPCF ;
bcf DadoMemo,7 ;
bcf DadoMemo,6 ;
bcf DadoMemo,5 ;
call LerDataHora ;
clrf DadoMemo ;Reinicia a contagem do PCF
clrf PosiMemo ;
call EscritaPCF ;
return
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.