Hi Ben,
I found a bug while testing the UART Component Macro on CLICKER 2 board.
The "SendString" function does not work, it is not executed.
The "SendNumber" and "SendChar" are working perfectly.
3 milliseconds pause between UART TX bursts is it possible that another bug?
Best Regards,
Lagoda
PIC18F67K40 UART "SendString" problem (SOLVED)
Moderator: Benj
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
PIC18F67K40 UART "SendString" problem (SOLVED)
- Attachments
-
- PIC18F67K40_UART_Test.fcfx
- (8.36 KiB) Downloaded 202 times
Last edited by Lagoda on Thu Oct 03, 2019 7:31 pm, edited 1 time in total.
- 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: PIC18F67K40 UART "SendString" problem
Hi Lagoda,
On 18F devices the extended CPU config setting can cause problems with strings, however looking at your config settings it looks like this is already set to disabled. Maybe try enabling the setting just in case it's been inverted?
What happens if you load the string constant into a string variable using a calculation icon and then send the string variable?
Looking at the code behind the functon it all seems to check out and makes the same UART calls as the SendNumber and SendChar.
On 18F devices the extended CPU config setting can cause problems with strings, however looking at your config settings it looks like this is already set to disabled. Maybe try enabling the setting just in case it's been inverted?
What happens if you load the string constant into a string variable using a calculation icon and then send the string variable?
Looking at the code behind the functon it all seems to check out and makes the same UART calls as the SendNumber and SendChar.
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: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem
Hello Ben,
I tried what you wrote.
PIC18F67K40_UART_Test_2.c:
33: __config("__PROG_CONFIG", "pic18", 0x2, 0x7FFF);
^ (1504) the PIC18 extended instruction set was enabled but is not supported by this compiler
(908) exit status = 1
(908) exit status = 1
Error returned from [xc8.exe]
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1
Best Regards,
Lagoda
I tried what you wrote.
After enabling, I get an error message from the compiler:On 18F devices the extended CPU config setting can cause problems with strings, however looking at your config settings it looks like this is already set to disabled. Maybe try enabling the setting just in case it's been inverted?
PIC18F67K40_UART_Test_2.c:
33: __config("__PROG_CONFIG", "pic18", 0x2, 0x7FFF);
^ (1504) the PIC18 extended instruction set was enabled but is not supported by this compiler
(908) exit status = 1
(908) exit status = 1
Error returned from [xc8.exe]
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1
The situation remains the same. The string variable value does not move the UART TX output. What should the next step be?What happens if you load the string constant into a string variable using a calculation icon and then send the string variable?
Best Regards,
Lagoda
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem
Hi Ben,
I did another test.
I wanted to copy a string type constant into a string type variable.
Then I convert the string variable to a byte vector and send the elements of the byte vector to the UART buffer.
This works great in the simulator, but don't work in the target circuit.
During debugging, I noticed that the string-type constans value was not copied to the string-type variable.
Thus, the string variable length will be 0 and no data will be added to the UART buffer.
Have you any idea?
Best Regards,
Lagoda
I did another test.
I wanted to copy a string type constant into a string type variable.
Then I convert the string variable to a byte vector and send the elements of the byte vector to the UART buffer.
This works great in the simulator, but don't work in the target circuit.
During debugging, I noticed that the string-type constans value was not copied to the string-type variable.
Thus, the string variable length will be 0 and no data will be added to the UART buffer.
Have you any idea?
Best Regards,
Lagoda
- Attachments
-
- PIC18F67K40_UART_Test_2.fcfx
- (11.14 KiB) Downloaded 182 times
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem
Hi Ben,
I found the cause of the error: The MCU what I use comes from Device Revision Id = 0 series.
If the Device Revision Id = 3, the String operations will be executed correctly.
The solution is in this topic:
viewtopic.php?f=76&t=20479
By inserting Code C, the test program works. Could you speed up the execution speed of the "SendNumber" function a bit?
If I count correctly, it performs about 13,500 instruction cycles before sending a three-digit number to UART.
Can this be reduced?
Best Regards,
Lagoda
I found the cause of the error: The MCU what I use comes from Device Revision Id = 0 series.
If the Device Revision Id = 3, the String operations will be executed correctly.
The solution is in this topic:
viewtopic.php?f=76&t=20479
By inserting Code C, the test program works. Could you speed up the execution speed of the "SendNumber" function a bit?
If I count correctly, it performs about 13,500 instruction cycles before sending a three-digit number to UART.
Can this be reduced?
Best Regards,
Lagoda
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem (SOLVED)
Hi Lagoda
Well, you have found the mistake.
There is also a Clicker 2 with a PIC32MZ on 200Mhz. With which software did you do the test? Looks very good.
https://www.mikroe.com/clicker-2-for-pic32mz
regards
Stefan
Well, you have found the mistake.
There is also a Clicker 2 with a PIC32MZ on 200Mhz. With which software did you do the test? Looks very good.
https://www.mikroe.com/clicker-2-for-pic32mz
regards
Stefan
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem (SOLVED)
Hi Stefan,
For register level debugging, I use MPLAB X IDE (v5.20) with PICKIT4 debugger.
I use v1.45 from XC8 compiler because Flowcode8 also uses this by default.
But perhaps such a connector is missing only for me from the Clicker2 board.
Regards,
Lagoda
For register level debugging, I use MPLAB X IDE (v5.20) with PICKIT4 debugger.
I use v1.45 from XC8 compiler because Flowcode8 also uses this by default.
I also like this board. It would be nice if the card had an external power connector. Because the battery can only be charged via USBThere is also a Clicker 2 with a PIC32MZ on 200Mhz.
But perhaps such a connector is missing only for me from the Clicker2 board.
Regards,
Lagoda
-
- Posts: 170
- Joined: Fri Jul 15, 2016 9:51 pm
- Has thanked: 69 times
- Been thanked: 61 times
- Contact:
Re: PIC18F67K40 UART "SendString" problem (SOLVED)
Hi Stefan,
Maybe you didn't mean MPLAB X? Sorry!
https://www.tech-tools.com/DV518-logic-analyzer.htm
Regards,
Lagoda
Maybe you didn't mean MPLAB X? Sorry!
If you were thinking of a picture attached to the first post, it is the user interface of a TechTools DV518 Logic Analyzer.With which software did you do the test? Looks very good.
https://www.tech-tools.com/DV518-logic-analyzer.htm
Regards,
Lagoda