Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | Re: Strange serial operations

Re: Strange serial operations - Andrew Porrett - Apr 1 14:25:25 2008

At 11:05 AM 4/1/2008, Matt Elias wrote:
> Do
> If Serial.Received = 1 Then
> LED.State.Invert
> buffer.Value=Serial.Value
> buffer.Location=buffer.Location+1
> LED.State.Invert
> End If

That code is far too slow to keep up with 9600 bps data. It can be
improved, but it'll still drop characters:

do
while serial.received then
buffer = serial
buffer.location = buffer.location + 1
end while
If oBuffer has an increment method, try using it.

At 9600 bps, you can send 960 characters per second. In that time,
the OOPic can execute about 350 lines of user source code. You do the math...

Is there any way to reduce the data rate to 1200 bps?

BTW, very nice indenting; it's a refreshing change.

> If In=1 Then
> Wait Until In=0
> LED.State.Invert
> buffer.Location=0
> For i = 1 To 20
> Serial.Value=buffer.Value
> buffer.Location=buffer.Location+1
> Next i
> buffer.Location=0
> For i = 0 To 30
> buffer.Value=i+48
> buffer.Location=buffer.Location+1
> Next i
> buffer.Location=0
> LED.State.Invert
> End If
> Loop
>End Sub

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: Strange serial operations - m_elias - Apr 1 17:46:08 2008

> That code is far too slow to keep up with 9600 bps data. It can be
> improved, but it'll still drop characters:

That's what I was suspecting. I don't think I can set the other
peripheral to a lower baud rate. That being said, it may support
hardware flow control. I'll try to figure that out.

> BTW, very nice indenting; it's a refreshing change.

Ummm, thanks.... looking back it seems as though the indents only show
up during the message composition stage.
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )

Re: Strange serial operations - m_elias - Apr 2 19:28:58 2008

Even with only this,

Do
If Serial.Received Then
buffer=Serial
buffer.Location = buffer.Location+1
End If
Loop

it still loses anything after 13 characters (total of 16 being sent).
It doesn't look like my load cell display can actually use any
hardware control. Its pin 7 & 8 are jumpered internally. Is there any
possible work around?

Matt
> At 11:05 AM 4/1/2008, Matt Elias wrote:
> > Do
> > If Serial.Received = 1 Then
> > LED.State.Invert
> > buffer.Value=Serial.Value
> > buffer.Location=buffer.Location+1
> > LED.State.Invert
> > End If
>
> That code is far too slow to keep up with 9600 bps data. It can be
> improved, but it'll still drop characters:
>
> do
> while serial.received then
> buffer = serial
> buffer.location = buffer.location + 1
> end while
> If oBuffer has an increment method, try using it.
>
> At 9600 bps, you can send 960 characters per second. In that time,
> the OOPic can execute about 350 lines of user source code. You do
the math...
>
> Is there any way to reduce the data rate to 1200 bps?
>
> BTW, very nice indenting; it's a refreshing change.
>
> > If In=1 Then
> > Wait Until In=0
> > LED.State.Invert
> > buffer.Location=0
> > For i = 1 To 20
> > Serial.Value=buffer.Value
> > buffer.Location=buffer.Location+1
> > Next i
> > buffer.Location=0
> > For i = 0 To 30
> > buffer.Value=i+48
> > buffer.Location=buffer.Location+1
> > Next i
> > buffer.Location=0
> > LED.State.Invert
> > End If
> > Loop
> >End Sub
>

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )