Shop OBEX P1 Docs P2 Docs Learn Events
Device identification — Parallax Forums

Device identification

leshea2leshea2 Posts: 83
edited 2005-10-11 19:12 in BASIC Stamp
Is there a way that you can tell the stamp what kind of device it will be communicating with ?

For an example, if I was using the BS2sx to send some data to a device so that the device would take the data as a command, could I pre-program the stamp to already know what kind of device it will be sending this data to, (a LCD, cell phone, etc), ?

Thanks !

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-05 21:30
    Is this a trick question?

    If YOU are writing the program then of course you can tell the BASIC Stamp what it's talking to -- in fact, you have to in order to write code that works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-05 23:17
    Leshea -

    I have a feeling you're asking your question in a bit of an awkward manner. I suspect what you're trying to ask is the following:

    Is there a way for a Stamp to interrogate a device connected to it, so that it can ascertain what kind of device it is, so it will know how to handle it?

    Neither the Stamp, nor any microprocessor I'm aware of has any device enumerartion facilities. Device enumeration is the process of investigating and interrogating every possble I/O port on the computer, and attempting to determine the following:

    1. Is there a device present on the port.

    2. If a device exists, what kind of device is it?

    3. If a device exists, is it one for which a driver is presently available on this computer?

    4. If the driver doesn't exist, can it be obtained?

    5. If the driver can be loaded, interrogate the device further via the driver.

    6. As a result of that interrogation, determine if the device is ready and available.

    There is actually more to it than that, but those are the basics. As you can imagine it takes a good deal of computer "horsepower" to do all that, as well as a fair amount of disk storage to contain all the software drivers. In fact, real device enumeration only came about with Microsoft Windows when Windows 95 appeared, and even then it was limited. Device enumeration essentially came about when Plug-and-Play devices became more readily available. Only true Plug-and-Play devices can be interrogated, and have their status fully determined.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 10/5/2005 11:20:03 PM GMT
  • leshea2leshea2 Posts: 83
    edited 2005-10-05 23:22
    I mean with a command like this, could I put (The device your communicating with is a CELL PHONE) somewhere in the code and have the stamp reconize that the device it will be communicating with will be a cell phone ?

    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    Sout PIN 0
    Baud CON 17405

    eePntr VAR Word
    char VAR Byte

    Msg1 DATA "Call 18004459889 at 4:35 p.m.", 0

    Main:
    eePntr = Msg1
    GOSUB Send_Msg
    END
    Send_Msg:
    DO
    READ eePntr, char
    eePntr = eePntr + 1
    IF (char = 0) THEN EXIT
    SEROUT Sout, Baud, [noparse][[/noparse]char]
    LOOP
    RETURN
    END

    How would I tell the stamp in a code, what it is talking to ?

    Thanks !
  • leshea2leshea2 Posts: 83
    edited 2005-10-05 23:28
    That's very helpful Bruce Bates, thank you very much !
    Sometimes I have a question and at the time I can't quite put it into words the right way, so it's clear, you know.
  • Tom WalkerTom Walker Posts: 509
    edited 2005-10-06 13:20
    If Bruce's response answered your question, then great. If not, what do you think the Stamp will do with this "knowledge" of what kind of device it is "speaking" to?

    Just trying to find out what it is you really are asking (again, if Bruce did not·interpret it already....)...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...

    Post Edited (Tom Walker) : 10/7/2005 3:06:42 PM GMT
  • leshea2leshea2 Posts: 83
    edited 2005-10-06 19:19
    In the basic stamp manual, it says that·when you use the I2COUT command reference, and write ($A0) it ID's the chip the stamps communicating with. So I was wondering if you could write something like ($A0) to let the stamp know it was communicating with something like a LCD, so the stamp would know things like the Baud rate, etc ?
    But Bruce basically cleared it up for me.

    Thanks !

    Post Edited (leshea2) : 10/6/2005 7:25:10 PM GMT
  • AlexDAlexD Posts: 3
    edited 2005-10-10 20:15
    For new "BS2 to LCD" users, where can they get the complete list of control codes and syntax?

    My searches have produced lots of code but without understanding the task is a long haul. In my case I have had to marry an Elec & Eltek 2X16 line LCD with a Picaxe back pack to BS2 on a Board of Education. It refused to do anything untill, in despartion, I loaded all the code I could find untill it started to run. It is now a little confused as to what type of connection it has with the BS2. It then reverted to plain dum after it cooled down over night.

    After some more fiddling with the [noparse][[/noparse]$] codes it works OK but it would have been nice to have been able to get there by design rather than by accident.

    So, Jon the question about what kind of device the stamp is talking to is not a trick. There is a gap between what the designers of the bits know and what they tell the users. Getting help to bridge that gap is where the trick is.

    Thank Alex.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-10 22:36
    No, it was not a trick -- it was a silly question; kind of like me asking you the color of my car. You would, of course, simply say, "Jon, you own the thing, have a look." My point is not to be crass, but to encourage all of us not to be lazy. If we're connecting to device X we cannot expect that the world knows that device and is able to pour out ready-to-run code (sometimes it doesn't exist). It is our responsibility to read the technical documentation on the device in question. Every bit of code I've ever written, be it for LCDs or for I2C devices , or anything else was written only AFTER I studied the appropriate technical documentation.

    To give you an example, I just completed a serial inkjet printer driver using the SX and our SX/B compiler. Do you think HP had ready-to-run SX code? No -- they were asking us to provide that. So, after several hours of studying the print-head documentation I was able to write a successful program. I was given no code to start with; I did it from scratch using the technical documentation on the print-head (the device) and my knowledge of programming the SX in SX/B. You can see the project (with pictures) in the SX forum.

    The information we need is available -- I disagree (in most cases) that there is any gap between what designers know and what users could know (if they would just read before posting questions in a forum).

    I don't mean to be harsh; I'm simply trying to be real.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • AlexDAlexD Posts: 3
    edited 2005-10-11 00:27
    Dear Jon

    The key words are "understanding" and "information". You have them and I do not so it only looks silly until I tell you what I do not have. In effect I am colour blind until understanding is achieved. I am sorry if you thought I was being unhelpful but when you live near the bottom of the world technical manuals do not reach here very often and unless you know the name and ISBN number they remain unobtainable. Without the correct key words internet searches are not always helpful either, until one understands how the author thinks.

    So if you are able to help?
    1. Do you have a complete instruction set for the BS2 or can you direct me to its location?
    2. Are you able to direct me to the complete instruct set for the Elec & Eltek 2 x 16 LCD with a Picaxe CTR19K 0511 code AXE033 v2(c)01-04 with a pic16f819-I/P 04413BG chip.

    My attemps to obtain this information have been unsuccessful and may explain some of the frustration.

    Thanks Alex.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-11 01:08
    Alex,

    ·· Complete help for all BASIC Stamp command is available in the Stamp Editor help files, along with example codes for most of them.· You can also download the complete BASIC Stamp Reference and Syntax Manual from the following page (Toward the bottom) in PDF format.· As for your LCD, it looks like it has a custom micro backpack, and you would need to find out the commands for it.· Perhaps from the manufacturer?

    http://www.parallax.com/detail.asp?product_id=27218

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • cyberbiotacyberbiota Posts: 79
    edited 2005-10-11 02:23
    Alex-

    Professor Peter Anderson has quite a bit of PICAXE material, and links to other sites that deal with the PICAXE, on his site. Try :
    http://www.phanderson.com/picaxe/picaxe.html
    Specifically, he has a few PICAXE LCD controllers, and the instruction sets for same at:
    http://www.phanderson.com/lcd106/lcd108.html
    I'm not sure if this is what you need, but it may be a place to start.

    peter

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Peter C. Charles

    Director, Research and Technology
    CyberBiota, Incorporated
    Peter.charles@cyberbiota.com
    http://www.cyberbiota.com
  • AlexDAlexD Posts: 3
    edited 2005-10-11 08:19
    Dear Peter and Chris

    Down loads done and reading underway.

    Thanks Alex
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-11 19:12
    With the Internet available to us all (as witnessed by our participation in this forum), that goofy phrase "Had it been a snake it would have bit me!" is relevant -- one only needs to do a bit of searching (in the logical place) to find the data required for a project.

    One of the most valuable tools in our collective arsenal is the Internet search engine. Google happens to be my favorite, and there are other good ones. Learning to use them effectively will probably help ameliorate some of your frustrations, and help you get to the actual work of your project more quickly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.