CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

connect a GPS and XBEE in a single PIC16F876A

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lan ahmad



Joined: 23 Jul 2012
Posts: 13

View user's profile Send private message

connect a GPS and XBEE in a single PIC16F876A
PostPosted: Tue Apr 23, 2013 1:48 am     Reply with quote

Hello..

can i know, is it possible to connect a GPS receiver and XBEE in a PIC16F876A through a single MAX232.

Code:

#use rs232(baud=9600,parity=N,xmit=PIN_C4,rcv=PIN_C5,bits=8,stream=GPS)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=XBEE) 
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 23, 2013 5:27 am     Reply with quote

Yes, it is possible, but one of those devices will be connected to a software UART.
The overall project will determine the actual interface.
If the PIC is to 'poll' the GPS device then send data via Xbee to say a PC, then I'd hookup the GPS to the sofware UART.
You could also hookup the Xbee to the software UART if you're using it in 'transparent' mode and not in the API mode,this would give the GPS the hardware UART.
There are 'pros and cons' with either configuration, based upon overall speed of the system, amount of data to transfer,etc.
You'ld have to supply more details but either way will work.



hth
jay
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Apr 23, 2013 6:44 am     Reply with quote

Hi,

To answer your specific question, yes it's possible. The MAX232 device contains two receiver/transmitter pairs, so one pair can be dedicated to the GPS, and one pair to the Xbee.

Can you tell us which GPS, and which Xbee you are using? Most GPS modules have TTL level interfaces, as do the Xbee modules, and can be directly connected to your PIC without the need for a MAX232. Perhaps your GPS and Xbee modules are on breakout boards with RS232 interfaces? You should tell us this!

The Xbee is a 3.3V device, and many GPS modules can be found that operate at this voltage. The "ideal" situation would be to power your PIC, GPS, and Xbee all at 3.3V and avoid the need for any special interfacing! You'll likely need to use the 'LF' version of your PIC to do this reliably?

Personally, I would connect the GPS to the hardware serial port, as most send a (nearly) continuous stream of data. You can connect the Xbee Rx pin to the EXT_INT pin of the PIC to get 'quasi' interrupt drive serial receive from the Xbee, but there are some (obvious) limitations, such as no hardware buffering of the incoming data.

ALWAYS add 'Errors' to your hardware serial port #Use RS232!

John
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group