So is it a bug ? Or what is it because it'll confuse others too.
On a somewhat related topic :
I want to get a snapshot of Timer1 registers in the simplest manner possible - stopping the timer or multiple read validation of rollover isn't ideal - so why not get the hardware to do it ?
CCP1CON = 0b00000100 ; Set CCP Capture mode - every falling edge.
TRISIO.2 = 0 ; Toggle GPIO.2 direction - trips the
TRISIO.2 = 1 ; capture event.
CCP1CON = 0b00001010 ; Switch to CCP Compare mode.
Then update the CCPR1 registers with the wanted Timer1 compare value.
It works without interfering (much) with GPIO.2 which I use for CCP Capture. The datasheet (12F683) makes a minor reference to this feature but other chip datasheets are much more vague and caveat it all with "may" - and state other odd references to the fact that mode changes "may" also trigger an event ...
If it said "will" I'd feel happier - is what I've done bad practice ?
I posted something similar and acknowledge that other PICs have more advanced functionality but for a beginner who has got a bucket of 12F683s, my challenge is to explore and understand how it all comes together, to get to know what is and what is not possible ...
Thanks
Andrew
Last edit: Andrew Jameson 2021-03-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A couple of days of minor confusion caused by my erroneous assumption that CCPR1 is a Word much like Timer1.
An assembled snippet looks like :
;PulseWidth = PulseWidth + CCPR1
movf CCPR1,W
addwf PULSEWIDTH,F
movlw 0
btfsc STATUS,C
movlw 0 + 1
addwf PULSEWIDTH_H,F
So it's a Byte !!
The fix is to declare a new alias :
Dim CCPR1W Alias CCPR1H, CCPR1L as Word
So is it a bug ? Or what is it because it'll confuse others too.
On a somewhat related topic :
I want to get a snapshot of Timer1 registers in the simplest manner possible - stopping the timer or multiple read validation of rollover isn't ideal - so why not get the hardware to do it ?
CCP1CON = 0b00000100 ; Set CCP Capture mode - every falling edge.
TRISIO.2 = 0 ; Toggle GPIO.2 direction - trips the
TRISIO.2 = 1 ; capture event.
CCP1CON = 0b00001010 ; Switch to CCP Compare mode.
Then update the CCPR1 registers with the wanted Timer1 compare value.
It works without interfering (much) with GPIO.2 which I use for CCP Capture. The datasheet (12F683) makes a minor reference to this feature but other chip datasheets are much more vague and caveat it all with "may" - and state other odd references to the fact that mode changes "may" also trigger an event ...
If it said "will" I'd feel happier - is what I've done bad practice ?
I posted something similar and acknowledge that other PICs have more advanced functionality but for a beginner who has got a bucket of 12F683s, my challenge is to explore and understand how it all comes together, to get to know what is and what is not possible ...
Thanks
Andrew
Last edit: Andrew Jameson 2021-03-23