Shop OBEX P1 Docs P2 Docs Learn Events
Utilizing for I/O to a computer? — Parallax Forums

Utilizing for I/O to a computer?

jrsteensenjrsteensen Posts: 3
edited 2008-09-17 10:38 in BASIC Stamp
Hey there. Im brand new to BASIC Stamps, I was curious if it were possible to utilize them for I/O to a computer easily via USB? I want to use it to interface toggle switches to send keystrokes on a computer and have bits spit back from a shared memory file to light up LEDs, move servos for gauges, and possibly 7 segment LED displays, and interface with rotary encoders? Possible?

Thanks.

Comments

  • jrsteensenjrsteensen Posts: 3
    edited 2008-09-16 10:59
    Just to clarify application, Im trying to figure out a new way to do inputs and outputs to a homebuilt F-16 cockpit to interface it with the flight simulator, realtime.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-09-16 11:36
    The BASIC STAMP 2 (BS2) uses the Serial Port. Sure you could use a USB to Serial Converter to make the PC USB port act like a virtual serial port but in the end, the STAMP will need to accept Rx and Tx serial signals. Many people have written hyperterminal and Visual Basic programs to interface their PC to the BS2 sucessfully. From what I can tell, it looks doable. Can you provide more detail, drawings, code, or is this just a idea at the moment?
  • jrsteensenjrsteensen Posts: 3
    edited 2008-09-16 11:47
    Well, this is at a basic stage. Im looking for a cheap way to interface almost 200 non-momentary toggle switches, output almost 100 LEDs, and possibly control 2 text LCDs,·2 graphical LCDs, 4 pots and 4 rotarary encoders. There are solutions out there, but the cheapest ones are 500 dollars and up.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-09-16 11:57
    Do they all have to interface to each other? Or can you have completely separate controllers for some subsets of all of that?

    You could certainly use some fairly cheap controllers to connect some of the switches to some of the LEDs and some of the pots to some of the LCDs and so on. It'll be quite a bit more complicated if all of the inputs have to be available to all of the outputs. 200 inputs is a hell of a lot, and you're going to be seriously taxing available memory too.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-09-16 12:12
    Wow. Some project!

    You have alot going on for a single BS2. You first have to see how much I/O you will need to control all of this stuff considering that a BS2px (fastest version) is only going to provide 16 I/O lines. Have you considered the Parallax SX28 or SX48 (proto board)? They are not too far off of the BS2 with much more horse power and very similar in BASIC style programming that the BS2 uses. Myself and others can help with that on this forum. The SX48 would provide double the ram and space as the SX28 and also 36 I/O lines but it's surface mount so the proto board is a good option for $10. The SX28 is DIP style like the BS2 and has 20 I/O lines compared to the BS2's much slower processing power with 16 I/O lines.

    You should consider using cascaded 74HC595 ICs·for the LED outputs. Since you have 100 LED outputs and the 74HC595 ICs have 8 outputs, you will need 100/8 = ·13. This will use up only 3 I/O lines on the BS2 or SX chip.

    You should consider using cascaded 74HC165 ICs for the LED inputs. Since you have 200 toggle switches and the 74HC165 ICs have 8 inputs, you will need 200/8 = 25. This will use up only 1 I/O line on the BS2 or SX chip as normally you will use 3, but Latch and Clock lines can be tied into the 74HC595 Latch and Clock lines (with a 10K pull down resistor on the Latch).

    So now you are using only (4) I/O lines (Latch, Clock, Data595 and Data165) on a BS2 or SX chip to control over 100 LED outputs and 200 toggle switch inputs as well as (13) 74HC595 and (25) 74HC165 ICs.

    The 2 Text LCD's can be serial as well·only only use 2 more I/O lines. The Graphical LCDs I'm not sure about them so if they are serial based, then perhaps only 2 more I/O lines are to be used.

    Now you have 8 I/O lines being used total.

    OK - I have not used the POTs and Rotary Encoders but it may still be possible to do it all with a BS2·or SX chip if you are creative in your design.

    However, you have so much stuff·going on - you should probably consider the SX chip for speed and interrupt capability (as needed).
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-09-16 13:58
    +1 to using the SX48. Invest in an SX development system with the SX-Key. Then you can purchase an SX48 board for $10 or so. These give you 50 MIPS of speed, and you can easily program a small 'local network' for various slave-boards to talk to a 'master' board.

    This will give you a scalable solution. Add '595's to drive LED's, build a 'small' system with two boards, one master one slave. Then you can add slave boards as needed.
  • Adrian SchneiderAdrian Schneider Posts: 92
    edited 2008-09-17 09:57
    I think the Propeller would be better suited for your appliaction -- you may need even two or three of them. But still
    a "cheap" solution.
    Adrian
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-09-17 10:38
    He said he was new to the Basic Stamp so although the Propellor would be a good choice for this project , the learning curve for SPIN would probably be too much depending on his priorities. I still recommend the SX chips but with some clever design, the BS2 may still be possible.
Sign In or Register to comment.