Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

uart in 16f877 and mikroC

Status
Not open for further replies.

bettai

Newbie level 1
Joined
Apr 23, 2017
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
helllo everybody i am new here and i will appreciate your help really , i am using serial port of a pic16f877 to control a LED and a relay ( when serial communication is started the led must blink and when the string "open" is received on the serial port the relay opens for 1 minut ) i am not good in coding so if somone helps me with this siple code i'll be thankful ;) also i would ask about the signal clock of the pic16f877 , should i put an external quartz clock ? or the pic will generate it's sgnal by itself? also does the pic works with a standard signal clock value or it is chosen by me the coder?? also the relation between the signal clock and the bau rate ! PLEASE HELP ME ! I AM IN A SRIOUS PROBLEM !!! with this project :/ if anyone wants help me more please he can contact me at MODERATOR ACTION: email address is removed THANK YOU ALL
 
Last edited by a moderator:

hello,


to get some help , you need to prouve you are doing some effort by yourself.

So, 1rst step :
read the datasheet of 16F877 to check if you can use it , without external Quartz or oscillateur

with MikroC
if you put the correct used value of FOSC in the project , you don't need to care about this for baud rate
juste do the init
Uart_init(9600); (for 9600 bauds)
 

UART is one of the protocols that it is generally recommended to use an external crystal with due to how the baud rate works. Basically the clock is embedded in the signal so any variation in the clock source can cause issues. The receiver side samples according to its clock source and assumes only so much variation. So you need to use a clock source that is fairly precise, unlike SPI or I2C which sends out a clock with the data. So the receiver side samples according to the clock given in the case of SPI and I2C, which means the clock could be crazy so long as the receiver can keep up. Most microcontrollers have an RC clock built in however this is not usually as precise as external ones. RC clocks are also subject to temperature variations.

You will need to configure MikroC to use an external clock with the associated frequency. I am not able to help with that as I do use MikroC. From that MikroC should be able to help out with the baud rate calculation, however I would check it with the data sheet to make sure it can give a valid baud rate for the clock you configured.
 

hello,

it seems "bettai" is out ... after more than one month..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top