Sending Data from QBasic to BS2sx
Archiver
Posts: 46,084
hi, I know how to read in data from a bs2sx, (open the com 1 as an
input, then use the input$() command..etc.), but I'm trying to figure
out how to send text or numbers from QBasic to the basic stamp. I
tried opening com1 as an ouput (#1) and then tried to print
#1, "hi" , but the stamp isn't seeing the text that I send. Any help
would be greatly appreciated. Thanks!
input, then use the input$() command..etc.), but I'm trying to figure
out how to send text or numbers from QBasic to the basic stamp. I
tried opening com1 as an ouput (#1) and then tried to print
#1, "hi" , but the stamp isn't seeing the text that I send. Any help
would be greatly appreciated. Thanks!
Comments
' when ALT+q is pressed.
' Open communications (1200 baud, no parity, 8-bit data,
' 1 stop bit, 256-byte input buffer):
OPEN "COM1:1200,N,8,1" FOR RANDOM AS #1 LEN = 256
DO ' Main communications loop.
KeyInput$ = INKEY$ ' Check the keyboard.
IF KeyInput$ = Quit$ THEN ' Exit the loop if the user
EXIT DO ' pressed ALT+q.
ELSEIF KeyInput$ <> "" THEN ' Otherwise, if the user has
PRINT #1, KeyInput$; ' pressed a key, send the
END IF ' character typed to the modem.
' could also be - PRINT #1, "hello jack";
' notice semicolon after statement? prevents automatically sending ' linefeed
and return
' Check the modem. If characters are waiting (EOF(1) is
' true), get them and print them to the screen:
IF NOT EOF(1) THEN
' LOC(1) gives the number of characters waiting:
ModemInput$ = INPUT$(LOC(1), #1) ' gets all of input buffer at one
' time
PRINT ModemInput$; ' then print.
END IF
LOOP
>
> From: "Sam" <hard-on@t...>
> Date: 2003/07/23 Wed PM 02:14:11 EDT
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Sending Data from QBasic to BS2sx
>
> hi, I know how to read in data from a bs2sx, (open the com 1 as an
> input, then use the input$() command..etc.), but I'm trying to figure
> out how to send text or numbers from QBasic to the basic stamp. I
> tried opening com1 as an ouput (#1) and then tried to print
> #1, "hi" , but the stamp isn't seeing the text that I send. Any help
> would be greatly appreciated. Thanks!
>
>
> 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 BS2 'ATN' reset line) if you're using a
non-parallax BS2 carrier board.
Connect for programming, disconnect for use.
--- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> hi, I know how to read in data from a bs2sx, (open the com 1 as an
> input, then use the input$() command..etc.), but I'm trying to
figure
> out how to send text or numbers from QBasic to the basic stamp. I
> tried opening com1 as an ouput (#1) and then tried to print
> #1, "hi" , but the stamp isn't seeing the text that I send. Any
help
> would be greatly appreciated. Thanks!
between, just as the parallax carrier boards do.
--- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
wrote:
> You may also have to disconnect pin 4 (DTR, sent
> to BS2 'ATN' reset line) if you're using a
> non-parallax BS2 carrier board.
>
> Connect for programming, disconnect for use.
>
> --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> > hi, I know how to read in data from a bs2sx, (open the com 1 as
an
> > input, then use the input$() command..etc.), but I'm trying to
> figure
> > out how to send text or numbers from QBasic to the basic stamp. I
> > tried opening com1 as an ouput (#1) and then tried to print
> > #1, "hi" , but the stamp isn't seeing the text that I send. Any
> help
> > would be greatly appreciated. Thanks!
Still, it sounds like this is not the problem...
--- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> I have pin#4 connected to the ATN pin on the bs with a 0.1uf cap in
> between, just as the parallax carrier boards do.
>
> --- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
> wrote:
> > You may also have to disconnect pin 4 (DTR, sent
> > to BS2 'ATN' reset line) if you're using a
> > non-parallax BS2 carrier board.
> >
> > Connect for programming, disconnect for use.
> >
> > --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> > > hi, I know how to read in data from a bs2sx, (open the com 1 as
> an
> > > input, then use the input$() command..etc.), but I'm trying to
> > figure
> > > out how to send text or numbers from QBasic to the basic stamp.
I
> > > tried opening com1 as an ouput (#1) and then tried to print
> > > #1, "hi" , but the stamp isn't seeing the text that I send. Any
> > help
> > > would be greatly appreciated. Thanks!
OPEN "com1:9600,n,8,1,CD0,CS0,DS0,RS" FOR OUTPUT AS #2
loop:
PRINT #2, "hi";
goto loop
'===================
and this is the code on the stamp:
start:
x var byte
serin 16,16624,[noparse][[/noparse]x]
debug "X: ", x
goto start
First I download the code to the stamp, then I start the QBasic code
(on the same computer from which I am monitoring stamp debug
feedback). When I look at the debugs from the stamp, nothing shows up
(it's apparently not seeing anything on the serial input line). I'm
using the DOS based bs2sx programmer.
--- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
wrote:
> Including the .1 uF capacitor to ground?
> Still, it sounds like this is not the problem...
>
> --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> > I have pin#4 connected to the ATN pin on the bs with a 0.1uf cap
in
> > between, just as the parallax carrier boards do.
> >
> > --- In basicstamps@yahoogroups.com, "Allan Lane"
<allan.lane@h...>
> > wrote:
> > > You may also have to disconnect pin 4 (DTR, sent
> > > to BS2 'ATN' reset line) if you're using a
> > > non-parallax BS2 carrier board.
> > >
> > > Connect for programming, disconnect for use.
> > >
> > > --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> > > > hi, I know how to read in data from a bs2sx, (open the com 1
as
> > an
> > > > input, then use the input$() command..etc.), but I'm trying
to
> > > figure
> > > > out how to send text or numbers from QBasic to the basic
stamp.
> I
> > > > tried opening com1 as an ouput (#1) and then tried to print
> > > > #1, "hi" , but the stamp isn't seeing the text that I send.
Any
> > > help
> > > > would be greatly appreciated. Thanks!
hard-on@t... writes:
> First I download the code to the stamp, then I start the QBasic code
> (on the same computer from which I am monitoring stamp debug
> feedback). When I look at the debugs from the stamp, nothing shows up
> (it's apparently not seeing anything on the serial input line). I'm
> using the DOS based bs2sx programmer.
>
I think the reason you're not seeing anything on the debug screen is that the
debug screen has to be up and running to receive anything. When you transmit
from QBasic, the debug screen is not running, the QBasic screen is. So when
you got to debug there is nothing to receive - QBasic has already sent it
before you go there. I can't think of any way to see what happens on the Stamp
except - maybe put a long pause in your Stamp code before the debug command to
give you time to switch screens.
Sid Weaver
W4EKQ
Port Richey, FL
[noparse][[/noparse]Non-text portions of this message have been removed]
> In a message dated 7/23/2003 5:23:23 PM Eastern Standard Time,
> hard-on@t... writes:
>
>
> > First I download the code to the stamp, then I start the QBasic
code
> > (on the same computer from which I am monitoring stamp debug
> > feedback). When I look at the debugs from the stamp, nothing
shows up
> > (it's apparently not seeing anything on the serial input line).
I'm
> > using the DOS based bs2sx programmer.
> >
>
> I think the reason you're not seeing anything on the debug screen
is that the
> debug screen has to be up and running to receive anything. When
you transmit
> from QBasic, the debug screen is not running, the QBasic screen
is. So when
> you got to debug there is nothing to receive - QBasic has already
sent it
> before you go there. I can't think of any way to see what happens
on the Stamp
> except - maybe put a long pause in your Stamp code before the debug
command to
> give you time to switch screens.
>
> Sid Weaver
> W4EKQ
> Port Richey, FL
no, I'm alt-tab'ing between screens. So after I start the Qbasic
program running (endless loop), I switch to the BS2sx programmer
screen and I can see the bs2sx debug screen, and I've made sure
that's it's active by reseting the stamp and seeing pre-serin-loop
debugs (which are not in the code I posted) re-apear.
hard-on@t... writes:
> no, I'm alt-tab'ing between screens. So after I start the Qbasic
> program running (endless loop), I switch to the BS2sx programmer
> screen and I can see the bs2sx debug screen, and I've made sure
> that's it's active by reseting the stamp and seeing pre-serin-loop
> debugs (which are not in the code I posted) re-apear.
>
>
OK - there is one other possibility. I had this problem using a FlashLab77
with Hyperterminal. On the FlashLab I had to open up the RST line, which I
think is the same as the ATN line on Stamp. Hyperterminal was holding the RST
line low so FlashLab couldn't receive anything. I think I would try opening the
ATN line to see if that helps. One thing you could try before you do that is
turn off the Stamp, start QBasic, switch to the debug screen and then turn
the Stamp on. If you don't see your "startup debugs" then that is the problem.
If you do see them then it must be something else.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
'owns' the COM1 port.
When you're running the 'DEBUG' window,
IT owns COM1 on the PC. When you try to
open the COM1 port from QBasic, I suspect
the open fails, because you've already
got the port open for DEBUG. So you
can't 'talk' on COM1 from QBasic, and
then 'listen' on COM1 on the DEBUG
window.
You might try separate COM ports.
You might also try putting a:
SEROUT 16, 16624, [noparse][[/noparse]"Hello"]
in the BS2,
and then seeing if QBasic can get this.
The BS2 should pend forever waiting for
a byte from QBasic. Having received the
byte, it should send back the "Hello"
message above.
--- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> this is the code I'm using on my computer to send info to the stamp:
> OPEN "com1:9600,n,8,1,CD0,CS0,DS0,RS" FOR OUTPUT AS #2
> loop:
> PRINT #2, "hi";
> goto loop
> '===================
> and this is the code on the stamp:
> start:
> x var byte
> serin 16,16624,[noparse][[/noparse]x]
> debug "X: ", x
> goto start
>
> First I download the code to the stamp, then I start the QBasic
code
> (on the same computer from which I am monitoring stamp debug
> feedback). When I look at the debugs from the stamp, nothing shows
up
> (it's apparently not seeing anything on the serial input line). I'm
> using the DOS based bs2sx programmer.
>
>
>
>
> --- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
> wrote:
> > Including the .1 uF capacitor to ground?
> > Still, it sounds like this is not the problem...
> >
> > --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...> wrote:
> > > I have pin#4 connected to the ATN pin on the bs with a 0.1uf
cap
> in
> > > between, just as the parallax carrier boards do.
> > >
> > > --- In basicstamps@yahoogroups.com, "Allan Lane"
> <allan.lane@h...>
> > > wrote:
> > > > You may also have to disconnect pin 4 (DTR, sent
> > > > to BS2 'ATN' reset line) if you're using a
> > > > non-parallax BS2 carrier board.
> > > >
> > > > Connect for programming, disconnect for use.
> > > >
> > > > --- In basicstamps@yahoogroups.com, "Sam" <hard-on@t...>
wrote:
> > > > > hi, I know how to read in data from a bs2sx, (open the com
1
> as
> > > an
> > > > > input, then use the input$() command..etc.), but I'm trying
> to
> > > > figure
> > > > > out how to send text or numbers from QBasic to the basic
> stamp.
> > I
> > > > > tried opening com1 as an ouput (#1) and then tried to print
> > > > > #1, "hi" , but the stamp isn't seeing the text that I send.
> Any
> > > > help
> > > > > would be greatly appreciated. Thanks!