I cannot get the asm to accept the names from the PIC data sheet.
Example:
#config T0CS=1 ;one bit in T0CON
or
#config T0CON = 0xA8 ;This would set up timer 0, no prescale, count on positive edge
So how do I setup timer0 as an input counter.
Last edit: Paul Haug 2017-07-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To set, note you treat registers and bits similar to variables - you were creating a constant using #define. T0CS=1 ;one bit in T0CON
T0CON = 0xA8 ;This would set up timer 0, no prescale, count on positive edge
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
William Roth posted this for timer 1. Any use if change to timer0?
'// Configure timer1 as counter on ext pin
Inittimer1 (EXT, PRE0_1)
On interrupt Timer1Overflow Call CountOverflows
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I cannot get the asm to accept the names from the PIC data sheet.
Example:
#config T0CS=1 ;one bit in T0CON
or
#config T0CON = 0xA8 ;This would set up timer 0, no prescale, count on positive edge
So how do I setup timer0 as an input counter.
Last edit: Paul Haug 2017-07-17
Setup timer0 - see http://gcbasic.sourceforge.net/help/_inittimer0.html is it either OSC or EXT
To set, note you treat registers and bits similar to variables - you were creating a constant using #define.
T0CS=1 ;one bit in T0CON T0CON = 0xA8 ;This would set up timer 0, no prescale, count on positive edge
Ah yes, using #define instead of #config, no more asm error. Will proceed now with with modifying the code for my 'ringtach' ..
Many thanks.
Last edit: Paul Haug 2017-07-17
William Roth posted this for timer 1. Any use if change to timer0?
'// Configure timer1 as counter on ext pin
Inittimer1 (EXT, PRE0_1)
On interrupt Timer1Overflow Call CountOverflows
Thanks all, I have counter 0 working now
Summary.... use #define to define a constant(s) and treat Registers and Register Bits in a similar was you would use a byte or bit variable.