# Interfacing RS-232 and a PIC

Status
Not open for further replies.

#### AGUERE

##### Junior Member level 1
RS 232 and PIC

Hello,I am Programming a pic for the control my antennas, but I have a problem when I want to comunicated with my pc. I am using HSERIN, but I don´t know what I receive a string 6 digit from my computer.Please help me. Thank you very much.

aguere@mail.com

Hi,

Try this file.

#### AGUERE

##### Junior Member level 1
RS 232 and PIC

Thank you very much for your help, now I see the files, but I don´t programming in asembler, only in basic, and my question was instruction for Basic. I used pic basic 242, and microcode studio, is very good for me. I made device interesting with this software. In this moment I have a problem between pic and pc. I send from pc data ex. 23456 and only read in my pic the first number, I probe all and I don´t Know what happen. I need for ex. from pc ( az 234, el 45 ) for move my antennas, az=azimut 234º and el=elevation 45º ) Thank you very much

aguere@mail.com

#### Kripton2035

what are the arguments of the hserin command you use ?
please give part of the listing of your code if you want some help !
I think you'd better get one char at a time with this command...

#### AGUERE

##### Junior Member level 1
rs232 and pic

OK, I need have the caracter from pc, I send from pc az 234 and send too el 34 for example. I want in my pic, when read az 234, put the vaiable az in 234, and when read el 34 put the variable in 34 into the pic. For example. The antenna horizontal are in az 100º and send from my pc az 258º, in this moment the pic may move the antenna at az 258º ok. The problem is I don´t know 5 or 6 caracters from pc.
my program part.
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 2400
DEFINE HSER_SPBRG 25

DEFINE LCD_DREG PORTC
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
...
....
MAIN:
LCDOUT $FE,1 LCDOUT I,$85,"TRACKING"
LCDOUT I,LINEA2," AZIMUT ELEVACION"
LCDOUT I,$99,734,I,$A3,734
INICIO:

INICIO1:
GOSUB LEEANALOGICAS

IF cad= 2 THEN GOSUB park
IF cad= 3 THEN GOSUB COMUNICACION
.....
-.....
...

tHANK YOU VERY MUCH

aguere@mail.com

Status
Not open for further replies.

Replies
2
Views
3K
eXnol
E
Replies
2
Views
2K
Replies
2
Views
2K
Replies
15
Views
10K
Replies
11
Views
4K