Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

HSERIN and HSEROUT problems

Status
Not open for further replies.

amindzo

Member
Hi,
i wrote this program to give serial information by jserin and hserout instructions.i want to send
"C" charactor and then send B0 and B1 valude and in reciver first i should get the "C" charactor
anf then get serial data and put them in B0 and B1 variables and show them on lcd.
when i turn on reciver after 1 or 2 seconds some randim numbers is shown on lcd without turning on transmitter.
could you help me with this problem?

transmitter program:
define OSC 4
' Set transmit register to transmitter enabled
DEFINE HSER_TXSTA 20h
' Set baud rate
DEFINE HSER_BAUD 1200
' Set SPBRG directly (normally set by HSER_BAUD)
DEFINE HSER_SPBRG 25
B0 var byte
B1 var byte
B0=125
B1=225
hserout ["C"]
hserout [bin B0,B1]
end

reciver program:
define OSC 4
'
'lcd defines
'

' Set receive register to receiver enabled
DEFINE HSER_RCSTA 90h
' Set baud rate
DEFINE HSER_BAUD 1200
' Set SPBRG directly (normally set by HSER_BAUD)
DEFINE HSER_SPBRG 25
n var byte
B0 var byte
B1 var byte
ArrayVar var byte
C var byte
n=1
hserin [STR ArrayVar\n\C]
hserin [bin B0,B1]
lcdout $fe,1,#B0," ",#B1
end
 
amindzo said:
Hi,
i wrote this program to give serial information by jserin and hserout instructions.i want to send
"C" charactor and then send B0 and B1 valude and in reciver first i should get the "C" charactor
anf then get serial data and put them in B0 and B1 variables and show them on lcd.
when i turn on reciver after 1 or 2 seconds some randim numbers is shown on lcd without turning on transmitter.
could you help me with this problem?

Which part of "YOU CAN'T SEND RS232 OVER A SIMPLE RADIO LINK" don't you understand?.

You need Manchester coding (or similar) and NOT RS232, you can't use the built-in serial routines to do it.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top