--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CAM%2Bj4qvv6k0rGBYftBOhsT7HR4wJe8GrM8_vEGUPiTk3MVa%2B8Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/dd13bf5c-9a69-5157-afa9-fa27d38ece98%40gmail.com.
Hi Rob and Rob, :)I've tried with or without ISR, with AND IOCAP reset or normal IOCAP reset. This IOC is erratic and has a lot of latency. The RDY_IN signal is 20ms square 50% duty cycle, the RDY_OUT signal has a latency most of the time...but sometimes has a 20mS pulse as it should. The code which somehow "works" is below, however the need of clearing the IOCAF0 in the main loop is weird. Without it IOC is not working. If the RDY_IN (pin_A0) signal disappears, the RDY_OUT (pin_A5) remains high.
INTCON_IOCIF is read only, it's content is changed by IOCAF. To clear INTCON_IOCIF the whole IOCAF register has to be cleared.
Perhaps I missed something...
I didn't check what the compiler does if there's no interrupt service routine. Would it be smart to always waste five program words just to be sure not to accidentally restart the program? I.e., always put a RETFIE at position 0x0004 when there's no pragma interrupt?
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/d5cd970e-5e81-f278-548d-d9476f0e8dc3%40gmail.com.
Hi Rob and Rob, :)I've tried with or without ISR, with AND IOCAP reset or normal IOCAP reset. This IOC is erratic and has a lot of latency. The RDY_IN signal is 20ms square 50% duty cycle, the RDY_OUT signal has a latency most of the time...but sometimes has a 20mS pulse as it should.
-- enable negative edge interrupts RDY_IN
procedure IOC() is
pragma interrupt
if INTCON_IOCIF then -- IOC interrupt
if IOCAF_IOCAF0 then -- edge interrupt on RDY_IN
if pin_RDY_IN then -- was a positive edge
pin_RDY_OUT = high
else -- negative edge
pin_RDY_OUT = low
end if
IOCAF = IOCAF & 0xFE -- clear IOCAF0
end if
INTCON_IOCIF = 0 -- reset IOC interrupt flag
end if
end procedure
forever loop
pin_TRIGGER = high
delay_1ms(20)
pin_TRIGGER = low
delay_1ms(20)
end loop
--
Rob Hamerling, Vianen, NL
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/24f3dc21-9e72-2932-ea0b-ed3a6a0d64e2%40gmail.com.
Your program somehow works, however in my level of understanding it is not based on pure IOC.
Once the IOCAF_IOCAF0 is set ( a IOC occured) you are testing again the level of RDY_IN which should not happen... IOC is the transition of IOCAF0 or INTCON_IOCIF to high (and I'm assuming only that should be tested since the transition is defined by IOCAP/IOCAN).
According to the datasheet The "IOCIF Flag bit is read-only and cleared when all the Interrupt-On-Change flags in the IOCxF registers
have been cleared by software", so that line can be commented, it will not be cleared. In fact this seems to be the real problem with the IOC module.
I can send you a scope image for positive edge detection to see the lost IOCs on positive edges if that helps.
On the other hand, if you set only the detection of the rising edge ( IOCAP_IOCAP0 = high, IOCAN_IOCAN0 = low), RDY_OUT stayed indefinitely on high even on RDY_IN a positive edge occured, which seems wrong.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/VI1PR07MB6256420C79A6C1BD1F58D696E6AD9%40VI1PR07MB6256.eurprd07.prod.outlook.com.
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/76b8a82d-2e79-89b6-47b1-98169e4c0aae%40gmail.com.
But if you need to precise control the RDY_OUT time, that seems impossible in a long main loop which is also large jitter generator ( using the USB_serial for instance) .
Imagine that RDY_IN varies between say 100us to 100ms and RDY_OUT must stay high a precise time until user reset it. The RDY_OUT control has to be moved in the ISR, but then no delay will be allowed to catch the rising edge...an interrupt timer delay must be implemented.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/1148764833.933296.1633326615052%40mail.yahoo.com.