Special Offer
It is currently 02 Aug 2014 09:47

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 26 Dec 2009 22:13 
Offline

Joined: 01 Nov 2009 23:41
Posts: 9
Hello you guys,
I know how to connect the computer to the PIC via USB (PIC18F4550), and also I can connect both PIC and GPS (Parallax GPS - Serial). Both of them I connect to PIN 26(Rx),25(Tx). My question now, how can I connect both of them, meaning to connect the GPS to the Controller, and from the controller to the controller USB???

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: 27 Dec 2009 07:58 
Offline

Joined: 18 Jan 2008 05:32
Posts: 172
Location: Australia
Normally you would use a "soft" usart to generate the slower serial data in software.

So you would use the hardware usart for the USB, and make a soft usart for the GPS.

Your MikroC compiler should have soft usart library functions.

_________________
Using; EasyPic4, EasyPIC6, BigPic4, MikroC. MPLab, MPASM.
C since 1991, PIC asm since 1998. Author of many freeware and open-source goodies; www.RomanBlack.com Designer of the www.TalkBotBrain.com talking PIC project.


Top
 Profile  
 
 Post subject:
PostPosted: 28 Dec 2009 00:11 
Offline

Joined: 01 Nov 2009 23:41
Posts: 9
Thanks "The_RB" for your reply,
When I opened the example pages, to see the soft ware UART, it gave me the following:

unsigned short data = 0;
unsigned short recOK;
                                 
void main() {
  Soft_Uart_Init(PORTC, 7, 6, 19200, 0);    // initialize Soft UART

  while (1) {                       
    do {
      data = Soft_Uart_Read(&recOK);        // receive data
    } while (recOK);

    Soft_UART_Write(data);                  // send data via UART
   }
}//~!
       

Which pin in port C is TX and which is Rx???

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: 28 Dec 2009 05:10 
Offline

Joined: 05 Jul 2008 06:05
Posts: 608
Location: Thailand
Quote:
Normally you would use a "soft" usart to generate the slower serial data in software.

So you would use the hardware usart for the USB, and make a soft usart for the GPS.


That's going to be very difficult with GPS data, Soft_Uart functions have no flow control or buffer so there's no way to know when new data has arrived and if you don't read the byte before the next one arrives you will lose it. As GPS data is a constant stream it will be very easy to run into problems.

In the Soft_Uart example, Rx is on pin 7 and Tx is on pin 6, it's in the help files.

Forgive me for asking but on the 4550 the USB lines are on RC4 & 5 and the Uart is on RC6 & 7. Why the conflict?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 0 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group