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.

Can i use any other pins for UART in PIC? other than Tx,Rx??

Status
Not open for further replies.

Gokul_India

Junior Member level 2
Junior Member level 2
Joined
Apr 1, 2011
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Coimbatore, India
Activity points
1,463
I want to interface GPS or GSM to any other pins other than Tx, Rx......!! I cant use I2c or SPI as i would hav connected a memory chip to through it...

So, can i use any other i/o pin for it..?? Can i develop the protocol of my own??? either SPI or I2C or USART..?? If so, how to do it? or, is there any ready made code available for it in internet...???

Waiting for ur replies.....!!!:):) thank you...
 

why do you have to resist using anyother pin... what is the matter??? has anyone told you that???
You can use a a relay and interface both GSM and GPS.... your requirement is invalid..
 

Depending on core and C compiler you are using, can easylly create others UART serial communication implemented not by hardware module, but by firmware. There are specific APIs wich implements it transparentlly to the programmer.

+++
 

Sure, as Andre mentioned you can you general purpose I/O pins with a SoftUART to create another serial interface. This technique is often used when another UART is required without the use of a multiplexing or shared port scheme.

Here's an PDF discussing the technique:



Some examples:

12F675 Tutorial 3 : PIC Serial Port

**broken link removed**

What language are you using to coding, Assembler or C?

Hope the info helps in your endeavors
 
This technique is often called Bit Banging, so google search something that involves these keywords + UART.
 

This technique is often called Bit Banging, so google search something that involves these keywords + UART.

These techniques are also referred to as a "Software UART" or just "SoftUART," if you do a google search for either of these terms plus MCU type you will find plenty of examples.

I use C language with High Tech C compiler... And, i am using PIC16f877a controller..

Also most C compilers have examples of Soft Hardware Interfaces, not just for UART, but including SoftI2C, SoftSPI, etc.

Attached is an example of a SoftUART compatible with the Hi-Tech C PICC compiler.



Hope the info and example helps in your endeavors.
 

Attachments

  • SoftUART.zip
    49.6 KB · Views: 212
Sir..., Thank you very much....!! this is a complete code right...?? If i just program my PIC 16f877a with this code., i can use my RB6 and RB7 as TX and RX pins...?? will this produce any interrupts? Bcoz., i will be using the GPS in my my real Tx, Rx pins continuously.. So., if i implement this code and interface this soft UART with GSM., will it interrupt me if there is and data? If i receive an SMS...??? and, i hav another doubt..., if i use this code, how much program memory will it occupy?? Bcoz., already i am having just 8k of program memory in this PIC which i am using....
 

yes it would interrupt the data as hardware UART will have more priority compared to software UART.. you end up loosing the data or your GSM will be interrupted by GPS... GPS received data every few seconds and it will block your GSM activity....
 
Hello Gokul_India, how are you?
Yes, you can use almost any PIC pin for RS232 serial transmission. Goto -> www.Datadog.com/p_tutorial.html, this is the Datadog tutorial page. Look for the "8 Page PIC Software UART" tutorial. This technique is called "Bit bopping" and is software only, no hardware required. Enjoy! Let me know if this is what you wanted.
Best regards,

John Massa@Datadog.com
Datadog Systems
 

...i can use my RB6 and RB7 as TX and RX pins...?? will this produce any interrupts?...

On PIC16F877 core, RB6/RB7 pins already supports interrupt feature, due built-in UART module have this function mapped on SFR register.
However, in order to provide interrupt capability to softuart routine, you must elaborate it by using some I/O Edge interruption to indicate bit change.

You cannot expect to have all resourses at some routine implementes by API software as well is done by hardware module.


+++
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top