Searching \ for '[PIC]: help with serial comms bwtn PICs' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=serial
Search entire site for: 'help with serial comms bwtn PICs'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: help with serial comms bwtn PICs'
2001\04\19@101343 by Oluseyi Odeinde

flavicon
picon face
hello everyone,

i have the following set up:

PIC1.Tx --> Rx.USART1.PIC2.USART2.Tx --> terminal emulator (tera term
pro)

PIC1 & PIC2 are both PIC16C76

USART1 = PIC's on board USART port [i.e. hardware port - pins C6(tx),
C7(rx)]
USART2 = software USART port [pins B0(rx), B1(tx)]

PIC1 is running @ 4MHz and 2400 baud

PIC1 is xmting PPP packets in the form of raw bytes.
Each packet starts and ends with a ~ which is 0x7E in HEX.

Currently, i'm simply trying to make sure that incoming packets into
PIC2 are received and buffered properly.

here's my pseudo code:

.....
.....
functions
&
routines
.....
.....

main(){

setup stuff

continuously looping or until timeout expires:

   if (incoming char on USART1) {

       get char from USART1_Rx;

       if (error occured while receiving)
          fix it;

       if end of packet (i.e checksum matches){
           display content of buffer via USART2_Tx;
           reset buffer markers;
       } esle {
           if (space in buffer) {
               store char in buffer;
               increment buffer marker;
               calculate CRC checksum;
           } esle {
               send message that buffer full!;
               exit;
           }
       }
   }

   do some other stuff
}

questions:

1. at what frequency should PIC2 be running in order for incoming
packets to be correctly
  captured and buffered i.e. is there a ratio in frequency btwn sender
and receiver?

2. is it better to poll or use interrupts?

3. any other issues that one should consider?

TIA
Seyi
p.s. i'm using the HI-TECH C Compiler

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\04\20@051349 by Oluseyi Odeinde

flavicon
picon face
i apologise if this post appears twice. didn't see the 1st one after 2
days so decided to resend.

hello everyone,

i have the following set up:

PIC1.Tx --> Rx.USART1.PIC2.USART2.Tx --> terminal emulator (tera term
pro)

PIC1 & PIC2 are both PIC16C76

USART1 = PIC's on board USART port [i.e. hardware port - pins C6(tx),
C7(rx)]
USART2 = software USART port [pins B0(rx), B1(tx)]

PIC1 is running @ 4MHz and 2400 baud

PIC1 is xmting PPP packets in the form of raw bytes.
Each packet starts and ends with a ~ which is 0x7E in HEX.

Currently, i'm simply trying to make sure that incoming packets into
PIC2 are received and buffered properly.

here's my pseudo code:

.....
.....
functions
&
routines
.....
.....

main(){

setup stuff

continuously looping or until timeout expires:

   if (incoming char on USART1) {

       get char from USART1_Rx;

       if (error occured while receiving)
          fix it;

       if end of packet (i.e checksum matches){
           display content of buffer via USART2_Tx;
           reset buffer markers;
       } esle {
           if (space in buffer) {
               store char in buffer;
               increment buffer marker;
               calculate CRC checksum;
           } esle {
               send message that buffer full!;
               exit;
           }
       }
   }

   do some other stuff
}

questions:

1. at what frequency should PIC2 be running in order for incoming
packets to be correctly
  captured and buffered i.e. is there a ratio in frequency btwn sender
and receiver?

2. is it better to poll or use interrupts?

3. any other issues that one should consider?

TIA
Seyi
p.s. i'm using the HI-TECH C Compiler

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\20@095305 by Olin Lathrop

face picon face
> i apologise if this post appears twice. didn't see the 1st one after 2
> days so decided to resend.

I saw your post.  I don't know why others didn't respond, but for me there
was too much detailed babble without a question in sight (perhaps I would
have seen one if I had scrolled down), so I just hit ^D and went on.  You
might get a better response if you distill your problem down to a single
paragraph.  Remember, you are asking people for a favor.  Make it easy for
them to help you.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, .....olinKILLspamspam@spam@embedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\04\21@095033 by michael brown

flavicon
face
> questions:
>
> 1. at what frequency should PIC2 be running in order for incoming
> packets to be correctly
>    captured and buffered i.e. is there a ratio in frequency btwn sender
> and receiver?
>
From what I understand, any there are no ratio requirements.  Any frequency
high enough to allow you enough time to receive the data and process it
should be ok.

> 2. is it better to poll or use interrupts?

Polling should be ok as long as you do it often enough so as to not miss any
received bytes.  Interrupts have the benefit of letting you know precisely
when data has been received and needs to be processed.  When using
software(instead of hardware USART) interrupts are probably the most
reliable way to receive the data.  I have successfully received data at
9600baud on 16f84 running at 4Mhz using RB0/int to detect the start bit and
then using TMR0 ints to receive each data bit.  This leaves plenty of
time(>50%) for main level code to process the data.  Otherwise, all time
will be spent(wasted) using delay loops between data bits.  If you would
like to see my code, please let me know.

>
> 3. any other issues that one should consider?
>
> TIA
> Seyi
> p.s. i'm using the HI-TECH C Compiler

Good luck, I hope this helps you in some way.

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2001\04\21@122548 by michael brown

flavicon
face
I sent this once, but it seemed to evaporate somewhere. Sorry if this
appears twice.

> questions:
>
> 1. at what frequency should PIC2 be running in order for incoming
> packets to be correctly
>    captured and buffered i.e. is there a ratio in frequency btwn sender
> and receiver?
>
From what I understand, any there are no ratio requirements.  Any frequency
high enough to allow you enough time to receive the data and process it
should be ok.

> 2. is it better to poll or use interrupts?

Polling should be ok as long as you do it often enough so as to not miss any
received bytes.  Interrupts have the benefit of letting you know precisely
when data has been received and needs to be processed.  When using
software(instead of hardware USART) interrupts are probably the most
reliable way to receive the data.  I have successfully received data at
9600baud on 16f84 running at 4Mhz using RB0/int to detect the start bit and
then using TMR0 ints to receive each data bit.  This leaves plenty of
time(>50%) for main level code to process the data.  Otherwise, all time
will be spent(wasted) using delay loops between data bits.  If you would
like to see my code, please let me know.

>
> 3. any other issues that one should consider?

I'm sure there probably are, but this is about all I know.

>
> TIA
> Seyi
> p.s. i'm using the HI-TECH C Compiler

Good luck, I hope this helps you in some way.

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...