PDA

View Full Version : strange serout2 problem



KaanInal
- 5th January 2010, 22:10
Hi everyone, and happy new year :)

I am trying a rs232 communication. I use 16f84a. I am a beginner in electronics.
This problem seems strange:

I use hyper terminal. I have a Max232 circuit with Sub-D 9-F. I also send the schematic of the circuit (my source is http://sodoityourself.com/max232-serial-level-converter/ )

Here is the problem, controller led is blinking but there is nothing on hyper terminal




OutGoing VAR Byte
OutGoing = "K"


D_Forwarder VAR PORTB.3 'data forwarder

Forwarder VAR PORTA.1 ' Controller led

PAUSE 500

main:
SEROUT2 D_Forwarder,396,["O",OutGoing ] '2400 baud rate
HIGH Forwarder
PAUSE 100
LOW Forwarder

goto main




But in this code, while the led is blinking i also see both of the O and K characters, it works.




OutGoing1 VAR Byte
OutGoing1 = "K"

OutGoing2 VAR Byte
OutGoing2 = "S"

D_Receiver PORTB.2 'data receiver
D_Forwarder VAR PORTB.3 'data forwarder

Forwarder VAR PORTA.1 ' Controller led
Receiver VAR PORTA.0 ' Controller led

PAUSE 500

main:
SEROUT2 D_Forwarder,396,["O",OutGoing1 ] '2400 baud rate
HIGH Forwarder
PAUSE 100
LOW Forwarder

SEROUT2 D_Receiver ,396,["O",OutGoing2 ]
HIGH Receiver
PAUSE 100
LOW Receiver

goto main


Is this correct?

mackrackit
- 6th January 2010, 12:32
This line in the program you say works should cause the program to not compile.


D_Receiver PORTB.2 'data receiver


You forgot the VAR.

KaanInal
- 7th January 2010, 09:33
I erased it accidently, sorry :) There is a VAR over there, it compiles.