I cant seem to work out how to increment a registry value from 0 to 24 and then have this registry reset to 0 and to display this on a lcd screen.
What im trying to do is to enter a time into a pic to be compared for an alarm, the problem I have is as I press the button to increment the time the display goes from 0 - 9 then through the whole ascii code.
What language are you programming it in and wich pic?
But you have to convert your HEX code to a BCD code, there are examples galore of that around here I bet.
Euhm, long time since I worked in asm for pics, but do they have a compare function?
Or else you could decrement a register every time you increment and when that hits 0 you can do whatever... BTFSZ i believe that was?
To reset the count back to zero if "reg" increments higher than 24:
Code:
incf reg,F ;Inc the reg
movlw D'25' ;load with 25 to check against reg
xorwf reg,W ;Xor but dont affect the reg yet
btfsc STATUS,Z ;Skip if not 25
clrf reg ;Reached 25 so set reg back to 0
movf reg,W ;Get the new value of reg into w to send to your display
btfsC it was appearantly
xor'ing it will work too I guess, and then when they are equal, the Z flag gets cleared or something? Pff i need to get back into my PicASM, it's all 8051 at our school now, and there are WAYY too many instructions, wich is nice too mind you, but a risc is a little different eh :d