Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 14th November 2003, 12:54 PM   (permalink)
Default PIC Basic Plus and RS232 problem again. Help!!!

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
__________________
I like to tell people I have the heart of a young boy. Then I say it\'s in a jar on my desk.

- Stephen King
Beefer3 is offline   Reply With Quote
Old 14th November 2003, 11:07 PM   (permalink)
Default

never mind. i fixed it. :lol:
__________________
I like to tell people I have the heart of a young boy. Then I say it\'s in a jar on my desk.

- Stephen King
Beefer3 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 02:23 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.