PIC18F67K40 UART Baud rate 7bit mode ?

For general Flowcode discussion that does not belong in the other sections.
seokgi
Posts: 217
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

PIC18F67K40 UART Baud rate 7bit mode ?

Post by seokgi »

Hello!
I am making a communication converter using PIC18F67K40. But there are many problems. SendString is doing fine for your help last time. However, if an external clock is used, the communication does not work correctly. And 2400 baud rate 7bit mode does not work. recive interrup seems to work fine. It works well in HS Osilator, HFINT OSC with HFFRQ =64Mhz, 9600, 8,1 mode.
Please help.

Thank you.

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by seokgi »

Somebody Help me!

I need any hint.

Thank you.

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by LeighM »

Can you first check that your "external clock" is working, and you get the correct speed, by doing a simple "1 second LED flash test" program?
If that works, could you then transmit from the UART and check the baud rate?

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by seokgi »

As mentioned above, I checked everything. However, it does not work well if you use an external clock. If you check with the oscilloscope, the clock is working well.

External clocks were used at 11.0592, 18.432, 22.1184, and 16 MHz.

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by LeighM »

does not work well
...what does that mean?

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by seokgi »

If an external clock is used, the serial communication characters are broken.

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by LeighM »

OK, thanks.
So you are getting something, but perhaps at the wrong speed?
Could you put an oscilloscope on the Tx output and determine what the baud rate is versus what you expect?
Also timing the flash of a LED, say at 1/2 second on and off, or other output, will tell us if the processor is running at the speed Flowcode expects it to be running.
If you could give us more information like this it will help us narrow down the issue.
Presumably you are setting the changed clock speed in the project settings?

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by seokgi »

This is a screen measured with an oscilloscope.

Only 7bit mode cannot be read.
Attachments
K-001.jpg
K-001.jpg (101.27 KiB) Viewed 8355 times
K-003.jpg
K-003.jpg (84.89 KiB) Viewed 8355 times
K-002.jpg
K-002.jpg (89.71 KiB) Viewed 8355 times

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by LeighM »

Thanks for that.
Would you mind please doing another test?
Just to confirm, your issue is with 7 bit UART at 2400 baud?
If so, could you create a simple program that does the UART initialisation,
then goes into a continuous loop that delays for 10mS and sends character 'U'
Then post the oscilloscope trace for that?
Thanks

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: PIC18F67K40 UART Baud rate 7bit mode ?

Post by LeighM »

Hi,
If the baud rate is OK, the next problem is that this device does not directly support 7 bit UART operation.
One possibility is to set bit 7 high for each byte before you send it.
Similarly each received byte will have bit 7 set.
This is assuming that the sender transmits with at least 2 stop bits.

Post Reply