I've reduced the problem to the few lines below. Timer1 is running. An interrupt is created whenever Timer1 count matches the CCP register value and Timer1 is reset.
This works on an 12F683 but not in SimulIDE.
I really want to create an interrupt whenever the Timer1 count matches the CCP register value and leave the Timer1 count to continue untouched. According to the datasheet :
1010 = Compare mode, generate software interrupt on match (CCP1IF bit is set, CCP1 pin
is unaffected)
- I can't get that to work on the real chip or SimulIDE so any idea what I'm doing wrong ? (I need GP2/AN2/T0CKI/INT/COUT/CCP1 as input as I'm using the INT configuration)
==============================
#chip 12f683, 1
#option explicit
T1CON = 0b00000001
TRISIO = 0b00000100
'CMCON1 = 0
CCP1CON = 0b00001011
CCPR1L = 255 ; Test who cares values
CCPR1H = 10 ;
INTCON = 0b11000000 ; Enable GIE, PEIE
PIE1 = 0b00100000 ; Enable CCP1IE
GPIO = 0b00000000
On Interrupt CCP1 Call CCP1_Interrupt_Handler
sub CCP1_Interrupt_Handler
end sub
do
if (CCP1IF = 1) then
CCP1IF = 0
GPIO.5 = 1
Wait 15 mS
GPIO.5 = 0
end if
loop
==============================
Thanks
Andrew
This works on an 12F683 but not in SimulIDE.
I really want to create an interrupt whenever the Timer1 count matches the CCP register value and leave the Timer1 count to continue untouched. According to the datasheet :
1010 = Compare mode, generate software interrupt on match (CCP1IF bit is set, CCP1 pin
is unaffected)
- I can't get that to work on the real chip or SimulIDE so any idea what I'm doing wrong ? (I need GP2/AN2/T0CKI/INT/COUT/CCP1 as input as I'm using the INT configuration)
==============================
#chip 12f683, 1
#option explicit
T1CON = 0b00000001
TRISIO = 0b00000100
'CMCON1 = 0
CCP1CON = 0b00001011
CCPR1L = 255 ; Test who cares values
CCPR1H = 10 ;
INTCON = 0b11000000 ; Enable GIE, PEIE
PIE1 = 0b00100000 ; Enable CCP1IE
GPIO = 0b00000000
On Interrupt CCP1 Call CCP1_Interrupt_Handler
sub CCP1_Interrupt_Handler
end sub
do
if (CCP1IF = 1) then
CCP1IF = 0
GPIO.5 = 1
Wait 15 mS
GPIO.5 = 0
end if
loop
==============================
Thanks
Andrew
Last edited by arcachofo on Fri Dec 24, 2021 3:15 am; edited 1 time in total (Reason for editing : Marked as solved (green color))