• 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.

PIC Basic Plus and RS232 problem again. Help!!!

Status
Not open for further replies.

Beefer3

New Member
Hey everyone
Can someone help out on the following code?

The first two IF THEN statements work but, the switch IF THEN statement does not.

When I run the code with the first two IF THEN statements commented out, the switch IF THEN statement is recognized.

Also, if I hold down the switch and press A or B on my terminal program, the switch IF THEN statement is recognized.

I am completely confused as to why it does not work.

Any help is greatly appreciated.


Here is the code:

DEVICE 16F84A
INCLUDE "MODEDEFS.BAS"
PORTA = %10111
PORTB = %00000000


Cls
Print AT 1, 1, " WELCOME"

Dim SERDATA As Byte

SINPUT:
SERIN PORTA.4, 396, [SERDATA]

If SERDATA = "A" Then
SEROUT PORTA.3,396, ["SENDING THE LETTER A"]
Cls
Print AT 1, 1, "SENDING THE"
Print AT 2, 1, "LETTER A"
Else
End If


If SERDATA = "B" Then
SEROUT PORTA.3,396, ["SENDING THE LETTER B"]
Cls
Print AT 1, 1, "SENDING THE"
Print AT 2, 1, "LETTER B"
Else
End If


IF PORTA.2 = 1 THEN
Cls
Print AT 1, 1, "SWITCH PUSHED"
SEROUT PORTA.3,396,[ "SWITCH PUSHED"]
Else
End If

GOTO SINPUT

End
 

Beefer3

New Member
never mind. i fixed it. :lol:
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top