Hi sayzer,
I can't seem to figure out what I'm doing wrong here. This is what I did to change to the 12 hour am & pm mode. I got rid of the "writehour CON $84" statement, as its not required anymore. Then I created these four con's and variable below:
Code:
Mode VAR BIT
Mode = 0 ' starts in am mode on initial power-up
writehour_am con $C4
writehour_pm con $D0
am CON 0
pm CON 1
Then in your setup: subroutine I added this code block to replace your code block for the hourx:
Code:
IF Mode = am THEN
reg_adr = writehour_am ' = 00100011
ELSE
reg_adr = writehour_pm ' = 00001011
ENDIF
outbyte = hourx
gosub w_out
Then in your in your sethour: subroutine I added this code block to replace yours for setting the hour:
Code:
IF CHNG = 0 THEN 'change the hour on display
pause 100
hour = hour + 1
IF hour > 12 THEN
IF Mode = am THEN
Mode = pm
ELSE
Mode = am
ENDIF
hour = 1
ENDIF
call send
ENDIF
And that's it. Seems simple enough but it won't work. After I finish setting the clock and return to the start: subroutine it shows two zero's instead of what I set it to. I added these modifications to your original code without my added timer counter routines to rule out any of the other changes I made to your code. I used a converter that is here: http://www.itlocation.com/en/softwar...,download,.htm to calculate the HEX values. Its a great converter because it allows copping and pasting the values into and out of the converter.
I found a discrepancy in the manual for what you said about bit 7.
You said:
Code:
If sending 12Hr AM mode then the Bit7 of your byte should be
"0" indicating 12Hr mode, and Bit5 should be "1 "
indicating "AM".
And the manual says:
Code:
AM-PM/12-24 MODE
Bit 7 of the hours register is defined as the 12- or 24-hour
mode select bit. When high, the 12-hour mode is selected.
In the 12-hour mode, bit 5 is the AM/PM bit with logic high
being PM.
I changed the bits to what the manual says but still ended up with the same results. I'll keep plugging away at it to see if I can figure it out but in the meantime would you have any ideas on what I've done wrong here?
Thanks
jessey
Bookmarks