Does SX/B have a STAMP-Style DEBUG and DEBUGIN?
![John Kauffman](https://forums.parallax.com/uploads/userpics/555/nZBNEPT0B6FMD.jpg)
Does SX/B have a STAMP-Style DEBUG and DEBUGIN that opens a Windows pane and displays text to/from SX?
I know a WATCH can be assigned for a variable in DEBUG, but I want to display text as well adn to do so in run mode.
For example, like STAMP:· ·DEBUG "MyVariable = ", TAB, DEC MyVariable
What is the best way to display on the PC a string.
For example, Like STAMP:· ·DEBUGIN DEC MyVariable
What is the best way to pick up a key press on the PC and bring it into an SX/B variable?
thanks
I know a WATCH can be assigned for a variable in DEBUG, but I want to display text as well adn to do so in run mode.
For example, like STAMP:· ·DEBUG "MyVariable = ", TAB, DEC MyVariable
What is the best way to display on the PC a string.
For example, Like STAMP:· ·DEBUGIN DEC MyVariable
What is the best way to pick up a key press on the PC and bring it into an SX/B variable?
thanks
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Continuing on your thought that DEBUG is a specialized SEROUT and since·SX/B SEROUT requires a pin and PBASIC·DEBUG does not, I assume that PBASIC DEBUG automatically proivdes a PBASIC SEROUT with a special arguement for a "pin" internally connected to the the RS232.
In SX/B SEROUT can I somehow supply a·"pin" arguement which is actually connected to the SX Key?
In other words can I set arguements for SX/B SEROUT that will make it behave as a PBASIC DEBUG?
Of course there would have to be a loop to feed character after character for a string.
Thanks.
As Jon has stated the SX is a difference beast and requires a different debugging method.
Mainly using breakpoints, single stepping your code (neither of which the stamps·have) and using watches.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"I thought I was wrong once...But I was mistaken [noparse];)[/noparse]"
·
The downside? The debugger is based around assembler, so you'll need to learn it to become proficient at debugging.
I want a DEBUG-like feature for output and input of data. For example, I have a project where the microcontroller monitors readings from a spectrophotometer. With STAMP I throw the readings up on the laptop screen. I also use a menu to launch different subs with different ways of reading the data, the menu relies on a keyboard input. This output/input behavior is the core of my question.
I know how to hook up my 2-line LCD display, but that is just two lines (and no input). It can't present the quantity of data like a 80 char by 20 line screen.
So let me re-phrase my question:
How, in SX/B, can I use my laptop screen and keyboard for output/input?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
You cannot use the SX-Key to get data in and out of a running SX program. I think that's what your trying to do.
You need to connect the I/O pins to the serial cable using a MAX232 or something.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"I thought I was wrong once...But I was mistaken [noparse];)[/noparse]"
·
Yes, that is what I am trying to do:
; I want scores of values of data from the SX shown on my PC screen adn I wqant the occasional input of numbers from teh PC keyboard.
I'll look into the Max232, but I'm picturing that I would have to physically switch the serial cable from the SX Key over to a homemade jack connected to the MAX232. SInce the SXKey is now disconnected, that would mean no input/ouput during debugging, ony at run mode.
So if I understand all of this correctly, the only options for getting input or output are:
1 - Use LCD display and keypad (downside is cost, a lot of extra code for keypad and very limited output space of 2 lines by 16 char)
2 - Build Max232 interface and use PC (downside is only possible during run mode becuase need cable from SXKey)
3 - Any suggestions for others?
4 - LEDs blinking morse code?????
I think the SX & SXKey are great. My suggestion for a feature improvement is a built-in capacity to interact with a PC. As I see it now (and please correct me if I am wrong) the SX is going to be less useful then STAMP for an application where data is to be reported out. That would include real time (like my spectrophotometer interface) or a report out after off-line data capture (like a weather sensor left out in the field).
Perhaps another way to think of this is that the STAMP, because of I/O to PC, is a tool for both electromechancial I/O and human I/O. The SX gives much more speed (which opens new possibilities for electromechancial I/O) but is not as useful for human I/O. Any comments about this characterization?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Once you've made the connection to your PC's serial port (if you have a second one) and use the SERIN/SEROUT command the SX would operate in a very similar nature as the BASIC Stamp for data exchange. The difference is that this data won't be transmitted through the SX-Key, but between the SX and your serial port (or as Jon suggested with the USB2SER - your USB port).
The "debug" feature in the SX-Key IDE is not useful for the serial data exchange features you discuss, but with a tad bit of wiring to your breadboard and a second connection you'll have what you need. Aside from this, you'd be developing with two programs open (your terminal program and the SX-Key IDE). But this is common with many microcontrollers.
The Stamp's DEBUG terminal data exchange is one of the reasons that product is sooo easy to use and popular, too!
Ken Gracey
I've also just googled to Al William's RS-1 serial interface adaptor that also looks like it would fit the bill for the device to create a second connection to the PC.
I'll buy both Al's interface and the Parallax USB2SER (part #28024), test them and report back to the forum.
Just to add my perspective, I have groups of students that have done WAM, BoeBOT, BAaD, etc. and they see the SX on the Parallax site. They ask about it and want to give it a try. But they are not really ready for Assebmly LAnguage - they have had problems understanding the Daubach text (some of these kids are in 7th and 8th grade!). So I am trying to develop a course where they repeat the WAM but this time using SX/B. They are very familiar with PBASIC and they know the 40 WAM activities inside and out. So the objective is to get them to rebuild those activities using SX Tech Tool, SXKEY, SX terminology (like register names), SX IDE and the SX debugging tools. I figure after that we can take tehm back and give the activities a try in Assembly Language.
STAMP and WAM rely on DEBUG & DEBUGIN for I/O to PC. Some of that I/O is diagnostic (debugging) but much of it is for transfer of data, like RCTimes. My questions here are an effort to get a similar I/O to PC behavior for them in the SX world.
Much thanks.
I understand your perspective entirely. I'm in the same boat.
From the beginning of SX/B, I've thought we'd need to demonstrate how to do common Stamp functions in an SX. At this point the compiler has become a nice tool, and I've seen more than a couple engineers in our office develop applications with it almost as quickly as they do with the BASIC Stamp.
From the Stamp user's perspective, the key "transition" items could include the following:
- DEBUG/DEBUGIN is now SERIN/SEROUT with another terminal connection
- Oscillator speed as it relates to program execution time
- Working only with byte variables (no word)
- Not being able to write to the EEPROM during program execution
- Setting up an SX-Key debug session (WATCH)
And once these basics are explained you could move into the SX architecture (interrupts, parameters, etc.). In other words, I favor the approach which lets them do something and see the results while filling in the pieces after some initial success demonstrated by what they already know with the BASIC Stamp.
Ken
My overall plan is in four parts:
Intro to why a new chip and the very basic differences.
I'll have them explore the differences as they do the WAM activities in SX/B
Then I'll go through the capabilities of SX beyond STAMP (with some revisions to WAM activities to demo)
A short intro to Assembly Language (enough to get them started in Gunther's text).
One of the keys is components. The kids have each bought WAM and they will buy SX Tech Tool for this course. I try not to hit them with more then $120 per course (except BoeBOt) so I'm hoping ot to do this transition from STAMP to SX with students buying nothing beyond the SX Tech Tool Kit. I might buy 20 SER2USB myself to lend if that solves the I/O problems.
Thanks for the thoughts on the pedagogy.
Here's a link to an $18 dual serial port PCI card:
www2.newegg.com/Product/Product.asp?Item=N82E16815104232
Here's a $14 USB serial port:
www2.newegg.com/Product/Product.asp?Item=N82E16812147302
and here's a $40 PCMCIA serial card (ironically the most expensive):
www2.newegg.com/Product/Product.asp?Item=N82E16839113003R
This all seems like a no-brainer and kind of much ado about nothing. Either use the second serial port on the machine, or spend $14 to buy a second serial port and use it. If the serial communication is a permanent part of the app, then just build it in for real instead of hoping to use a debug facility for some alternate purpose.
I have an SX application on my desktop right this second that communicates over a serial port to my PC - and it's the same PC I'm using to simultaneously develop and debug it. I use COM1 for the SX-Key, and COM2 for the SX to PC communications, but they could just as easily be switched.
Thanks, PeterM
Best to add a pci serial card. Here's another one (for 6 ports using a single pci slot)
http://www.conrad.com
select international, product code 974514
Warning on the pcmcia card. That item is an OEM version, no cd and no
cable. That cable has a 44 pin sub connector and may be hard to find.
regards peter
Thanks for the references and the confirmation that you have it up and running. It is always great to hear "I've got it working as we speak" in addition to the contribtions that begin "You should be able to..."
Your solution of a second interface is my second choice. My situation is trying to teach students to move from WAM to SX with SX/B. They have bought the WAM kit and the SX Tech Tool Kit and I am developin gthe course to repeat the WAM activities using SX adn SX/B. My goal is to avoid having them buy an additional components beyond what is in the two kits they have. I appreciate that you found very low cost interfaces, but I wanted to explore all zero-cost options first. Having exhasuted free soutions, I'll just have to hit them up for a hardware interface.
Thanks.
·· Two things I wanted to add to the above discussion...First of all, not many people know this, but many of the motherboards with on-board VGA still have the second serial port available as a 10-pin (2X5) header on the board.· It requires an industry standard cable just like those used by older computers that had the ports in the slots.· So it is possible to get back your second serial port on many boards this way without adding a new card.
·· PeterM, the USB to serial adapter you pointed out may be cheaper than most, however, in our experience those are seldom compatible with the BASIC Stamps, Javelin·and the SX-Key.· The only ones we have been able to get to function properly are the FTDI and the KeySpan units.· We used to carry· BAFO, but then started having problems with them.· Many of our calls from users with USB to Serial converters are using different brands, and cannot get the computer to recognize the Stamp, Javelin or SX-Key.· Just trying to save some hair!·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I was mainly looking for the cheapest PCMCIA card I could find. I should have looked at the details a little more closely.
Chris,
I should have pointed out that it would be best to use the USB serial port for the communications portion of the project, not for communicating with the SX-Key. As you have pointed out, the USB serial interfaces have had problems with the SX-Key in the past.
Thanks, PeterM
Thanks
Sid
I've attached a starter program that implements the output functions -- I'll get to the input stuff later (unless someone beats me to it).· I tested with Hyperterminal up to 38400.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Post Edited (Jon Williams) : 5/8/2005 4:21:29 PM GMT
Tx pin to DB9.2
Rx pin tp DB9.3
Common ground
Do I need a level shifter between the TX/Rx pins and the DB9 or can I go direct?· Will Hyper automatically find the USB port or do I have to set that up with a new Hyper file?
Thanks.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
The project is a program to use the Stamp Tester to check pins RB.0-RB.7 and RC.0-RC.7 and then display the results on the Debug screen or Hyperterminal.· If I ever get it working, should I post it in this forum or the Projects forum?
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
And now the problem - if I·serout a decimal number, i.e., 53, it gets converted to ASCII and the screen displays "5".· How do I serout a variable
serout so, baud, dis
where dis is a variable that can be between 110 and 240.
Sid
Print_Num:
· char = theNum // 100
· theNum = __REMAINDER
· char = char + 48
· TXCHAR char
· char = theNum / 10
· theNum = __REMAINDER
· char = char + 48
· TXCHAR char
· char = theNum + 48
· TXCHAR char
... or something like this (my example aboves assumes you have a subroutine called TXCHAR that uses SEROUT).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
cntvert:
char = cnt/100
char = char + 48
serout so, baud, char·
char = cnt // 100····
cnt = __REMAINDER
char = cnt / 10
char = char + 48
serout so, baud, char·
char = cnt//10
cnt = __REMAINDER
char = cnt + 48
serout so, baud, char
return
Now the screen displays 123.
I reverted to the original program, using Circuit A as shown in Help/RCTime:
readit:
output rb.0
low rb.0
HIGH rb.0
PAUSE 8
RCTIME rb.0,1, dis,5
output rb.0
high rb.0
LOW rb.0
PAUSE 8
RCTIME rb.0,0,chg, 5
····················
put Line1, "RB.0 =········· "
gosub show
cnt = dis
gosub cntvert
serout so, baud, " "
cnt = chg
gosub cntvert
char = 13
serout so, baud, char
goto main
I'm getting good numbers for the discharge time - 120, which corresponds to 1200 if read by a BS2 - but I'm getting all 0s for the charge time.· Haven't figured that one out yet.
Sid
RB.0··· 119··· 035··· Pass
If I am reading the assembly addresses correctly, it took 1306 bytes to read the RCTime for one pin.· It would take 16 different programs to read all 16 pins, which is obviously impractical.· It would appear that the SX/B was not intended to run such things as RCTime routines.
The display capability might be useful in other SX/B programs, but with its 2K memory - which assembly gobbles up at an amazing rate - the byte variable limitation and a couple of other limitations I have yet to think of a suitable program that would utilize the capabilities of the SX/B.· But then I am really not a very original person.· I can change and modify and adapt almost any program I can understand, but truly unique and original concepts somehow escape me.· Oh, well.........
Sid
Plug tester in Pins RB
Press any key when ready
RB.0 = 119 036· Pass
RB.1 = 119 036· Pass
RB.2 = 116 035· Pass
RB.3 = 117 035· Pass
The program used about 1815 bytes, so I have a few left for embellishment.· This would take·4 programs instead of 16 to read all 16 pins of Ports B and C - a bit cumbersome but not out of reach.
I used a Stamp Tester for the·RCTimes, which provides Circuit A for the discharge time and Circuit B for the charge times.· If you just make a Circuit A for each pin you can measure·discharge times but not charge times.
I have attached the code in case anyone is interested.· After programming. power off,connect your serial cable to the special display cable which Jon has pictured above.· Open either the Stamp debug screen or Hyperterminal, apply power, and there you are.
Sid
No wonder you ran out of space. You have used SEROUT at 19 different places, and PAUSE in 8 different places.
Put SEROUT and PAUSE in subroutines and you will free up a bunch of space.
Everytime you use SEROUT all the code to perform serial output is generated.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"It's not getting what you want, it's wanting what you've got."
·