View Full Version : Rs232 and pic
irmus
- 10th October 2004, 20:42
Hello! I try this
serout portb.2, n2400, [$A0] but its bad .Pic nothing send. Help!!!
mister_e
- 10th October 2004, 20:56
hi irmus,
try this
serout PORTB.2,4,[$A0]
if this ones work, that mean you not declare :
INCLUDE "modedefs.bas" at the begining of your program
It appear that in some case that you must write PORTB.x in uppercase too.
Try also this :
DEFINE CHAR_PACING 1000
if this is not working tell me which PIC you use and how it is connected to RS-232 (with in serie resistor, thru an Max232...)
let us know !!!
regards
irmus
- 11th October 2004, 10:54
I am using modedefs.bas . 4 - here it mode baudrate? I use max232 and pic16f84
Thanks
mister_e
- 11th October 2004, 17:33
when you don't include modedefs.bas SEROUT serpin,4,... is the same as SEROUT serpin,N2400...
what is your taget device to receive $a0 ???
$a0= 160 (decimal) = BLANK character in ASCII table
maybe this is why.
try PORTB.2,n2400,["hello ",#10,10,13]
it suppose to display hello 10
let me know
mister_e
- 11th October 2004, 18:06
One other thing,
it also seems that SEROUT don't understand $ before data. Only #.
in your case if you really want to send $a0 use a variable
ToSend var byte
ToSend=$a0
SEROUT PORTB.2,4,[ToSend]
or
SEROUT PORTB.2,4,[#ToSend] ; output will be 160
irmus
- 11th October 2004, 18:58
I use comlite software and i can to see what i send to comport and what data receive from computer.
Thanks, i try this SEROUT PORTB.2,4,[#ToSend] ; output will be 160
mister_e
- 11th October 2004, 19:02
you're welcome.
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.