Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - HOW TO: Change USART Baud Rate

(you are viewing a thread; or go back to list of threads)

HOW TO: Change USART Baud Rate (by Ihor Nehrutsa)
Sat May 19 2018, 03:09:54
(no subject) (by MGP)
The question is, how can we use 9600b on a 4MHZ (PIC)system, LDmicro gives a warning when compiling.

Changing the UART baudrate in the program is not a good idea if you not know what you are doing.
Sat May 19 2018, 03:28:49
(no subject) (by Ihor Nehrutsa)
There is a direct relationship between the baud rate and Fosc.
Thus, you can: or change the baud rate or change the Fosc.

A good idea is always to know what you are doing. ;)
Autodetect baud rate needs some time.
Sat May 19 2018, 05:14:43, download attachment pic baud rate.PNG
(no subject) (by MGP)
I wonder which values he has used in his LCD program, it seems that you can't use 9600b with the internal oscillator.
But his program runs very good on 9600b I never had any problems with the LCD.

https://github.com/LDmicro/LDm...CD-based-on-HD44780-controller
Sat May 19 2018, 07:44:12
(no subject) (by Ihor Nehrutsa)
to MGP
I think MCU on LCD board and MCU on your board work at the 4 MHz internal oscillators. And USART baud rate set as "9600 bps" on both MCU's. In fact, the baud rate is 8900 bps on both MCU's with -7% error.

Try to measure the fact transmit frequency on both MCU's with the oscilloscope.
Sat May 19 2018, 08:40:08
(no subject) (by MGP)
My testboard is a pic16F876a on 20MHz 9600b and it works always without exceptions.

But if it runs on 8900b it's OK, my question is answered. Thx
Sat May 19 2018, 08:55:06
(no subject) (by Ziggy)
A bit more on Baud rates and ATmega processors ( I know nothing about PICs)...
It is possible to based on a reference frequency adjust a variable which controls the free running onboard clock to be a bit more precise than the factory supplied configuration.

I use an STK500 and AVRstudio 4 ( yes old and familiar ). This combination offers a utility which calculates the required value to adjust the clock.

How to use this calibration value within LD micro if at all possible?
Sat May 19 2018, 18:37:49
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):