Melanie thanks for replying...

I have done all of the above. Below is an annotated listing of the program. The purpose of the program is very simple, to write a value to the RTC Ram and then read it back to the PIC. The value is then changed from a BCD format using the lookdown to a decimal number. The ascii representation of the decimal number is then displayed on a serial LCD.

I have verified the operation of the serial LCD conversion part and know the RTC is oscillating because I can see the waveform on my oscope (the tick portion of the code below is also a visual indication see below). The square wave output of the RTC is being inputed into the PIC at port A.2. I have 4.7k resisitors on the clock and data ports of the RTC. The battery pin on the RTC is grounded and the source is 5 volts. I also have a 4.7k resistor on the square wave output pin.

I am writing the number 9 to the RTC below.



TRISA = %000100 'Set RA0-RA5 Tristate Pins for port A to output (0) or input (1)

DPIN VAR PORTA.0
CPin VAR PORTA.1
Tick VAR PORTA.2
x VAR BYTE
y VAR BYTE
m1 VAR BYTE 'minutes 1's place 0-9
m10 VAR BYTE 'minutes 10's place 0-5
B1 VAR BYTE
B2 VAR BYTE
sec VAR BYTE

RTC CON %11010000
ADCON0=%11000000
ADCON1=%00000111

init:
Pause 1000
y=0
m1 = 0
m10 = 0
B1=0
sec = %00001001

'Start

I2CWrite DPIN, CPIN, RTC, 0, 0 'Writes to seconds byte and initiate the oscillations of the RTC
Pause 40
'I2CWrite DPIN, CPIN, RTC, 1, 0 'Writes to minutes byte.
'Pause 40
'I2CWrite DPIN, CPIN, RTC, 2, 1 'Writes to hours byte.
'Pause 40
'I2CWrite DPIN, CPIN, RTC, 3, 1 'Writes to day of week byte.
'Pause 40
'I2CWrite DPIN, CPIN, RTC, 4, 1 'Writes to date byte.
'Pause 40
'I2CWrite DPIN, CPIN, RTC, 5, 1 'Writes to month byte.
'Pause 40
'I2CWrite DPIN, CPIN, RTC, 6, 1 'Writes to year byte.
'Pause 40
I2CWrite DPIN, CPIN, RTC, 7, %10010000 'Writes to control byte of RTC and sets the SQWE square wave output
'to one cycle per second
Pause 40


I2CWrite PORTA.0, PORTA.1, %11010000, $11, %00001001 'Test write to RTC Ram location $11, executed only once
Pause 10


loop:

' The tick is a blinking colon that appears on display. Visual verification the RTC is oscillating
IF tick = 0 Then
SerOut PORTD.2,4,[254,131] 'locate cursor 1st line position 3
Pause 40
SerOut PORTD.2,4,[" "] 'print null value on LCD
Else
SerOut PORTD.2,4,[254,131] 'locate cursor 1st line position 3
Pause 40
SerOut PORTD.2,4,[":"] 'print a colon value on LCD
sec = sec + 1
EndIF




'Debug section of program, should be deleted after program is finalized.


'Read the test value from the same ram location as written to the RTC. What should happed is the value read back from the
'RTC is the same as the one written.
I2CRead PORTA.0, PORTA.1, %11010000, $11, [m1]
Pause 10

'This line converts the BCD value to a decimal. The ascii representation of this decimal value will be placed on the
'serial LCD screen.
LookDown m1, [%00000000,%00000001,%00000010,%00000011,%00000100, %00000101,%00000110,%00000111,%00001000,%00001001],B1

SerOut PORTD.2,4,[254,132] 'locate cursor on serial LCD
Pause 40
SerOut PORTD.2,4,[#B1] 'Output
Pause 40

'This section uses a variable called sec that is set at the beginning of the program. This is to verify the proper working of
'the BCD to decimal conversion.
LookDown sec, [%00000000,%00000001,%00000010,%00000011,%00000100, %00000101,%00000110,%00000111,%00001000,%00001001],B2

SerOut PORTD.2,4,[254,192] 'locate cursor on serial LCD
Pause 40
SerOut PORTD.2,4,[#B2] 'Output
Pause 40





GoTo loop

End

On my display, I get a flasing colon (this is good) and a number 1 instead of the number 9 that I have written (variable B1)
For variable B2 I get the number 9 as I should.

Any input would be greatly appreciated. From what I can tell, this really should work. Any ideas why I am unable to read back from the RTC the value that I write?

Thanks

Tim