Hi
I'm using a PIC18F46K22 to send and receive RS232 with Flowcode 8.
I have a compiler problem on receive when trying to use the circular buffer.
After failing to find the problem on my own code, I have downloaded UART_test.fcfx from this forum (published by chipfryer on the 9th April 2020) and get exactly the same compiler error.
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat 18F46K22 "C:\FLOWCO~1\" "UART_Test"
C:\FLOWCO~1>C:\PROGRA~2\Flowcode\Common\COMPIL~1\pic\batch\..\bin\xc8.exe --chip=18F46K22 "UART_Test.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32
Microchip MPLAB XC8 C Compiler (Free Mode) V1.45
Build date: Nov 15 2017
Part Support Version: 1.45
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration
using updated 32-bit floating-point libraries; improved accuracy might increase code size
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_Delay.c: 85: non-reentrant function "_delay_us" appears in multiple call graphs and has been duplicated by the compiler
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_Delay.c: 105: non-reentrant function "_delay_ms" appears in multiple call graphs and has been duplicated by the compiler
UART_Test.c: 7846: non-reentrant function "_FCD_04071_LCD__Cursor" appears in multiple call graphs and has been duplicated by the compiler
UART_Test.c: 8006: non-reentrant function "_FCD_04071_LCD__RawSend" appears in multiple call graphs and has been duplicated by the compiler
. . .
Memory Summary:
Program space used A34h ( 2612) of F000h bytes ( 4.3%)
Data space used 62h ( 98) of F37h bytes ( 2.5%)
Configuration bits used 7h ( 7) of 7h words (100.0%)
EEPROM space used 0h ( 0) of 400h bytes ( 0.0%)
ID Location space used 0h ( 0) of 8h bytes ( 0.0%)
Data stack space used 0h ( 0) of EB4h bytes ( 0.0%)
Whatever I've tried I cannot get rid of the 'non reentrant' messages above.
Any help appreciated.
Thanks. Clive
PIC18F46K22 UART Interrupt problem
Moderator: Benj
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: PIC18F46K22 UART Interrupt problem
Are you calling display functions in the interrupt routine? If so, remove them, interrupts should be short and not use display components as those are too slow.
In the interrupt set a flag and/or add any received data to a circular buffer and handle that in the main program code.
In the interrupt set a flag and/or add any received data to a circular buffer and handle that in the main program code.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
Re: PIC18F46K22 UART Interrupt problem
Hi kersing
I have removed the display functions in the interrupt routine and now it compliles without errors.
Looks like you've solved it - thank you
I'll double check that everything is working OK tomorrow, but this is a big step forwards.
Cheers
Clive
I have removed the display functions in the interrupt routine and now it compliles without errors.
Looks like you've solved it - thank you
I'll double check that everything is working OK tomorrow, but this is a big step forwards.
Cheers
Clive
Re: PIC18F46K22 UART Interrupt problem
Hi kersing
Although the program compiles Ok now, I cannot get the receive interrupt to work.
The interrupt routine just sets a Flag "RxFlag = 1".
However, when running the program in a loop and sending RS232 data to the PIC (from a terminal program on the PC via a RS232 to USB dongle) RxFlag always stays at 0.
I've tried setting the UART to 'channel1' and 'software'. No difference.
I can send and receive RS232 to the PC OK, just cannot get the interrupt to work.
Any ideas?
Regards
Clive
Although the program compiles Ok now, I cannot get the receive interrupt to work.
The interrupt routine just sets a Flag "RxFlag = 1".
However, when running the program in a loop and sending RS232 data to the PIC (from a terminal program on the PC via a RS232 to USB dongle) RxFlag always stays at 0.
I've tried setting the UART to 'channel1' and 'software'. No difference.
I can send and receive RS232 to the PC OK, just cannot get the interrupt to work.
Any ideas?
Regards
Clive
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC18F46K22 UART Interrupt problem
Hi Clive,
Can you post your flowchart so we can see if we can spot any issues?
Can you post your flowchart so we can see if we can spot any issues?
Martin
Re: PIC18F46K22 UART Interrupt problem
Hi Martin
Flowcode file attached.
Background info.
One PCB (remote) with 4 buttons.
RS232 to this PCB with 4 LEDs.
Message format is "MBx<carriage return><line feed>
Where MB stands for 'Message' 'Buttons' and x is the button data from 0 to 15 to show which buttons have been pressed.
What I'm trying to do is detect 'MB' in the circular buffer, then pull the next byte for the button info, then check we've got carriage return, line feed to prove that this is a valid message.
Regards
Clive
Flowcode file attached.
Background info.
One PCB (remote) with 4 buttons.
RS232 to this PCB with 4 LEDs.
Message format is "MBx<carriage return><line feed>
Where MB stands for 'Message' 'Buttons' and x is the button data from 0 to 15 to show which buttons have been pressed.
What I'm trying to do is detect 'MB' in the circular buffer, then pull the next byte for the button info, then check we've got carriage return, line feed to prove that this is a valid message.
Regards
Clive
- Attachments
-
- RS232_Test.fcfx
- (30.91 KiB) Downloaded 225 times