Flowcode v5.4 PIC18F47J53 Code Error
Posted: Sat Aug 25, 2012 10:35 pm
Flowcode v5.4 PIC18F47J53 Code Error "SOS" (rather than "OS" )
The code both for the FCD file and the Interrupt set-up code file appear to have an error:
//Clock
//Interrupt: Enable TMR1
st_bit(intcon, PEIE);
st_bit(t1con, TMR1ON);
cr_bit(t1con, TMR1CS0);
st_bit(t1con, TMR1CS1);
cr_bit(t1con, T1SOSCEN);
t1con = (t1con & 0x0F) | 0x30;
st_bit(t1con, RD16);
st_bit(intcon, GIE);
st_bit(pie1, TMR1IE);
[TMR1]
Name="TMR1"
HandlerCode="#ifndef MX_INTHANDLER_pir1_TMR1IF\n#define MX_INTHANDLER_pir1_TMR1IF\nif (ts_bit(pir1, TMR1IF) && ts_bit(pie1, TMR1IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir1, TMR1IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n"
EnableCode="st_bit(pie1, TMR1IE);\n"
DisableCode="cr_bit(pie1, TMR1IE);\n"
OptCnt=3
PrescaleOpt=2
MaxTimerOverflow=65536
Opt1="Clock Source Select"
Opt1Cnt=3
Opt1_1="Internal clock (Fosc)"
Opt1_1Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\nst_bit(t1con, TMR1CS0);\ncr_bit(t1con, TMR1CS1);\n"
Opt1_2="Internal clock (Fosc/4)"
Opt1_2Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS0);\ncr_bit(t1con, TMR1CS1);\n"
Opt1_3="T1CKI Pin"
Opt1_3Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS0);\nst_bit(t1con, TMR1CS1);\ncr_bit(t1con, T1SOSCEN);\n"
"T1SOSCEN" is present which shold be "T1OSCEN". This gives rise to the error:
..................
Interrupt Usart Test.c(433:22): error: unknown identifier 'T1SOSCEN'
Interrupt Usart Test.c(433:22): error: invalid operand 'T1SOSCEN'
Interrupt Usart Test.c(433:17): error: failed to generate expression
Interrupt Usart Test.c(433:13): error: invalid operand '~(1 << ( T1SOSCEN))'
Interrupt Usart Test.c(433:10): error: failed to generate expression
Interrupt Usart Test.c success
failure
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
FINISHED
Simply changing "T1SOSCEN" to "T1OSCEN" in both instances solves the problem.
Changing the FCD file is strightforward with a text editor. Not sure how to change the interrupt setup routine other than with the custom code option??
Other knock on effects in the code??
Hope this helps someone.
Mark
The code both for the FCD file and the Interrupt set-up code file appear to have an error:
//Clock
//Interrupt: Enable TMR1
st_bit(intcon, PEIE);
st_bit(t1con, TMR1ON);
cr_bit(t1con, TMR1CS0);
st_bit(t1con, TMR1CS1);
cr_bit(t1con, T1SOSCEN);
t1con = (t1con & 0x0F) | 0x30;
st_bit(t1con, RD16);
st_bit(intcon, GIE);
st_bit(pie1, TMR1IE);
[TMR1]
Name="TMR1"
HandlerCode="#ifndef MX_INTHANDLER_pir1_TMR1IF\n#define MX_INTHANDLER_pir1_TMR1IF\nif (ts_bit(pir1, TMR1IF) && ts_bit(pie1, TMR1IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir1, TMR1IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning "This interrupt has previously been enabled, so the macro <%n> may never get called."\n#endif\n"
EnableCode="st_bit(pie1, TMR1IE);\n"
DisableCode="cr_bit(pie1, TMR1IE);\n"
OptCnt=3
PrescaleOpt=2
MaxTimerOverflow=65536
Opt1="Clock Source Select"
Opt1Cnt=3
Opt1_1="Internal clock (Fosc)"
Opt1_1Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\nst_bit(t1con, TMR1CS0);\ncr_bit(t1con, TMR1CS1);\n"
Opt1_2="Internal clock (Fosc/4)"
Opt1_2Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS0);\ncr_bit(t1con, TMR1CS1);\n"
Opt1_3="T1CKI Pin"
Opt1_3Val="st_bit(intcon, PEIE);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS0);\nst_bit(t1con, TMR1CS1);\ncr_bit(t1con, T1SOSCEN);\n"
"T1SOSCEN" is present which shold be "T1OSCEN". This gives rise to the error:
..................
Interrupt Usart Test.c(433:22): error: unknown identifier 'T1SOSCEN'
Interrupt Usart Test.c(433:22): error: invalid operand 'T1SOSCEN'
Interrupt Usart Test.c(433:17): error: failed to generate expression
Interrupt Usart Test.c(433:13): error: invalid operand '~(1 << ( T1SOSCEN))'
Interrupt Usart Test.c(433:10): error: failed to generate expression
Interrupt Usart Test.c success
failure
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
FINISHED
Simply changing "T1SOSCEN" to "T1OSCEN" in both instances solves the problem.
Changing the FCD file is strightforward with a text editor. Not sure how to change the interrupt setup routine other than with the custom code option??
Other knock on effects in the code??
Hope this helps someone.
Mark