Sometimes flowcharts just don't do what is expected when the code runs on a chip. There are several ways to debug this, one way to debug is to attach a display module of some kind (LCD/gLCD) and show debug messages on it. Another way is to write debug messages to a serial port.
For those cases where serial output would be a good solution, but the RS232 component is not available or undesirable, the attached macros (Flowcode 5) implement a software transmit only serial port using one processor pin.
The macros implement a 9600,8,n,1 software serial port, by default on port A1. To change the port adapt all occurrences of the output icon to the desired port/pin (one in DebugInit, four in DebugSendChar). Output string length is limited to 20 characters.
To use the macros, import all three macros into a flowchart. At the start of main include a 'Call Macro' component for DebugInit (this sets the output to idle state). Call the DebugSendString macro wherever debugging output is required.
Hardware required:
Use a USB-TTL serial adapter or an RS232 port with level convertors. For USB-TTL serial adapters, connect the output pin to the RX wire of the adapter and connect GND of the adapter to ground of the circuit. Do not connect TX and 5V! Access the data using any available terminal program set no handshake, 9600 bps, 8 bits, no parity, 1 stop bit.
Debugging PIC flow charts using a serial port
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Debugging PIC flow charts using a serial port
- Attachments
-
- DebugSendString.fcm
- (2.54 KiB) Downloaded 388 times
-
- DebugSendChar.fcm
- (3.35 KiB) Downloaded 337 times
-
- DebugInit.fcm
- (1.77 KiB) Downloaded 357 times
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis