Tuesday, June 17, 2008

[oopic] Re: Serial To LCD messing up

I'm not sure but I think the OOPic compiler doesn't like that logical
expression in the first IF statement.

In any event, for the V5 compiler, the "Visual Basic" syntax and a
B.2.2+ chip, the following code works:

dim Serial As new oSerialPort
dim X As new oByte
dim Y As new oByte
dim total As new oByte

sub main()

X=0
Y=0
total=0

Serial.Baud = cv9600
Serial.Operate = cvOn

Start:
If (Serial.Received = cvTrue) then
if (Serial.Value = 35) Then
Serial.String = "got #" + Chr$(13) + Chr$(10)
Goto FirstDigit
End If
End If
Goto Start

FirstDigit:
If Serial.Received =cvTrue Then
X= Serial.Value
X = X - 48
Serial.String = "got 1st digit: "
Serial.String = Str$(X) + Chr$(13) + Chr$(10)
Goto SecondDigit
End If
Goto FirstDigit

SecondDigit:
If Serial.Received = cvTrue Then
Y = Serial.Value
Y = Y - 48
Serial.String = "got 2nd digit: "
Serial.String = Str$(Y) + Chr$(13) + Chr$(10)
Goto ProcessTones
End If
Goto SecondDigit

ProcessTones:
total = (X*10 +Y)
Serial.String = "Total = "
Serial.String = Str$(total) + Chr$(13) + Chr$(10)
Goto Start

end sub

I don't have the LCD so I dumped that code.

Richard

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments:

Post a Comment