Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing RTC DS12887A to PIC16F877A

Status
Not open for further replies.

pramodp

Newbie level 5
Joined
Jun 5, 2006
Messages
10
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Activity points
1,361
how to interface dallas ds12887a

I'm working on a project that uses the Dallas-Maxim RTC DS12887A to keep time and alarms, plus save some user data, using a Microchip PIC16F877A (@20MHz) for a programmable alarm-clock for using at colleges and offices. I'm finding difficulty in writing assembly code for reading from and writing to the RTC memory (control registers and general RAM). The code works fairly well in simulators (PICsimulator IDE from Oshonsoft), but does not work with the hardware. To keep the code compact, i prefer coding in Assembly. Anyone who has experience in these stuff, please help.
 

Hi, my project has these connection between DS and PIC
AD0-7 PORTC
AS PORTA,3
DS PORTA,5
RW PORTA,4(with pull-up resistor)

RTC_ALE=PORTA,3
RTC_READ=PORTA,5
RTC_WRITE=PORTA,4

To read:
Code:
	BCF	STATUS, RP0
	BCF	STATUS, RP1	;Bank0
	MOVLW	ADDRESS
	MOVWF	PORTC
	BCF	RTC_ALE
	BSF	STATUS, RP0	;Bank1
	MOVLW	0xFF
	MOVWF	TRISC
	BCF	STATUS, RP0	;Bank0
	BCF	RTC_READ
	MOVF	PORTC, W
	MOVWF	DATA
	BSF	RTC_READ
	BSF	RTC_ALE
	BSF	STATUS, RP0	;Bak1
	CLRF	TRISC
	BCF	STATUS,RP0	;Bank0

to write:
Code:
	BCF	STATUS, RP1
	BSF	STATUS, RP0	;Bank1
	CLRF	TRISC
	BCF	STATUS, RP0	;Bank0
	MOVF	ADDRESS, W
	MOVWF	PORTC
	BCF	RTC_ALE
	MOVF	DATA, W
	MOVWF	PORTC
	BCF	RTC_WRITE
	BSF	RTC_WRITE
	BSF	RTC_ALE
 

Hello.

I'm working on same project as pramodp however I am using a Microcontroller from ATMEL (AT89S8253) and I have to code it using C language.

Since I'm a newbie on C what do I need to do to interface my RTC DS12887A with my microcontroller? (I only need the explanation code cause the hardware is done).

Any help is welcomed.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top