Sending an ASCII 0 to the BSII
Archiver
Posts: 46,084
Hello,
I am trying to get the serial protocol to work in order to send a
bsii program to a bsii. When I send an ascii 0 (Null), I get back a
chr$(48) which is "0" instead. I am using VB 5.0. Can anyone please
help. I have tried eveything such as Chr$(0).
Thanks,
Curtis
I am trying to get the serial protocol to work in order to send a
bsii program to a bsii. When I send an ascii 0 (Null), I get back a
chr$(48) which is "0" instead. I am using VB 5.0. Can anyone please
help. I have tried eveything such as Chr$(0).
Thanks,
Curtis
Comments
Things you've implied:
1. You are trying to utilize the BS2 download protocol,
to send a pre-compiled BS2 program from a PC to the
BS2, using Visual Basic 5 on the PC.
2. I assume you're using the VB5 'Comm' control.
I've used the VB6 'Comm' control, which works better.
It sounds like most of your problems exist on the VB
side, not the BS2 side, is that correct?
3. It is not clear what platform and language you
are using to "send an ascii 0 (null)", and what
platform and language you sent it to, that is
reporting "I get back a CHR$(48)". The BS2 has
very clever formatting in its SERIN statements.
It's not clear what you are using.
Please reply with more detail. I'm sure this
is a solvable problem.
--- In basicstamps@yahoogroups.com, "cenlasoft" <cenlasoft@y...>
wrote:
> Hello,
> I am trying to get the serial protocol to work in order to send a
> bsii program to a bsii. When I send an ascii 0 (Null), I get back
a
> chr$(48) which is "0" instead. I am using VB 5.0. Can anyone
please
> help. I have tried eveything such as Chr$(0).
>
> Thanks,
> Curtis
> Wow, that's confusing.
> Things you've implied:
> 1. You are trying to utilize the BS2 download
> protocol,
> to send a pre-compiled BS2 program from a PC to the
>
> BS2, using Visual Basic 5 on the PC.
> YES
> 2. I assume you're using the VB5 'Comm' control.
> I've used the VB6 'Comm' control, which works
> better.
> It sounds like most of your problems exist on the
> VB
> side, not the BS2 side, is that correct?
> IT SEEMS VB IS THE PROBLEM
> 3. It is not clear what platform and language you
> are using to "send an ascii 0 (null)", and what
> platform and language you sent it to, that is
> reporting "I get back a CHR$(48)". The BS2 has
> very clever formatting in its SERIN statements.
> It's not clear what you are using.
> I SIMPLY USE MSCOMM1.OUTPUT = CHR$(0)
> Please reply with more detail. I'm sure this
> is a solvable problem.
> EVERYTHING WORKS TO THAT POINT WHERE I SEND AN ASCII
0 OR NULL REGARDLESS OF WHAT 0 OR NULL I GET BACK A
CHR$(48) OR "0".
THANKS FOR YOR HELP.
CURTIS
> --- In basicstamps@yahoogroups.com, "cenlasoft"
> <cenlasoft@y...>
> wrote:
> > Hello,
> > I am trying to get the serial protocol to work in
> order to send a
> > bsii program to a bsii. When I send an ascii 0
> (Null), I get back
> a
> > chr$(48) which is "0" instead. I am using VB 5.0.
> Can anyone
> please
> > help. I have tried eveything such as Chr$(0).
> >
> > Thanks,
> > Curtis
>
>
> 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/
>
>
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
a BS2 from a PC using Visual Basic, and you can't
seem to send an actual '0' (Always gets sent as
character "0".)
I've reviewed my code, and the only thing I can
see that VB might need is:
dim BufStr as String
.
.
.
BufStr = CHR(0)
MSComm1.Output = BufStr
' I think 'Output' HAS to be given a String, or a
' Byte array.
' Note also the BS2 is going to echo back EVERYTHING
' that gets sent to it.
' Note if you're looking at the value at the BS2,
' you need:
MyBytes VAR BYTE[noparse][[/noparse]4]
SERIN MyBin, MyBaud, [noparse][[/noparse]MyBytes\4] ' Don't use 'STR' modifier
** Note you can quickly convert ByteArray to string in VB by:
Sub BytesToString(InBytes() As Byte, OutString As String)
' Given a ByteArray, gives you the equivalent VB
' native Unicode String.
OutString = StrConv(InBytes, vbUnicode)
End Sub
And the other way:
Sub StringToBytes(InString As String, OutBytes() As Byte)
' "VB lets you force Unicode conversion by using the StrConv
' function." Hardcore VB5, Page 85.
' The result is a byte array equivalent of the VB5 native
' Unicode String type, converted to ASCII.
'
' Note this was put here to document this obscure use of
' the 'StrConv' function. In practice, you can cut and
' paste the following line into your code, if you want to
' remove the overhead of a function call.
' AcL 3/7/2002
OutBytes = StrConv(InString, vbFromUnicode)
End Sub
> Earlier: Sending data from a PC to a BS2