opening serial port?
Archiver
Posts: 46,084
I think the concept you need to grasp is that the Stamp will run
whatever program is loaded whether or not the editor/loader/debugger
program is running on the PC and whether or not the programming cable
is in place. Once you have downloaded your program to the BS2, it's
resident in the Stamp's EEPROM and runs as long as power is applied
and nothing interrupts it.
Further, your Stamp will transmit DEBUG msgs whether or not there's
a PC attached or looking at the msgs. Your c++ program could also
accept and do whatever with the Stamp's DEBUG output (9600,n,8,1).
There are a few more things to think about, such as any data your
application program sends to the Stamp's RX pin (physical pin 2,
normally used by the programming cable) is reflected back to the
sender via physical pin 3 (Stamp's TX). Plus you have to make sure
your application program on the PC doesn't assert DTR or you must
break the DTR connection when the application program is running,
otherwise the Stamp program is interrupted and stops dead in its
tracks. See the manual for all the exhilarating details.
Steve
On 15 Jan 01 at 22:59, Mike Errecart wrote:
> Hi,
> I'm a new user of BS2. I've got a program, written in c++, that
> opens the serial port and sends data to the stamp chip. however, I
> can't seem to get both to run - if I download the program to the
> chip and run the debugger, the c++ program won't run, because the
> serial port is in use. if I run the c++ program first, then I can't
> download the program to the chip, for the same reason. is there
> something I'm missing here? thanks, mike
>
>
>
>
>
whatever program is loaded whether or not the editor/loader/debugger
program is running on the PC and whether or not the programming cable
is in place. Once you have downloaded your program to the BS2, it's
resident in the Stamp's EEPROM and runs as long as power is applied
and nothing interrupts it.
Further, your Stamp will transmit DEBUG msgs whether or not there's
a PC attached or looking at the msgs. Your c++ program could also
accept and do whatever with the Stamp's DEBUG output (9600,n,8,1).
There are a few more things to think about, such as any data your
application program sends to the Stamp's RX pin (physical pin 2,
normally used by the programming cable) is reflected back to the
sender via physical pin 3 (Stamp's TX). Plus you have to make sure
your application program on the PC doesn't assert DTR or you must
break the DTR connection when the application program is running,
otherwise the Stamp program is interrupted and stops dead in its
tracks. See the manual for all the exhilarating details.
Steve
On 15 Jan 01 at 22:59, Mike Errecart wrote:
> Hi,
> I'm a new user of BS2. I've got a program, written in c++, that
> opens the serial port and sends data to the stamp chip. however, I
> can't seem to get both to run - if I download the program to the
> chip and run the debugger, the c++ program won't run, because the
> serial port is in use. if I run the c++ program first, then I can't
> download the program to the chip, for the same reason. is there
> something I'm missing here? thanks, mike
>
>
>
>
>
Comments
I'm a new user of BS2. I've got a program, written in c++, that
opens the serial port and sends data to the stamp chip. however, I
can't seem to get both to run - if I download the program to the chip
and run the debugger, the c++ program won't run, because the serial
port is in use. if I run the c++ program first, then I can't
download the program to the chip, for the same reason. is there
something I'm missing here?
thanks,
mike
correct?
You should not use debug use serout and serin instead
there are three wires needed from serial port of the PC to stamp
serin, serout and ground
then your C program will work using debug the stamp software is taking
control of the serial line
Mike Errecart wrote:
>
> Hi,
> I'm a new user of BS2. I've got a program, written in c++, that
> opens the serial port and sends data to the stamp chip. however, I
> can't seem to get both to run - if I download the program to the chip
> and run the debugger, the c++ program won't run, because the serial
> port is in use. if I run the c++ program first, then I can't
> download the program to the chip, for the same reason. is there
> something I'm missing here?
> thanks,
> mike
>>Hi,
I'm a new user of BS2. I've got a program, written in
c++, that
opens the serial port and sends data to the stamp
chip. however, I
can't seem to get both to run - if I download the
program to the chip
and run the debugger, the c++ program won't run,
because the serial
port is in use. if I run the c++ program first, then
I can't
download the program to the chip, for the same reason.
is there
something I'm missing here?
thanks,
mike<<
Mike,
Download the program to the stamp. Close the Stamp
debugger. Then program the other device with the
serial port. The (if you need to) re-open the parallax
debugger. Should be fine.
Note that you need to disconnect the (I think) RTS pin
when you're communicating with hyperterm or whatever
*(anything other than the parallax debugger). Or hold
the RTS pin low. Otherwise the stamp will not work.
Mike
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
that matter would be even better since it would be sort of portable between
Win32 or Linux) program to download the code to the BS2/BSX and then run a
data acquistion/submission program.
Of course I would use the aforementioned scheme for debugging, but after I
am sure the BSX program is working, I'd like the production version to be
able to download the code and run in one step instead of having to use the
Parallax tools.
Why? So the program could vary the parameters in the BSX and re-start the
acquisition/submission on the fly if necessary. Sure the program on the BSX
could receive params and change them, but changing the code that is
downloaded is probably simpler and is definitely more flexible.
I figure Parallax keeps the protcol for things like the SXKey and the
Debugger proprietary, but what about simple downloads and uploads? Anyone
have a source on the protocol for downloading/uploading to the BSX family
(code examples would be even better).
Lastly, I am new to the BSX so I apologize in advance if the answer is
somewhere in the Parallax docs or other obvious place I have missed and my
question irritates anyone.
Original Message
From: Mike Turco [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=L4fU2WsnreWZyjso3g04DQ6STIkporPHMgxQv4EUql1O1GZ3AA73b6XPuxEFrTie6D1IPfvmWo3g7xJ5-80]miketurco@y...[/url
Sent: Monday, January 15, 2001 11:02 PM
To: basicstamps@egroups.com
Subject: [noparse][[/noparse]basicstamps] Re: opening serial port?
Subject:
>>Hi,
I'm a new user of BS2. I've got a program, written in
c++, that
opens the serial port and sends data to the stamp
chip. however, I
can't seem to get both to run - if I download the
program to the chip
and run the debugger, the c++ program won't run,
because the serial
port is in use. if I run the c++ program first, then
I can't
download the program to the chip, for the same reason.
is there
something I'm missing here?
thanks,
mike<<
Mike,
Download the program to the stamp. Close the Stamp
debugger. Then program the other device with the
serial port. The (if you need to) re-open the parallax
debugger. Should be fine.
Note that you need to disconnect the (I think) RTS pin
when you're communicating with hyperterm or whatever
*(anything other than the parallax debugger). Or hold
the RTS pin low. Otherwise the stamp will not work.
Mike
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
When I'm working on Stamp projects, I approach that situation in one of two
ways.
(1) What I usually do is use my Debug Terminal to verify that the Stamp is
behaving the way it is supposed to. Then, I close the Debug Terminal and
run the other application that takes control of the serial port.
Note: You can use the Debug Terminal for 2-way communication with the BASIC
Stamp 2 (and the 2e, 2sx, and 2P). There is a narrow upper windowpane in
the Debug Terminal that you can use to send messages to the BASIC Stamp 2.
The BASIC Stamp 2 can be programmed to receive these messages using the
serin command (9600 bps, 8 data bits, one stop bit, no parity, inverted).
(2) Sometimes it's useful to view communication on one serial port using the
Debug Terminal while communicating with the BASIC Stamp on a second serial
port. The serin and serout commands in the BASIC Stamp Manual show sample
code and circuits for connecting the BASIC Stamp to any I/O pin.
Andy
E-Mail...........alindsay@p...
Parallax, Inc. home page....................www.parallaxinc.com
BASIC Stamp Educational Resources...........www.stampsinclass.com
SX Microcontroller University Resources.....www.sxtech.com
Original Message
From: Mike Turco [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cbfKb4jj20f5J8I2vnTFDDFLU7ib9LeiyJ6W5jHKPwUnqMJ2FEI3ryX2NMnVV9bh_gzXCUUIhUoLPxcC19M]miketurco@y...[/url
Sent: Monday, January 15, 2001 11:02 PM
To: basicstamps@egroups.com
Subject: [noparse][[/noparse]basicstamps] Re: opening serial port?
Subject:
>>Hi,
I'm a new user of BS2. I've got a program, written in
c++, that
opens the serial port and sends data to the stamp
chip. however, I
can't seem to get both to run - if I download the
program to the chip
and run the debugger, the c++ program won't run,
because the serial
port is in use. if I run the c++ program first, then
I can't
download the program to the chip, for the same reason.
is there
something I'm missing here?
thanks,
mike<<
Mike,
Download the program to the stamp. Close the Stamp
debugger. Then program the other device with the
serial port. The (if you need to) re-open the parallax
debugger. Should be fine.
Note that you need to disconnect the (I think) RTS pin
when you're communicating with hyperterm or whatever
*(anything other than the parallax debugger). Or hold
the RTS pin low. Otherwise the stamp will not work.
Mike
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
writes:
<< basicstamps@egroups.com >>
UNSUBSCRIBE.....NOW.....
dano@b... writes:
<<
Reply-to: basicstamps@egroups.com >>
UNSUBSCRIBE.....NOW........
g.
On Tue, 16 Jan 2001 shirmel@a... wrote:
> In a message dated 1/16/01 4:40:40 PM Eastern Standard Time, shirmel@a...
> writes:
>
> << basicstamps@egroups.com >>
> UNSUBSCRIBE.....NOW.....
>
>
>
>
upper windowpane in the Debug
Terminal your able to
communicate with the BS2. What
do you have to use for the pin
number when your not really
connecting to a pin when your
using the Debug Terminal.
SERIN (??),N9600
Original Message
From: "Andy Lindsay"
<alindsay@p...>
To: <basicstamps@egroups.com>
Sent: Tuesday, January 16,
2001 12:03 PM
Subject: RE: [noparse][[/noparse]basicstamps] Re:
opening serial port?
> Mike,
>
> When I'm working on Stamp
projects, I approach that
situation in one of two
> ways.
>
> (1) What I usually do is use
my Debug Terminal to verify
that the Stamp is
> behaving the way it is
supposed to. Then, I close
the Debug Terminal and
> run the other application
that takes control of the
serial port.
>
> Note: You can use the Debug
Terminal for 2-way
communication with the BASIC
> Stamp 2 (and the 2e, 2sx,
and 2P). There is a narrow
upper windowpane in
> the Debug Terminal that you
can use to send messages to
the BASIC Stamp 2.
> The BASIC Stamp 2 can be
programmed to receive these
messages using the
> serin command (9600 bps, 8
data bits, one stop bit, no
parity, inverted).
>
> (2) Sometimes it's useful to
view communication on one
serial port using the
> Debug Terminal while
communicating with the BASIC
Stamp on a second serial
> port. The serin and serout
commands in the BASIC Stamp
Manual show sample
> code and circuits for
connecting the BASIC Stamp to
any I/O pin.
>
> Andy
>
>
E-Mail...........alindsay@para
llaxinc.com
>
> Parallax, Inc. home
page....................www.pa
rallaxinc.com
> BASIC Stamp Educational
Resources...........www.stamps
inclass.com
> SX Microcontroller
University
Resources.....www.sxtech.com
>
>
>
>
Original Message
> From: Mike Turco
[noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ZhB55AfSHjrHxfEH7oZby2gvXU5uWQiv-pR9vNGLY2Z-ThjeHv6mTX2QUMu_K6zbT2yY0LC8zBd5RQ]miketurco@y...[/url
> Sent: Monday, January 15,
2001 11:02 PM
> To: basicstamps@egroups.com
> Subject: [noparse][[/noparse]basicstamps] Re:
opening serial port?
>
>
> Subject:
>
> >>Hi,
> I'm a new user of BS2. I've
got a program, written in
> c++, that
> opens the serial port and
sends data to the stamp
> chip. however, I
> can't seem to get both to
run - if I download the
> program to the chip
> and run the debugger, the
c++ program won't run,
> because the serial
> port is in use. if I run
the c++ program first, then
> I can't
> download the program to the
chip, for the same reason.
> is there
> something I'm missing here?
> thanks,
> mike<<
>
> Mike,
>
> Download the program to the
stamp. Close the Stamp
> debugger. Then program the
other device with the
> serial port. The (if you
need to) re-open the parallax
> debugger. Should be fine.
>
> Note that you need to
disconnect the (I think) RTS
pin
> when you're communicating
with hyperterm or whatever
> *(anything other than the
parallax debugger). Or hold
> the RTS pin low. Otherwise
the stamp will not work.
>
> Mike
>
>
______________________________
____________________
> Do You Yahoo!?
> Get email at your own domain
with Yahoo! Mail.
>
http://personal.mail.yahoo.com
/
>
>
>
>
>
>
to communicate using the serial cable connection to your carrier board.
Below is an example program for the BASIC Stamp 2.
'--Example Program for 2-way serial com with BS2
'{$stamp bs2} <---- Stamp directive.
' Note: The liberal use of debug statements for the
' "online" instructions in this program uses lots of
' program storage in EEPROM because characters within
' quotes each take a byte of program memory. Keep this
' in mind when developing your applications.
' Declare variable.
value var byte
' Clear debug terminal.
debug cls
' Display instructions for use
debug "Click the upper windowpane of this Debug Terminal "
debug "with your mouse. Then enter a decimal number "
debug "between 0 and 255. Remember to press enter after "
debug "keying in the numbers. The Debug Terminal will "
debug "then display the decimal value and its binary "
debug "equivalent.", cr, cr
' Display prompt for number entry.
debug "Enter a number between 0 and 255: "
' The serin command below gets a 3-digit decimal number
' from the serial port. It is assumed that you are
' sending this data using the Debug Terminal's upper
' windowpane. See BASIC Stamp Manual for discussion
' of the features used in this serin command.
serin 16, 16468,[noparse][[/noparse]dec3 value, wait(cr)]
' Display results.
debug cr, cr, "Decimal value: ", dec value
debug cr, cr, "Binary value: ", bin8 value, cr, cr
debug "Press the reset button on your carrier board to "
debug "run the program again."
'--End of example program
Andy
E-Mail...........alindsay@p...
Parallax, Inc. home page....................www.parallaxinc.com
BASIC Stamp Educational Resources...........www.stampsinclass.com
SX Microcontroller University Resources.....www.sxtech.com
Original Message
From: Gene Shults [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=j59RJc1BfHEdx-i_x9rjILrKLZ8hbI8bZzeQe4waWbyw7P3VdRSm27tPGzt-4fgmERqxf-g6mzEJ9PLUxQA]gshults@o...[/url
Sent: Wednesday, January 17, 2001 3:55 PM
To: basicstamps@egroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: opening serial port?
In your note about the narrow
upper windowpane in the Debug
Terminal your able to
communicate with the BS2. What
do you have to use for the pin
number when your not really
connecting to a pin when your
using the Debug Terminal.
SERIN (??),N9600
Original Message
From: "Andy Lindsay"
<alindsay@p...>
To: <basicstamps@egroups.com>
Sent: Tuesday, January 16,
2001 12:03 PM
Subject: RE: [noparse][[/noparse]basicstamps] Re:
opening serial port?
> Mike,
>
> When I'm working on Stamp
projects, I approach that
situation in one of two
> ways.
>
> (1) What I usually do is use
my Debug Terminal to verify
that the Stamp is
> behaving the way it is
supposed to. Then, I close
the Debug Terminal and
> run the other application
that takes control of the
serial port.
>
> Note: You can use the Debug
Terminal for 2-way
communication with the BASIC
> Stamp 2 (and the 2e, 2sx,
and 2P). There is a narrow
upper windowpane in
> the Debug Terminal that you
can use to send messages to
the BASIC Stamp 2.
> The BASIC Stamp 2 can be
programmed to receive these
messages using the
> serin command (9600 bps, 8
data bits, one stop bit, no
parity, inverted).
>
> (2) Sometimes it's useful to
view communication on one
serial port using the
> Debug Terminal while
communicating with the BASIC
Stamp on a second serial
> port. The serin and serout
commands in the BASIC Stamp
Manual show sample
> code and circuits for
connecting the BASIC Stamp to
any I/O pin.
>
> Andy
>
>
E-Mail...........alindsay@para
llaxinc.com
>
> Parallax, Inc. home
page....................www.pa
rallaxinc.com
> BASIC Stamp Educational
Resources...........www.stamps
inclass.com
> SX Microcontroller
University
Resources.....www.sxtech.com
>
>
>
>
Original Message
> From: Mike Turco
[noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=s6KeyuAf32B-TBOEm7FUhXtouqkeESVEnWKQaAVulefP83eoCtqs0YMttC2GgeEX3doK6mowVi0c]miketurco@y...[/url
> Sent: Monday, January 15,
2001 11:02 PM
> To: basicstamps@egroups.com
> Subject: [noparse][[/noparse]basicstamps] Re:
opening serial port?
>
>
> Subject:
>
> >>Hi,
> I'm a new user of BS2. I've
got a program, written in
> c++, that
> opens the serial port and
sends data to the stamp
> chip. however, I
> can't seem to get both to
run - if I download the
> program to the chip
> and run the debugger, the
c++ program won't run,
> because the serial
> port is in use. if I run
the c++ program first, then
> I can't
> download the program to the
chip, for the same reason.
> is there
> something I'm missing here?
> thanks,
> mike<<
>
> Mike,
>
> Download the program to the
stamp. Close the Stamp
> debugger. Then program the
other device with the
> serial port. The (if you
need to) re-open the parallax
> debugger. Should be fine.
>
> Note that you need to
disconnect the (I think) RTS
pin
> when you're communicating
with hyperterm or whatever
> *(anything other than the
parallax debugger). Or hold
> the RTS pin low. Otherwise
the stamp will not work.
>
> Mike
>
>
______________________________
____________________
> Do You Yahoo!?
> Get email at your own domain
with Yahoo! Mail.
>
http://personal.mail.yahoo.com
/
>
>
>
>
>
>