×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

HELP : RF communication with RS232 / PIC16F877

HELP : RF communication with RS232 / PIC16F877

HELP : RF communication with RS232 / PIC16F877

(OP)

Hi,
My problem is that I can't threat my RS232's datas.
Here's my program in the first PIC16F877, then it will be send to a RF module:
 
er=0;
er2=0;
en1=0x20;
en2=0;
en3=0;
en4=0;
ena=0x02;
enb=0;
e=er+er2+en1+en2+en3+en4+ena+enb;
printf("%c",e);
//////////////////////////////////////////////////
and then  xmit to  
( module linx RF HP-2 )
//////////////////////////////////////////////////
then received to
( module linx RF HP-2 )
//////////////////////////////////////////////////
then the information is threated by PIC16F877
that's the program :
#include "16F877.h"
#include "stdlib.h"
#use delay (clock=20000000)
#include "gg_div.c"
#include "gg_lcd.c"
#include "gg_str.c" //librairie maison
#use Rs232 (baud=9600,xmit=pin_c6,rcv=pin_c7)
#include "stdio.h"
void main (void)
{
char e;
set_tris_c(0x80);
set_tris_d(0x00);
e=getch();
/////////////////////////////////////
But then, I can't use the code that I received .. I can see it on the oscilloscope .. but when I do e=getch() then printf("%c",e)  It doesn't show up on the hyperterminal.

Maybe I have to modify the second program.
help me.
thanks.
-lp

RE: HELP : RF communication with RS232 / PIC16F877

1)  What RF module are you using?

2)  What is getch()?  How does it specifically work?

3)  Have you verified that you are meeting all of the interface protocol requirements between the PIC and RF module?

.
.
.

RE: HELP : RF communication with RS232 / PIC16F877

Hi-

Well, first of all you might consider that you need an
inverter to get the output of the pic into the correct
logic level.  I typically use a 2N2222 transistor for
a simple inverter, and yes, I do drive it with only +5
volts.  It works most of the time.  If you feel
uncomfortable with that, you might consisder using one
of the Max 232X type chips which drive + and - voltage
levels from a single +5V supply.  Then you might also
want to go with the old 1488/1489 chips which require
+ and - 12 volts.

So, just to be on the safe side, when you transmit your
characters, you see a low level at the com port of
the hyperchannel when the pic is not transmitting and
when it transmits, there is a high logic level at the
start bit of the character.  

Try tying the TX data of the hyperterminal to the RX
pin and see if you indeed are echoing characters.  I
assume that you are with the scope output, but it is
a comforting feeling to know that the hyperterminal is
working correctly.

Also, is the baud rate correct?  That can cause jibberish
or nothing at all to be received.  Are the number
of data bits and stop bits correctly set at the pic and
the hyperterminal?  Those can cause "framing errors" and
could also cause jibberish or nothing.  Same is true
of the parity settings.

Hint: try a SLOW baud rate 300 or 1200 baud and work you
way up.  Depending on the RF modules you are using,
you can add significant distortion in the digital signal.

Hint. Try it hardwired without the RF modules in the loop.

I am using the 2N2222 as mentioned above with a PIC16F77
running them at 19.2 K baud hard wired to a laptop
running minicom (the linux equivalent of hyperterminal).
They pass data correctly and with great reliability.

Hope these thoughts help.

  Cheers,

   Rich S.

RE: HELP : RF communication with RS232 / PIC16F877

(OP)
wow thanks Rich. I'll give you a feedback soon !

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources