PIC18F45K50 FVR & IOC Port C not working
Posted: Tue Sep 24, 2019 2:03 pm
I hope somebody can please confirm and fix what I believe is a serious bug with the 18F45K50.fcdx device file...
I am in the process of porting over code from PIC18F4550 to 18F45K50 specifically because I want to use the FVR part of the ADC module and the IOC Port C functions.
In the case of the FVR for the ADC it does not appear as an option when I try to select the ADC reference voltage in the properties window of a Potentiometer, only VDD and Vref+ appear.
I traced this to missing code in the 18F45K50.fcdx file, by comparing to a similar device that has a working FVR, namely 18F45K22...
<vref>
<option name='VDD' value='0' />
<option name='Vref+' value='1' />
<option name='FVR' value='2' />
</vref>
I copied this section of code from 18F45K22.fcdx to 18F45K50.fcdx and confirmed FVR now appeared in the properties list with VDD and VRef+.
As for the Interrupt ON Change (IOC) function for Port C, it does not appear as an option when selecting what type of interrupt I am setting up. IOC for Port B does appear along with all the other interrupts. It also would not compile successfully when I was just using IOC Port B pins.
Checking the 18F45K50.fcdx file again, I can clearly see an error in the following line where IOC functionality is defined, it is defined for port A and B, not port B and C. I am not sure what is the correct contents of this line of code as I cannot find a a similar device to copy from. The closest I could find was 18F45K40, which has IOC functions for Port A, B and C. But I suspect it may not be transferable to 18F45K50.fcxd.
<interrupt ident='IOC0' type='multipin' name='IOC PORTA&b' handler='#ifndef MX_INTHANDLER_INTCON_RABIF\n#define MX_INTHANDLER_INTCON_RABIF\nchar mxtmp;\nif (ts_bit(INTCON, RABIF) && ts_bit(INTCON, RABIE))\n{\n\tFCM_%n();\n\tmxtmp=PORTB;\n\tcr_bit(INTCON, RABIF);\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n' enable='IOCA=%pA0v;\nIOCB=%pB0v;\nst_bit(INTCON, RABIE);\n' disable='cr_bit(INTCON, RABIE);\n' >
I believe this problem is also in 18F25K50.fcdx file.
Please help.
I am in the process of porting over code from PIC18F4550 to 18F45K50 specifically because I want to use the FVR part of the ADC module and the IOC Port C functions.
In the case of the FVR for the ADC it does not appear as an option when I try to select the ADC reference voltage in the properties window of a Potentiometer, only VDD and Vref+ appear.
I traced this to missing code in the 18F45K50.fcdx file, by comparing to a similar device that has a working FVR, namely 18F45K22...
<vref>
<option name='VDD' value='0' />
<option name='Vref+' value='1' />
<option name='FVR' value='2' />
</vref>
I copied this section of code from 18F45K22.fcdx to 18F45K50.fcdx and confirmed FVR now appeared in the properties list with VDD and VRef+.
As for the Interrupt ON Change (IOC) function for Port C, it does not appear as an option when selecting what type of interrupt I am setting up. IOC for Port B does appear along with all the other interrupts. It also would not compile successfully when I was just using IOC Port B pins.
Checking the 18F45K50.fcdx file again, I can clearly see an error in the following line where IOC functionality is defined, it is defined for port A and B, not port B and C. I am not sure what is the correct contents of this line of code as I cannot find a a similar device to copy from. The closest I could find was 18F45K40, which has IOC functions for Port A, B and C. But I suspect it may not be transferable to 18F45K50.fcxd.
<interrupt ident='IOC0' type='multipin' name='IOC PORTA&b' handler='#ifndef MX_INTHANDLER_INTCON_RABIF\n#define MX_INTHANDLER_INTCON_RABIF\nchar mxtmp;\nif (ts_bit(INTCON, RABIF) && ts_bit(INTCON, RABIE))\n{\n\tFCM_%n();\n\tmxtmp=PORTB;\n\tcr_bit(INTCON, RABIF);\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n' enable='IOCA=%pA0v;\nIOCB=%pB0v;\nst_bit(INTCON, RABIE);\n' disable='cr_bit(INTCON, RABIE);\n' >
I believe this problem is also in 18F25K50.fcdx file.
Please help.