kenneth031592
Newbie level 4
I encountered a problem in sub procedure interrupt.I use interrupt to detect zero cross to do a phase control using porta.B0 to trigger the triac it works like a dimmer but with some difference due to some functions like continuous monitoring of current. If ever i increase the delay as what i use above as sample 2500us everything goes wrong 2500us is fine but i need 6500us. My main code is affected and cannot read adc as what it is intended to do inside the main.
Code Basic4GL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 sub procedure interrupt if (INTCON.INT0IF = 1) then 'INTF flag raised so external interrupt occured if (x = 1) then 'this condition came from the main DELAY_us(2500) 'delay for phase control of triac increasing this delay cause the problem ex. 6500us PORTA.B0 = 1 ' TURN ON THE TRIAC DELAY_us(500) ' TIME TO MAKE SURE THE LATCHING OF TRIAC PORTA.B0 = 0 ' TURN OFF THE TRIAC else PORTA.B0 = 1 'ELSE THE TRIAC IS ON end if INTCON.INT0IF = 0 'interrupt clear end if end sub
Last edited by a moderator: