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.

MicroC UART questions about UART1_Data_Ready() function

Status
Not open for further replies.

dim912

Junior Member level 2
Joined
Sep 9, 2009
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Colombo
Activity points
1,524
I am using microC UART library to communicate between two PIC devices.
but it always gives unexpected results.

I have some point to get clarified..


(1) in microC library we use UART1_Data_Ready() function to get to know whether RX data is available.


if we use UART1_Read() function, after UART1_Data_Ready() gives 1, does UART1_Data_Ready() gives 1 longer? or it gives 0 after UART1_Data_Ready() is executed.

(2) if the PIC receives a text like "edaboard",

does UART1_Data_Ready() gives 1 until all characters are read out using UART1_Read() function.


(3) If the PIC is waiting for a RX character stream like "HelloWorld", should we continuously check UART1_Data_Ready() function?
(4) when the above case is considered, does UART1_Data_Ready() give 1 just after receiving the first character of the character streem?





I am asking all above because, I was not able to receive a character stream sent by one pic to Other PIC. it always losses data and gives unexpected results.

I tried using both UART1_Read() and UART1_Read_Text() functions..



if you please direct me to any successful microC program to receive a character stream..


thanks all....!
 

Re: MicroC UART problems

Library functions SPI, I2C, UART, 1-Wire and others may be used only in case, if your CPU is a master and you need to send some data to debug for example.
If you need to receive data, you should use interrupt. Or you'll have to wait for the data all the time - this means a poling method.
 
  • Like
Reactions: dim912

    dim912

    Points: 2
    Helpful Answer Positive Rating
Re: MicroC UART problems

If you really want to know, how to use UART interrupt, I can try to make some kind of instruction for you because I'm using the same compiler.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top