BS2 and Visual Bacic
Archiver
Posts: 46,084
Hi, I have been trying to get Visual Basic to receive a stream
like say a temperature reading off the BS2, using a ds/1620. I have a
Board Of Education, so I believe it is set up for PC serial communication
like in the Basic Stamp Manual (pg. 300 something). I set up the bread B.
to successfully send temperature to Paralax(?) s/w on the debug window
with intervals of one second using the debug command.
debug screen output looked like
deg=22
deg=23
.
.
So then I thought I could maybe get the same on VB in a text box,
using serout command on the BS2 side and mscomm command on the VB side.
However the way I got something set in the code is most likely wrong
because it's not working. I get a successful compile on both the P-Basic
and the VB. I believe I'm using the commands correctly but nothing displays
on my vb text window.
If someone is willing I would like to know step-by-step how to
receive the same as the Paralax(?) debug window in a VB text box.
I am just a beginner at VB so when people skip steps I get lost.
Thank you San [noparse]:)[/noparse]
P.S You may say this is a silly question I will not get upset...[noparse]:)[/noparse]
like say a temperature reading off the BS2, using a ds/1620. I have a
Board Of Education, so I believe it is set up for PC serial communication
like in the Basic Stamp Manual (pg. 300 something). I set up the bread B.
to successfully send temperature to Paralax(?) s/w on the debug window
with intervals of one second using the debug command.
debug screen output looked like
deg=22
deg=23
.
.
So then I thought I could maybe get the same on VB in a text box,
using serout command on the BS2 side and mscomm command on the VB side.
However the way I got something set in the code is most likely wrong
because it's not working. I get a successful compile on both the P-Basic
and the VB. I believe I'm using the commands correctly but nothing displays
on my vb text window.
If someone is willing I would like to know step-by-step how to
receive the same as the Paralax(?) debug window in a VB text box.
I am just a beginner at VB so when people skip steps I get lost.
Thank you San [noparse]:)[/noparse]
P.S You may say this is a silly question I will not get upset...[noparse]:)[/noparse]
Comments
with VB and C++ source code (you can use either).
Regards,
Al Williams
AWC
* Floating point math for the Stamp, PIC, SX, or any microcontroller:
http://www.al-williams.com/awce/pak1.htm
>
Original Message
> From: SAN CHRISTOPHER POISSON [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wgg_x7TI0THTDiYX0cBOd5jNAQVo2R2XhtgSeTw-2iFOcvz-296p3aFR7z_reAuY4m4G1w]sp71@s...[/url
> Sent: Wednesday, March 07, 2001 10:44 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] BS2 and Visual Bacic
>
>
> Hi, I have been trying to get Visual Basic to receive a stream
> like say a temperature reading off the BS2, using a ds/1620. I have a
> Board Of Education, so I believe it is set up for PC serial communication
> like in the Basic Stamp Manual (pg. 300 something). I set up the bread B.
> to successfully send temperature to Paralax(?) s/w on the debug window
> with intervals of one second using the debug command.
>
> debug screen output looked like
>
> deg=22
> deg=23
> .
> .
>
> So then I thought I could maybe get the same on VB in a text box,
> using serout command on the BS2 side and mscomm command on the VB side.
> However the way I got something set in the code is most likely wrong
> because it's not working. I get a successful compile on both the P-Basic
> and the VB. I believe I'm using the commands correctly but
> nothing displays
> on my vb text window.
> If someone is willing I would like to know step-by-step how to
> receive the same as the Paralax(?) debug window in a VB text box.
> I am just a beginner at VB so when people skip steps I get lost.
>
> Thank you San [noparse]:)[/noparse]
>
> P.S You may say this is a silly question I will not get upset...[noparse]:)[/noparse]
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
Check out the following links
http://www.rentron.com/VisualBasic.htm·
http://vboverdrive.extreme-vb.net/examples.php3
they will provide you with a beginners guide to using VB and Basic Stamps written by Jared Hoylman. There aimed at beginners and will have you communicating with VB and the stamp in no time.
Also check out Shaun Wilsons webpage at http://www.geocities.com/SiliconValley/Orchard/6633/projects.html·he has done something similar and provides code examples for both VB5 and the BS2.
There all great sites and well worth a look.
Hope this helps.
Cheers John
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
talk to a serial device.
Original Message
> Hi, I have been trying to get Visual Basic to receive a stream
> like say a temperature reading off the BS2, using a ds/1620. I have a
> Board Of Education, so I believe it is set up for PC serial communication
> like in the Basic Stamp Manual (pg. 300 something). I set up the bread B.
> to successfully send temperature to Paralax(?) s/w on the debug window
> with intervals of one second using the debug command.
writes:
using serout command on the BS2 side and mscomm command on the VB side.
However the way I got something set in the code is most likely wrong
because it's not working. I get a successful compile on both the P-Basic
and the VB. I believe I'm using the commands correctly but nothing displays
on my vb text window.
···If someone is willing I would like to know step-by-step how to
receive the same as the Paralax(?) debug window in a VB text box.
···I am just a beginner at VB so when people skip steps I get lost.
The MSComm control is like a spoiled girl in a pretty dress: it looks good
but is very hard to please unless you're perfect with all the details.
Go to this URL: http://members.aol.com/jonwms/stamps
Download these files:
·* EEMOVER.ZIP
·* STAMPNET1.ZIP
·* STAMPNET2.ZIP
All of them contain VB projects that talk to the Stamp through the
programming port (pin 16 for SERIN/SEROUT). ·One warning: If you send
information from VB to the Stamp (on the programming port), it will be echoed
back by the Stamp's hardware. ·This means you need to filter your own command
out of the input buffer.
Get Jan Axelson's book "Serial Port Complete" ·(from www.lvr.com). ·It's the
best available reference for PC-to-Stamp comm via VB.
-- Jon Williams
-- Dallas, TX[/font]
private sub mscomm1.oncomm()
textstring = textstring + mscomm1.input
textbox1.text = mscomm1.input
end sub
there are also some settings such as mscomm1.inputlen etc which affect the comms settings. As said, msdn or your vb help will give you an easy example, or go to the online help.
Chris
Original Message
From: jonwms@aol.com
To: basicstamps@yahoogroups.com
Sent: Thursday, March 08, 2001 9:19 PM
Subject: Re: [noparse][[/noparse]basicstamps] BS2 and Visual Bacic
[font=arial,helvetica]In a message dated 3/7/01 10:45:31 PM Central Standard Time, sp71@sfsu.edu
writes:
using serout command on the BS2 side and mscomm command on the VB side.
However the way I got something set in the code is most likely wrong
because it's not working. I get a successful compile on both the P-Basic
and the VB. I believe I'm using the commands correctly but nothing displays
on my vb text window.
···If someone is willing I would like to know step-by-step how to
receive the same as the Paralax(?) debug window in a VB text box.
···I am just a beginner at VB so when people skip steps I get lost.
The MSComm control is like a spoiled girl in a pretty dress: it looks good
but is very hard to please unless you're perfect with all the details.
Go to this URL: http://members.aol.com/jonwms/stamps
Download these files:
·* EEMOVER.ZIP
·* STAMPNET1.ZIP
·* STAMPNET2.ZIP
All of them contain VB projects that talk to the Stamp through the
programming port (pin 16 for SERIN/SEROUT). ·One warning: If you send
information from VB to the Stamp (on the programming port), it will be echoed
back by the Stamp's hardware. ·This means you need to filter your own command
out of the input buffer.
Get Jan Axelson's book "Serial Port Complete" ·(from www.lvr.com). ·It's the
best available reference for PC-to-Stamp comm via VB.
-- Jon Williams
-- Dallas, TX
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[/font]
complete code as it accesses a proprietary piece of equipment, but here are
some details:
baud_rate$ is a string with 1200, 2400, etc...
port_num is an integer with the desired serial port number
input$ is a string which is used to store incoming characters from the
serial port
'**** code begins here ***
'*** Set the port to the user-selected baud rate, no parity, 8 data bits,
1 stop bit
frmObjects.MSComm1.Settings = baud_rate$ & ",n,8,1"
'*** Set com port to the user-selected port
frmObjects.MSComm1.CommPort = port_num
'*** Open the com port
frmObjects.MSComm1.PortOpen = True
'*** Flush com port input buffer
frmObjects.MSComm1.InBufferCount = 0
'*** Flush com port output buffer
frmObjects.MSComm1.OutBufferCount = 0
'*** set iteration counter
do_ctr = 1
'*** Monitor the port
DoEvents
'*** If data found in com buffer, then get it
If frmObjects.MSComm1.InBufferCount Then
'*** Build data string from com port data
input$ = input$ + frmObjects.MSComm1.Input
End If
'*** increment the loop counter
do_ctr = do_ctr + 1
Loop
Somewhere within the loop you look for / parse the desired data and
periodically clear the input$ variable as needed.
This was swiped from the Mabry book on Serial Communication for VB
Original Message
You need to use the mscomm.oncomm method. Your vb help or the msdn help has
some very good basic examples for this. You should also put the data into a
string which appends to itself, something like this (very roughly)
private sub mscomm1.oncomm()
textstring = textstring + mscomm1.input
textbox1.text = mscomm1.input
end sub
there are also some settings such as mscomm1.inputlen etc which affect the
comms settings. As said, msdn or your vb help will give you an easy example,
or go to the online help.
Chris
Original Message
So then I thought I could maybe get the same on VB in a text box,
using serout command on the BS2 side and mscomm command on the VB side.
However the way I got something set in the code is most likely wrong
because it's not working. I get a successful compile on both the P-Basic
and the VB. I believe I'm using the commands correctly but nothing
displays
on my vb text window.
If someone is willing I would like to know step-by-step how to
receive the same as the Paralax(?) debug window in a VB text box.
I am just a beginner at VB so when people skip steps I get lost.
The MSComm control is like a spoiled girl in a pretty dress: it looks good
but is very hard to please unless you're perfect with all the details.
walked me right thru all I needed to achieve sucessful serial comms with a
BS2.
Regards,
Randy [/font]
To all whom answered my questions !!!!
You made things nice to learn!!!
San [noparse]:)[/noparse]