PIC18F25Q10 and PIC18F27K42 - No Timers work
Posted: Sun Feb 24, 2019 6:42 pm
Hi guys,
It seems no timers work at all when configured in Flowcode for PIC18F25Q10. I've tried Timer 0, Timer 1 and Timer 2 with the same results.
There is nothing else in the code, just enabling any Timer causes the code not to compile. All other code on my program works fine at the moment.
When compiling the output shows:
It's strange as this chip has got a total of 7 timers and not all of them are shown on the "Interrupt on" Flowcode list
Could it be that the configuration fcdx file for these chips is wrong? For this project we also use PIC18F25K50 and PIC16F15345 and we have had no problems with these.... I am unable to use any new chips as these 2 were listed as being compatible with Flowcode 8
I have checked the Data Sheet and it seems the register should be T0CON0 and not T0CON
The code generated by Flowcode is:
If edit the C code generated and change the timer section to:
All compiles fine... 0x80 is 10000000 enables Timer 0 as 8 bit timer and sets postscaler to 1:1.
I am no C programmer in any way (this is why I use Flowcode), but I feel there is a bug here with Flowcode not generating the correct code maybe?
Help would be appreciated as can't do much on my project without a Timer on both MCUs
Thanks in advance for your kind help!
R
It seems no timers work at all when configured in Flowcode for PIC18F25Q10. I've tried Timer 0, Timer 1 and Timer 2 with the same results.
There is nothing else in the code, just enabling any Timer causes the code not to compile. All other code on my program works fine at the moment.
When compiling the output shows:
Code: Select all
PIC2_PLAYER1_TEST.c: main()
91: T0CONbits.T0CS = 0;
^ (192) undefined identifier "T0CONbits"
^ (196) struct/union required
92: T0CONbits.T0SE = 0;
^ (196) struct/union required
93: T0CON = (T0CON & 0xF0) | 0x08;
^ (192) undefined identifier "T0CON"
95: INTCONbits.TMR0IE = 1;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S1339
PIC2_PLAYER1_TEST.c: myisr()
111: if ((INTCONbits.TMR0IF) && (INTCONbits.TMR0IE))
^ (255) not a member of the struct/union ""
(255) not a member of the struct/union "" ^
(199) logical type required ^
(199) logical type required ^
114: INTCONbits.TMR0IF = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S1339
(908) exit status = 1
(908) exit status = 1
- Three 8-Bit Timers (TMR2/4/6) with Hardware Limit Timer (HLT)
Four 16-Bit Timers (TMR0/1/3/5)
Code: Select all
Flowcode1.c: main()
90: T0CONbits.T0CS = 0;
^ (192) undefined identifier "T0CONbits"
^ (196) struct/union required
91: T0CONbits.T0SE = 1;
^ (196) struct/union required
92: T0CON = (T0CON & 0xF0) | 0x08;
^ (192) undefined identifier "T0CON"
(908) exit status = 1
(908) exit status = 1
I have checked the Data Sheet and it seems the register should be T0CON0 and not T0CON
The code generated by Flowcode is:
Code: Select all
cr_bit(T0CON, T0CS);
cr_bit(T0CON, T0SE);
T0CON = (T0CON & 0xF0) | 0x08;
st_bit(INTCON0, GIE);
st_bit(PIE3, TMR0IE);
Code: Select all
T0CON0 = 0x80;
I am no C programmer in any way (this is why I use Flowcode), but I feel there is a bug here with Flowcode not generating the correct code maybe?
Help would be appreciated as can't do much on my project without a Timer on both MCUs
Thanks in advance for your kind help!
R