well for those that make be looking at IOC with DT-int14 with the 16F1825 chips i have sorted out my current issue
the program i use needs to send IR code strings out pin 4 at start and then at other times when needed , it also gets IR codes via the same pin and uses DT-INT-14 Interrupt On Change trap , when it receiving codes and waiting for inputs
1. The 16F1825 supports individual Int flags per pin on port A (only) for IOC ,
2. DT-int-14 asm code does not clear the flags upon a return ( known ) and does not seem to effect when enabled "@ INT_ENABLE IOC_INT" Globel interupts and IOC enable for this Chip - see comments marked **
3. When a Pin is used for IOC inputs and is also used as output pin , then You must do the following
a. Ensure IOCN or IOCP level value for the pin used as input for IOC trigger is setup prior to int call - see code
b. Disable globle interupts and Disable IOCE flag in INTCON reg else the same pin set as out put will not output at all - disabling Dt-int-14 - does not solve this prob **
placed prior to main called routines
Code:INTCON = 0 ' Interupts Clear at start- GIE,PEIE,TMR0IE,INTE,IOCIE = on,TMR0IF,INTF,IOCIF IOCAN.4 = 1 ' Enable interupt on change on portA.4 for negative going edge ( for getIR routine ) IOCAF.4 = 0 ' Clear Interupt on Change flag on portA.4
In the output pin routine you need to
at begining of the code put
At end putCode:INTCON.7 =0 ' Disable Global INTERUPTS INTCON.3 =0 ' Disable IOCIE TRISA.4 = 0 ' setup input=1,output=0 TRISA.4 = 0 to output ( turn on here so correct pulse output)
The other code attached shows the get Ir code and nothing is changed as it is called after the send code routines at startCode:INTCON.7 =1 ' ENABLE Global INTERUPTS INTCON.3 =1 ' Enable IOCIE TRISA.4 = 1 ' setup input=1 for GetIR routine use when IOC portA IOCAF.4 = 0 ' Clear Interrupt on change flag IOCA.4 ( Port A- 4 for when it changes from high for used GetIR routine
I found that by just enabling and disabling using DT-int-14 call " @ INT_ENABLE IOC_INT " did not work and adding the above code in allowed the IOC int routine trap to work and allow the same pin to output as required
cheers
Sheldon




Bookmarks