fmicro
Newbie level 3
pic10f200
Hi,
I have recently written some basic code with the PIC10F200 and am now trying to incorporate a 30 minute timer.
Currently here is my best understanding of how I can do this. I am fully expecting to be incorrect in some of my assumptions but here goes:
1. Set a large prescaler for the Timer0 Rate of 1:128 (I suppose I could even use 1:256)
2. Test bit 7 of Timer0 noting when it changes from low to high meaning it has transitioned from 0x7F and assuming 0x7F*128 cycles = 16.25mS.
3. Determine how many occurrances (or multiples) I need to reach my desired time.
That's it. From here I plan to disable my outputs and some other simple stuff until there is a transition on the input pin (I think I know how to do this part)
To start off with, can anyone help me with the proper way to write these commands? Does the following look like I am on the right track and is the syntactax correct?
; Here I just want to access and initialize Timer0
CLRF TMR0 ; clear
MOVLW '00xx0110'b
OPTION ; set PSA to Timer0 and rate to 1:128
; Here I just want to test bit 7 of TMR0
CHECK
BTFSS TMR0,7 ; test if bit 7 is set
GOTO CHECK ; if not set then keep checking
; if it is set, I increment a counter etc.
I mostly wnat to make sure the syntax is correct and a little bit of advice will get me going for a while.
Your comments will be appreciated.
Thanks,
fmicro
Hi,
I have recently written some basic code with the PIC10F200 and am now trying to incorporate a 30 minute timer.
Currently here is my best understanding of how I can do this. I am fully expecting to be incorrect in some of my assumptions but here goes:
1. Set a large prescaler for the Timer0 Rate of 1:128 (I suppose I could even use 1:256)
2. Test bit 7 of Timer0 noting when it changes from low to high meaning it has transitioned from 0x7F and assuming 0x7F*128 cycles = 16.25mS.
3. Determine how many occurrances (or multiples) I need to reach my desired time.
That's it. From here I plan to disable my outputs and some other simple stuff until there is a transition on the input pin (I think I know how to do this part)
To start off with, can anyone help me with the proper way to write these commands? Does the following look like I am on the right track and is the syntactax correct?
; Here I just want to access and initialize Timer0
CLRF TMR0 ; clear
MOVLW '00xx0110'b
OPTION ; set PSA to Timer0 and rate to 1:128
; Here I just want to test bit 7 of TMR0
CHECK
BTFSS TMR0,7 ; test if bit 7 is set
GOTO CHECK ; if not set then keep checking
; if it is set, I increment a counter etc.
I mostly wnat to make sure the syntax is correct and a little bit of advice will get me going for a while.
Your comments will be appreciated.
Thanks,
fmicro