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.

Software UART+ Hardware Uart

Status
Not open for further replies.

xyzabcpqr

Junior Member level 3
Joined
Mar 22, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,523
Hello all,

I am currently working on PIC16LF1936 and PIC16F1937.

PIC16LF1936 has one UART and it is used with Transceiver chip. I need to interface it with PIC16F1937 which has again one UART and it is not used.
I think I have to implement software UART in PIC16LF1936 and hardware UART in PIC16F1937 .
I don't have any idea how to use software uart and interface it with hardware uart? I am working on C code.

I would appreciate your guidance.
 

At a data signalling level they are identical so you just connect them as though they are both hardware UARTS.

The software UART works like this.

Transmitting.

1. Always start with the TX line high.
2. use a timer or delay set to one bit length.
3. make the TX pin go low for one bit period - this is the start bit.
4. shift the data bits out on the TX pin, one at a time and after each bit, wait for one bit period.
5. make the TX pin high for one bit period - this is the stop bit, you can leave it high at the end so it's ready if another byte has to be sent.

Receiving.
1. wait for the RX pin to go low - this is the leading edge of the start bit.
2. wait for 1.5 bit periods, this leaves time for the start bit and leaves you half way through the first data bit.
3. shift the RX pin bit into your 'receive' register.
4. wait one bit period then do step 3 again until all the data bits are received.
5. wait one bit period so you are in the middle of the stop bit, optionally check it is high, it should be.
6. wait if necessary until the RX pin is high so you are sure you are in the idle state and ready if for another byte arrives.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top