PDA

View Full Version : Bs1usb



Brandon_L
01-28-2006, 07:48 AM
I just got my new bs1USB yesterday.· Here is the challange.· How can I access the USB com port via my programs on the BS1.· IE I want when I plug it in to send a text string via the USB-comport.· IE:password=Joe smith 1009939393497

Thanks

Brandon

Brandon_L
01-28-2006, 08:28 AM
Reply to myself:· Guys Sorry I just saw another thread on this.· It says I need to wait till March, Sigh but I want it now!· LOL sorry I didn't see the other thread before I posted.

Brandon

Jon Williams
01-28-2006, 08:49 AM
You'll have to figure out a different strategy; the BS1 doesn't actually send strings like that in its DEBUG statement.· At compile time, all strings are put into a table that lives in the editor.· Each DEBUG statements sends the program counter along with the state of the variables and the editor uses the program counter to look up the string sent at that location and display it in the Debug window with any variables that were also specifed for that location.

If you can put your information into the normal variables then you can send them up the USB port and intercept them as I've shown in my projects in the Project forum.· You don't have a lot of variables to work with, so you might have to do some trickery.· You could do something like this:

Start:
· PAUSE 1000
· B0 = "P"
· B1 = "w"
· B2 = "d"
· W2 =·0001
· W3 = 0099
· W4 = 3939
· W5 = 3497
· DEBUG B0········' actually sends everything
· GOTO Main······ ' repeat

By putting "Pwd" in B0..B2 you have something to use as an indicator, the ID number is sent as four Words because there's not enough RAM left to send them as individual characters.· The PAUSE and GOTO allow the string to continue so that the software can re-verify the presence of the BS1-USB "dongle."

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Brandon_L
02-02-2006, 02:29 PM
Jon,

I tested this code and for me it will not work. I renamed MAIM to Start, but all it does is send "P=80" to debug. I altered the debug line to B0,B1,B2 ect. IS there a caleaner way to make this work?

Thanks

Brandon

Jon Williams
02-03-2006, 04:36 AM
Maybe I misunderstood what you're after; but let me try to clarify something: You can't DEBUG a string out of the BS1.· This seem contradictory to what you see in the BASIC Stamp Editor, but the editor is fooling you -- it is holding all of the string data for the currently running program and displays it when requested by a DEBUG statement (each DEBUG statement has a program counter attached to it, and that is used to point into the editor's string table).

So, to send a "string" to an app that wants to use the BS1USB as a dongle you have to load the characters into variables.· Note that I said when the BS1 debugs anything, it actually debugs everything.· Let me show you.· The first image attached is the debug window which responds to the program as we expect.· The second is a separate application that is capturing the output from that Stamp.· Have a look at the value of B0 -- it corresponds to the ASCII code for 'p.'· Look at the W1-W5 registers -- there are the values we put into the program, even though they're not called out in our DEBUG statement.

I hope this shows you that to send a string with the BS1 DEBUG to a non-editor application, you have to sneak it in.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

Brandon_L
02-03-2006, 08:06 AM
Jon,

Thank You I think I've seen the light as it were. I will go back and re work my application.


Brandon