>I believe the first serial value must be read to clear things for
>the second digit. You didn't read the first digit.
Sure he does. "X= Serial.Value"
>--- On Sun, 6/15/08, ef721 <ef721@yahoo.com> wrote:
>
>From: ef721 <ef721@yahoo.com>
>Subject: [oopic] Serial To LCD messing up
>To: oopic@yahoogroups.com
>Date: Sunday, June 15, 2008, 3:10 AM
>
>
>
>
>
>
>I am passing a string of numbers to an ooPIC-R through a serial port
>and having it display the numbers on a serial LCD. The first time it
>gets the string it displays the number correctly. But the second time
>it will first show the first string number it received from before and
>then show the second string number it received now. Here is my code:
>The string of numbers I send from the PC is in the format #xx , e.g.
>#12 or #48.
>Thank you so much for your help!
>
>,Eric
>
>LCD As oLCDSE
>Serial As oSerialH
>X As oByte
>Y As oByte
>total As Byte
>X=0
>Y=0
>total=0
>
>LCD.IOLine = 16
>LCD.Baud = cv9600
>LCD.Clear
>Serial.Operate = cvOn
>Serial.Baud = cv9600
>
>Start:
>If Serial.Received = cvTrue And Serial.Value = 35 Then
>LCD.VString = "got #"
>Goto FirstDigit
>EndIf
>Goto Start
>
>FirstDigit:
>If Serial.Received =cvTrue Then
>X= Serial.Value
>X = X - 48
>LCD.Clear
>LCD.VString = "got 1st digit: "
>LCD.VString = Str$(X)
>Goto SecondDigit
>EndIf
>Goto FirstDigit
>
>SecondDigit:
>If Serial.Received = cvTrue Then
>Y = Serial.Value
>Y = Y - 48
>LCD.VString = "got 2nd digit: "
>LCD.VString = Str$(Y)
>Goto ProcessTones
>EndIf
>Goto SecondDigit
>
>ProcessTones:
>LCD.Clear
>total = (X*10 +Y)
>LCD.VString = Str$(total)
>Serial.VString = Str$(total)
>Delay = 2000
>LCD.Clear
>LCD.VString = " Ready "
>
>Goto Start
------------------------------------
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:
No comments:
Post a Comment