Visual Basic, SERIN and SEROUT with RC-Time measurement
GWebber
Posts: 9
Hi All,
I really enjoyed playing with BOE SB2 with PBasic and Visual Basic for few days.· The Basic Stamp ran in debug mode with RC-Time measurement and Visual Basic was able to get the numbers from it but missed some of it.· I·tried with SEROUT in PBasic but did not have any luck with it.·Any suggestion?
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
HIGH 15
PAUSE 10
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time, DEC 3]
I also tried with·'Ready and Busy'·script
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
datain VAR Byte· 'contains a 0 or a 1
PIN· CON· 16·· 'stamps dedicated serial input pin
baud· CON· $4054 '9600 baud
again:
SERIN PIN,baud, [noparse][[/noparse]datain]
IF datain = "1" THEN Ready
IF datain = "0" THEN Busy
GOTO again
Ready:
HIGH 15
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time]
GOTO again
Busy:
LOW 15
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time]
GOTO again
I really enjoyed playing with BOE SB2 with PBasic and Visual Basic for few days.· The Basic Stamp ran in debug mode with RC-Time measurement and Visual Basic was able to get the numbers from it but missed some of it.· I·tried with SEROUT in PBasic but did not have any luck with it.·Any suggestion?
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
HIGH 15
PAUSE 10
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time, DEC 3]
I also tried with·'Ready and Busy'·script
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
datain VAR Byte· 'contains a 0 or a 1
PIN· CON· 16·· 'stamps dedicated serial input pin
baud· CON· $4054 '9600 baud
again:
SERIN PIN,baud, [noparse][[/noparse]datain]
IF datain = "1" THEN Ready
IF datain = "0" THEN Busy
GOTO again
Ready:
HIGH 15
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time]
GOTO again
Busy:
LOW 15
RCTIME 15, 1, time
SEROUT 15, $4054, [noparse][[/noparse]time]
GOTO again
Comments
As the data streams into the VB applications, when you read the buffer of the MSComm control, you may be getting reading several at once.· You can try putting about a 200mSec pause to give time for VB to respond and act.· What do you have receive buffer set to for triggering the OnComm event?
It gets pretty tricky to capture fast data reliably.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Electronic Systems Technologies
Southern Illinois University Carbondale
Personal Links - ·Lot of BASIC Stamp info
and
SelmaWare Solutions
StampPlot Pro Version 3 Release 4
Graphical Data Acquisition for your Micro and Imagination!
Now allows additional controls to be added, or developed
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office