Programing assistance needed with VB6 and BS2
Hello all,
I have a programming problem that I hope one of you can help with.
First of all me experince in this area is poor. What I need to
accomplish is take a set of 4 seperate numbered pairs and send them
to Visual basic through the serial port. Now I can do this with a
single numbe okay. The trouble is sending a data stream of 4 diffrent
sets of numbers. Here is my example. I send VB from stamp 15526012
which the VB program should break out into data1=1, data2=55,
data3=260, data4 = 12. Now each data feild can have a range from 0-
999. This would be great and I could do if all the sets of numbers
equated to three digits each, but as the world works this is not the
case. Anyway I hope I'm explaining what I want to accomplish. Recap
: take a number such as 1231018020 and turn it into data1 = 123,
data2=10,data3=180,data4=20. keeping in mind that each seperate data
feild could be a number between 0 and 999. Any and all hep is
appiciated. I've been trying to get this to work for a week with no
luck.
Thanks
Shawn
I have a programming problem that I hope one of you can help with.
First of all me experince in this area is poor. What I need to
accomplish is take a set of 4 seperate numbered pairs and send them
to Visual basic through the serial port. Now I can do this with a
single numbe okay. The trouble is sending a data stream of 4 diffrent
sets of numbers. Here is my example. I send VB from stamp 15526012
which the VB program should break out into data1=1, data2=55,
data3=260, data4 = 12. Now each data feild can have a range from 0-
999. This would be great and I could do if all the sets of numbers
equated to three digits each, but as the world works this is not the
case. Anyway I hope I'm explaining what I want to accomplish. Recap
: take a number such as 1231018020 and turn it into data1 = 123,
data2=10,data3=180,data4=20. keeping in mind that each seperate data
feild could be a number between 0 and 999. Any and all hep is
appiciated. I've been trying to get this to work for a week with no
luck.
Thanks
Shawn
Comments
Not sure I completely grok your meaning. (ev1.net -- are you in Houston?)
However, a few things to think about. If your number is always between 0 and
999, why not use the dec3 modifier on SEROUT?
So:
w=71
x=1
y=22
z=450
SEROUT 16,84,[noparse][[/noparse]dec3 w, dec3 x, dec3 y, dec3 z,CR]
Would write:
071001022450
That would do what you want, right? The other choice would be to separate
them with commas or something:
SEROUT 16,84[noparse][[/noparse]dec w, ",", dec x, ","...,CR]
You can find a VB (and C++) example at
http://www.al-williams.com/stampcom.zip
Good luck!
Al Williams
AWC
* Connect a PS/2 keyboard to your Stamp
http://www.al-williams.com/awce/pak6.htm
>
Original Message
> From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=JxKt1qMmYfUk4vBKJOrqejvWSiM9j89LElyDP02DGXKOw-pob8oxSX5Xm5rGIrG_bb1tPFVKh8AY9SY]shawnusa@e...[/url
> Sent: Monday, August 06, 2001 9:01 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Programing assistance needed with VB6 and BS2
>
>
> Hello all,
>
> I have a programming problem that I hope one of you can help with.
> First of all me experince in this area is poor. What I need to
> accomplish is take a set of 4 seperate numbered pairs and send them
> to Visual basic through the serial port. Now I can do this with a
> single numbe okay. The trouble is sending a data stream of 4 diffrent
> sets of numbers. Here is my example. I send VB from stamp 15526012
> which the VB program should break out into data1=1, data2=55,
> data3=260, data4 = 12. Now each data feild can have a range from 0-
> 999. This would be great and I could do if all the sets of numbers
> equated to three digits each, but as the world works this is not the
> case. Anyway I hope I'm explaining what I want to accomplish. Recap
> : take a number such as 1231018020 and turn it into data1 = 123,
> data2=10,data3=180,data4=20. keeping in mind that each seperate data
> feild could be a number between 0 and 999. Any and all hep is
> appiciated. I've been trying to get this to work for a week with no
> luck.
>
> Thanks
> Shawn
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
VB program can receive the string, then look for the commas to parse out the
individual numbers (using the VAL function).
-- Jon Williams
-- Dallas, TX
In a message dated 8/6/01 9:03:53 AM Central Daylight Time, shawnusa@e...
writes:
> I have a programming problem that I hope one of you can help with.
> First of all me experince in this area is poor. What I need to
> accomplish is take a set of 4 seperate numbered pairs and send them
> to Visual basic through the serial port. Now I can do this with a
> single numbe okay. The trouble is sending a data stream of 4 diffrent
> sets of numbers. Here is my example. I send VB from stamp 15526012
> which the VB program should break out into data1=1, data2=55,
> data3=260, data4 = 12. Now each data feild can have a range from 0-
> 999. This would be great and I could do if all the sets of numbers
> equated to three digits each, but as the world works this is not the
> case. Anyway I hope I'm explaining what I want to accomplish. Recap
> : take a number such as 1231018020 and turn it into data1 = 123,
> data2=10,data3=180,data4=20. keeping in mind that each seperate data
> feild could be a number between 0 and 999. Any and all hep is
> appiciated. I've been trying to get this to work for a week with no
>
[noparse][[/noparse]Non-text portions of this message have been removed]
That was what I needed. I was trying to figure a way to add leading
zeros to the stream but was thinking in VB programming logic and not
BS2. Now I can use Mid(variable,x,y) and pull each one out! This may
not be the most efficent programming method, but it will work. Thanks
again!
O'h and yes, I do reside in the Houston area. Yourself?
Shawn
having difficulty in writing code to pull out the numbers from the
stream. I've tried all sorts of Len,mid and loops to pull out the
numbers from the stream and comma seperators. Yet to be able to get
that to work. However another Gentlman has given me another avenue to
add leading 0's to the numbers to help. Thanks for your input and if
you have code examples for vb to pars out numbers with comma
delimeters please share it. I have busted my chops trying to giure
out that route. Thanks again
Shawn
--- In basicstamps@y..., jonwms@a... wrote:
> You may want to have your Stamp insert a comma in between the
numbers. Your
> VB program can receive the string, then look for the commas to
parse out the
> individual numbers (using the VAL function).
>
> -- Jon Williams
> -- Dallas, TX
>
>
Dim N()
N = split(X, ",")
Mark
Original Message
From: Al Williams <alw@a...>
To: <basicstamps@yahoogroups.com>
Sent: Monday, August 06, 2001 10:08 AM
Subject: RE: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6 and BS2
> You could do something like this in VB (untested):
>
> Dim N(4)
> X = "33,1,17,101"
> SPOS = 1
> For i = 1 To 4
> CPOS = InStr(SPOS, X, ",")
> If CPOS = 0 Then
> ' error if I<>4
> If i <> 4 Then MsgBox "Error!" ' use your own code here
> N(i) = Val(Trim(Mid(X, SPOS)))
> Else
> NS = Trim(Mid(X, SPOS, CPOS - SPOS))
> N(i) = Val(NS)
> SPOS = CPOS + 1
> End If
> Next
> ' Now N(1), N(2), N(3), N(4) are what you want
>
>
> Regards,
>
> Al Williams
> AWC
> * Floating point A/D
> http://www.al-williams.com/awce/pak9.htm
>
> >
Original Message
> > From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=OZ1qiwerlOp-UMFkUD4jeNQtbE1fdtiDbFWlxjRnaTu-BwKL9Qmp42aypGVSnNBMUl8G-1tpb1iZ]shawnusa@e...[/url
> > Sent: Monday, August 06, 2001 9:27 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6 and BS2
> >
> >
> > This was my thinking as well. I being a beginner programmer, was
> > having difficulty in writing code to pull out the numbers from the
> > stream. I've tried all sorts of Len,mid and loops to pull out the
> > numbers from the stream and comma seperators. Yet to be able to get
> > that to work. However another Gentlman has given me another avenue to
> > add leading 0's to the numbers to help. Thanks for your input and if
> > you have code examples for vb to pars out numbers with comma
> > delimeters please share it. I have busted my chops trying to giure
> > out that route. Thanks again
> >
> > Shawn
> >
> > --- In basicstamps@y..., jonwms@a... wrote:
> > > You may want to have your Stamp insert a comma in between the
> > numbers. Your
> > > VB program can receive the string, then look for the commas to
> > parse out the
> > > individual numbers (using the VAL function).
> > >
> > > -- Jon Williams
> > > -- Dallas, TX
> > >
> > >
> >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> > Subject and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Dim N(4)
X = "33,1,17,101"
SPOS = 1
For i = 1 To 4
CPOS = InStr(SPOS, X, ",")
If CPOS = 0 Then
' error if I<>4
If i <> 4 Then MsgBox "Error!" ' use your own code here
N(i) = Val(Trim(Mid(X, SPOS)))
Else
NS = Trim(Mid(X, SPOS, CPOS - SPOS))
N(i) = Val(NS)
SPOS = CPOS + 1
End If
Next
' Now N(1), N(2), N(3), N(4) are what you want
Regards,
Al Williams
AWC
* Floating point A/D
http://www.al-williams.com/awce/pak9.htm
>
Original Message
> From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=m-YRIy3ZQ5h8tuFMXi5in5DDJKAiovASk6wThhQ-VmtH8SZGjdK3eVsR6oS8y0U_8fTqlZTM]shawnusa@e...[/url
> Sent: Monday, August 06, 2001 9:27 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6 and BS2
>
>
> This was my thinking as well. I being a beginner programmer, was
> having difficulty in writing code to pull out the numbers from the
> stream. I've tried all sorts of Len,mid and loops to pull out the
> numbers from the stream and comma seperators. Yet to be able to get
> that to work. However another Gentlman has given me another avenue to
> add leading 0's to the numbers to help. Thanks for your input and if
> you have code examples for vb to pars out numbers with comma
> delimeters please share it. I have busted my chops trying to giure
> out that route. Thanks again
>
> Shawn
>
> --- In basicstamps@y..., jonwms@a... wrote:
> > You may want to have your Stamp insert a comma in between the
> numbers. Your
> > VB program can receive the string, then look for the commas to
> parse out the
> > individual numbers (using the VAL function).
> >
> > -- Jon Williams
> > -- Dallas, TX
> >
> >
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
C++, Java, and ASM. I even have to watch to not write X$ all the time!
Al Williams
AWC
* Measure 8 pulses at once
http://www.al-williams.com/awce/pak7.htm
>
Original Message
> From: Mark Schmidt [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=NNwzkLSNZZrr0O8b8mlVjAmSgljCXGrAoU6mrGcBZxnQq7TuGdFODsruvhJnEhrtpU5_Q-d__jm2WzI]mschmidt@g...[/url
> Sent: Monday, August 06, 2001 10:07 AM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6 and
> BS2
>
>
> or
>
> Dim N()
> N = split(X, ",")
>
> Mark
>
>
Original Message
> From: Al Williams <alw@a...>
> To: <basicstamps@yahoogroups.com>
> Sent: Monday, August 06, 2001 10:08 AM
> Subject: RE: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with
> VB6 and BS2
> >
You are in luck... VB6 makes this a snap with the use of the "Split"
function. Try the code below on for size...
Dim sBuffer As String
Dim sData() As String
Dim x As Long
' \\ This is your data buffer
sBuffer = "1,21,321,1,4555,8,7,321,456,8754,21213"
' \\ Parse the data
sData() = Split(sBuffer, ",")
' \\ Display the data in Debug Window
For x = 0 To UBound(sData)
Debug.Print sData(x)
Next x
The "Split" function fills an array with the data between the specified
delimiter. Easy (and pretty quick)..!
Hope this helps,
Jared Hoylman
VB Overdrive
http://vboverdrive.extreme-vb.net/main.php3
Original Message
From: <shawnusa@e...>
To: <basicstamps@yahoogroups.com>
Sent: Monday, August 06, 2001 7:27 AM
Subject: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6 and BS2
> This was my thinking as well. I being a beginner programmer, was
> having difficulty in writing code to pull out the numbers from the
> stream. I've tried all sorts of Len,mid and loops to pull out the
> numbers from the stream and comma seperators. Yet to be able to get
> that to work. However another Gentlman has given me another avenue to
> add leading 0's to the numbers to help. Thanks for your input and if
> you have code examples for vb to pars out numbers with comma
> delimeters please share it. I have busted my chops trying to giure
> out that route. Thanks again
>
> Shawn
>
> --- In basicstamps@y..., jonwms@a... wrote:
> > You may want to have your Stamp insert a comma in between the
> numbers. Your
> > VB program can receive the string, then look for the commas to
> parse out the
> > individual numbers (using the VAL function).
> >
> > -- Jon Williams
> > -- Dallas, TX
> >
> >
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
creates a delimited list.
Join(Array, Delimiter)
dim MyString as string
MyArray(0) = 1
MyArray(1) = 89
MyArray(2) = 75
MyString = Join(Array, ",")
MyString = "1,89,75"
Using split and join allows you to work with delimited list using
arrays (easier coding) then dumb the completed array back out as a
delimited string.
Tim
--- In basicstamps@y..., "Jared Hoylman" <electrolinx@y...> wrote:
> Shawn,
>
> You are in luck... VB6 makes this a snap with the use of the "Split"
> function. Try the code below on for size...
>
>
> Dim sBuffer As String
> Dim sData() As String
> Dim x As Long
>
> ' \\ This is your data buffer
> sBuffer = "1,21,321,1,4555,8,7,321,456,8754,21213"
>
> ' \\ Parse the data
> sData() = Split(sBuffer, ",")
>
> ' \\ Display the data in Debug Window
> For x = 0 To UBound(sData)
> Debug.Print sData(x)
> Next x
>
> The "Split" function fills an array with the data between the
specified
> delimiter. Easy (and pretty quick)..!
>
> Hope this helps,
>
> Jared Hoylman
> VB Overdrive
> http://vboverdrive.extreme-vb.net/main.php3
>
>
>
>
>
>
Original Message
> From: <shawnusa@e...>
> To: <basicstamps@y...>
> Sent: Monday, August 06, 2001 7:27 AM
> Subject: [noparse][[/noparse]basicstamps] Re: Programing assistance needed with VB6
and BS2
>
>
> > This was my thinking as well. I being a beginner programmer, was
> > having difficulty in writing code to pull out the numbers from the
> > stream. I've tried all sorts of Len,mid and loops to pull out the
> > numbers from the stream and comma seperators. Yet to be able to
get
> > that to work. However another Gentlman has given me another
avenue to
> > add leading 0's to the numbers to help. Thanks for your input and
if
> > you have code examples for vb to pars out numbers with comma
> > delimeters please share it. I have busted my chops trying to giure
> > out that route. Thanks again
> >
> > Shawn
> >
> > --- In basicstamps@y..., jonwms@a... wrote:
> > > You may want to have your Stamp insert a comma in between the
> > numbers. Your
> > > VB program can receive the string, then look for the commas to
> > parse out the
> > > individual numbers (using the VAL function).
> > >
> > > -- Jon Williams
> > > -- Dallas, TX
> > >
> > >
> >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@y...
> > from the same email address that you subscribed. Text in the
Subject and
> Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >