Shop OBEX P1 Docs P2 Docs Learn Events
BASIC Stamp Code coversion project — Parallax Forums

BASIC Stamp Code coversion project

lamarjordanlamarjordan Posts: 1
edited 2007-11-21 18:27 in BASIC Stamp
I've got the BS2px chip.

I need to Take in HEX data outputted by a control joystick.
I then need to take that HEX data and translate it, maybe through a table.

E.G.
Input (RS-232, 9600 8N1) 'pan left at normal speed Pelco P
A0 00 00 04 20 00 AF

Needs to then be output as
(RS-232, 900 8N1) 'pan left at normal speed SONY VISCA
81 01 06 01 05 03 02 FF

Am I even using the right hardware to get this done?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-21 17:54
    Read the Parallax Basic Manual chapters on the SERIN / SEROUT statements. That discusses RS232. Most of the time, you can use a Stamp's I/O pins directly for RS232 communications (with a protective series resistor as discussed in the manual). Some equipment requires "real" RS232 voltage levels and you'd need to use a 5V logic level to RS232 voltage converter like the MAX232.

    One issue is that all Stamps are "single threaded" processors. When they're doing one thing (like sending RS232 serial data), they can't do anything else at exactly the same time (like receive new position information). For many applications, this isn't a problem and different actions can be interleaved. In your case, you might miss some joystick information. There are some 3rd party serial buffers that you can add that will eliminate this issue (like from Protean Logic: www.proteanlogic.com/product_periph_rs232.shtml).
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-11-21 18:24
    Lamar -

    This should be a very interestring table. I see no relationship between the input data and the output data, particularly since the output data is one byte longer than the input data. What does the data translation table look like?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-11-21 18:27
    The "Simple Mutli-Tasking" co-processor at this link: http://www.rhombusinc.com/co-processors.html

    will get this job done. The buffer is 11 bytes, which should be big enough to hold one complete "message".

    The problem with the BS2 is that it is a single-tasking processor -- so while it's sending the data, it can't also recieve the data. Now, this co-processor WILL recieve the data -- but you'll still have to 'read' it with the BS2 at some point, then 'send' it from the BS2 on.

    The co-processor only needs one resistor to be able to recieve RS-232 signal levels, which cuts down on the number of components you need to use.
Sign In or Register to comment.