Target: PIC18F4580
Programmer: PICKIT3
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
Send a 0x41 to the screen and it puts an "A" exactly as expected.
Send a member of the string array, and display prints junk
Tracing variable as passed to the serial send routine, it looks exactly as I would expect.
SOLVED: Problem sending character to LCD via UART/Serial
Moderator: Benj
-
- Posts: 14
- Joined: Mon Nov 30, 2015 1:57 am
- Location: California, United States
- Has thanked: 6 times
- Been thanked: 9 times
- Contact:
SOLVED: Problem sending character to LCD via UART/Serial
- Attachments
-
- temp.jpg (64.2 KiB) Viewed 5210 times
Last edited by bvolken on Fri Dec 04, 2015 7:12 pm, edited 1 time in total.
Programmer: PICKIT3
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
I would suspect an issue with the serial connection and check the accuracy of the baud rate (if you can)
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
The one second flash test is a great way to sanity check your clock speed and settings are right.
http://www.matrixtsl.com/wiki/index.php ... ED_flasher
Once your clock speed and settings are correct the baud rate should also be correct.
http://www.matrixtsl.com/wiki/index.php ... ED_flasher
Once your clock speed and settings are correct the baud rate should also be correct.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 14
- Joined: Mon Nov 30, 2015 1:57 am
- Location: California, United States
- Has thanked: 6 times
- Been thanked: 9 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
I know the clock and baud are right. I have run lots of tests. The only change is now trying to send a string (array) one byte-at-a-time.
When I pass "0x41" an "A" is displayed (confirming baud is right), but passing StringVar[4] does not work, even though it appears to pass a valid ASCII code to the print macro.
The CAL_UART is expecting a UINT parameter, and I am passing it a BYTE, which works when I pass "0x41", could this be related to the issue. I couldn't find much on variable typecasting.
When I pass "0x41" an "A" is displayed (confirming baud is right), but passing StringVar[4] does not work, even though it appears to pass a valid ASCII code to the print macro.
The CAL_UART is expecting a UINT parameter, and I am passing it a BYTE, which works when I pass "0x41", could this be related to the issue. I couldn't find much on variable typecasting.
Programmer: PICKIT3
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
Can you attach your program so we can see what might be going wrong.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 14
- Joined: Mon Nov 30, 2015 1:57 am
- Location: California, United States
- Has thanked: 6 times
- Been thanked: 9 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
Here you go. I can't help but feel it's got something to do with variable typecasting, but since it's only my 3rd day with Flowcode . . . who knows!?!
Should I download and apply "Flowcode 6 - latest components, bug fixes and improvements"?
Should I download and apply "Flowcode 6 - latest components, bug fixes and improvements"?
- Attachments
-
- LCD_Serial.fcfx
- (18.74 KiB) Downloaded 235 times
Programmer: PICKIT3
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
Hi,
Looking at the generated casm file, it looks like the typecasting is OK, despite it being logical to suspect it, and your code is very good for 3 days with Flowcode!
Have you tried?...
LCD_PrintChar('H')
LCD_PrintChar('e')
LCD_PrintChar('l')
LCD_PrintChar('l')
LCD_PrintChar('o')
I'm just fishing for more clues here.
As you say, updating to the latest is always a good idea
Looking at the generated casm file, it looks like the typecasting is OK, despite it being logical to suspect it, and your code is very good for 3 days with Flowcode!
Have you tried?...
LCD_PrintChar('H')
LCD_PrintChar('e')
LCD_PrintChar('l')
LCD_PrintChar('l')
LCD_PrintChar('o')
I'm just fishing for more clues here.
As you say, updating to the latest is always a good idea
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Problem sending character to LCD via UART/Serial
Hello,
In your config settings switch of the extended CPU setting. This is known to cause corruption with arrays. Then your program should hopefully work as expected.
In your config settings switch of the extended CPU setting. This is known to cause corruption with arrays. Then your program should hopefully work as expected.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 14
- Joined: Mon Nov 30, 2015 1:57 am
- Location: California, United States
- Has thanked: 6 times
- Been thanked: 9 times
- Contact:
Re: SOLVED: Problem sending character to LCD via UART/Serial
Okay, turns out the problem was indeed the "Extended CPU Enable"
After switching to "disabled", the code worked as expected.
THANKS FOR THE SUGGESTION!
Programmer: PICKIT3
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)
OS: Windows 10 home 64 bit
FlowCode 6.1.2.0 (11.05.2015)