Shop OBEX P1 Docs P2 Docs Learn Events
WORKING!! WAS: If I have a serial device and do not know what ... — Parallax Forums

WORKING!! WAS: If I have a serial device and do not know what ...

neotericneoteric Posts: 144
edited 2006-02-23 16:54 in BASIC Stamp
Beginners question:

I am going to be reading from a touch panel, similar to what you would add to a screen to make it into a touch panel.· This is the Fujistu 4 wire serial.· http://www.mouser.com/index.cfm?handler=displayproduct&lstdispproductid=587686
I am also purchased the serial 4 wire control board, in case I need it.
http://www.mouser.com/index.cfm?handler=displayproduct&lstdispproductid=587458&e_categoryid=452&e_pcodeid=81705

This is more of a learning question than anything else, although I do have a specific project in mind.
The board sends information standard serial, rs232c, 9600 baud.
(I have googled all over the place, but cannot find what the actual device sends, I did however find the windows driver...)

My question is, generally, if I do not know what the device is actually going to send, is there a way to figure it out?· ·Do I just poll the serin pin, and display the stuff to the debug screen, and is that safe?· Or do I hook it up to the PC serial port and open hypeterminal?

If anyone has done this sort of experimenting, with any similar serial device, perhaps they could give me some guidance.

Thanks to all·on this board!


Post Edited (neoteric) : 2/24/2006 12:59:22 PM GMT

Comments

  • SteelSteel Posts: 313
    edited 2006-02-16 23:55
    Yeah.· I would just run a SERIN, and debug the variable that you collect.

    Either that, or you can hook the panel to COM1 of the PC, and download this tool[noparse]:http:[/noparse]//www.compt.ru/serial-port-monitor/en/download.php

    This tool monitors the comport, and realtime puts the information on the screen.· You can also create a message to send out of the port.



    I use this tool whenever I am developing a project with Serial connections to make sure everything is talking A-OK.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-17 01:10
    Hello,

    ·· More than likely if the device normally has a Windows Driver then it will be sending more than a few bytes per packet.· You may want to print things out such that you can see multiple values per line (do not use any CR in your DEBUG).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • neotericneoteric Posts: 144
    edited 2006-02-17 03:58
    Wow, this is not nearly as easy as I thought it would be.· I am using a bs2p, so I have just completed reading the BS2p serin once again.

    I have pin 14 to RXD, pin 15 to TXD on the touchpanel.
    I did find the Datasheet, for the control board, so I am·using it.
    ·...· it was not easy to find.....·· http://www.apollodisplays.co.uk/pdf/tsctrl/N16B-0558-B230.pdf· WARNING, larger file....

    It appears I want to send an initialization.· It also says it recieves 10 bits, but the way I am reading it, it must be 8 bits?· start, 8 bits, stop?

    I am getting nothing....·· My code is pretty simple.·· Any suggestions?
    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}
    getit VAR Word
    SEROUT 14,16624, [noparse][[/noparse]$80]
    

    DO
    SERIN 15, 16624, [noparse][[/noparse]getit] 'should this be 240?
    DEBUG getit
    LOOP
    

    If this is going to be a real difficult thing to do, perhaps I should put it aside until I learn more...· I thought it was going to be challenging·to figure out·what it was sending, once it sent...
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-17 04:30
    Baudmode values kill everybody which is why I continue my campaign for Conditional Compilation! tongue.gif

    I've attached my standard programming template; you'll see that it takes care of the gory details of serial baudmode values and lets you switch from Stamp-to-Stamp without worrying about them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-17 15:44
    I think the real issue here is that you don't know if the device uses TRUE or INVERTED mode.· The question would be, was the device originally built to connect to a computer serial port?· If yes, then it probably is inverted, but the question would be, do you have a driver on the Stamp I/O pins capable of handling those signals?· If they are +/- 12V then you would need something like a MAX232.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • neotericneoteric Posts: 144
    edited 2006-02-17 16:12
    Jon,
    Yes, I typically use your template.· I posted what I did for brevity.· I actually checked my numbers against the template b4 I posted it.· I believe the baud rate # is correct, if I am reading it right.· (unless its inverted...)
    Chris,
    I will try to figure out if whether it is inverted or not.
    I see what you are talking about in the docs now.· Didn't know about that before...·· Sometimes I am too new to this to know what to look for in a document....

    I did put the 220k resister inline as per the samples here.· Thought thats what I read I was supposed to do.·

    My last big Parallax order (or the one before that...)·included a Parallax Professional Development Board.··I assume I can use the Max232E that is on it?·

    By the way, what I am doing is adding a touch panel to an etch a sketch.· It fits freakin perfectly!· Works connected to the PC, but what I really want to do is get it "stand alone" with the stamp...

    Thanks for all the help.·· OK, will do some more research and try again.

    THANK YOU THANK YOU
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-19 06:12
    220K or 22K?· The docs use 22K.· 220K may not give enough signal to operate properly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • neotericneoteric Posts: 144
    edited 2006-02-19 11:45
    yep.· I meant 22k.· argh.

    But I am wiring it to the Professional Development Board, so I dont need that now.·· I am getting some help today from my son, who has more experience than I do with electronics, tho not the stamp.

    I have gotten no where.·· So it was time to call in some help from him.· I'll let you know.· This is a complex one.· [noparse]:)[/noparse]
  • 06FJR06FJR Posts: 12
    edited 2006-02-19 21:11
    One thing you can do is write a short routine to read serial data off your serial port on your PC. Attach the unknown serial device to your PC and read off the messages. If you have reason to believe the device uses ascii text to communicate, you can just use hyperterm (windows) or minicom (Unix/Linux) to read the communications.
  • neotericneoteric Posts: 144
    edited 2006-02-23 16:54
    Well, it is working.·· Thanks to the suggestions of this board and help from my son on the C#

    Had to learn a lot on this one.·· Turns out all it needs is the RX line.· (hooked up to the extra serial port on Pro Dev Board.)

    You have to read the touchpad into a 5 byte array.· its sends an OK type formatter in the first byte.· Then it sends two bytes each for x and y which I had to bit shift to get the actual numbers.· Since its dumping the data so fast, I had to discard any info coming in that did not contain the correct first byte.· Its now working.

    I did have to hook it to the PC to look at the data coming into hyperterminal.· That was the first step.· It looked like garbage, but that lead me to learing about bytes, byte arrays, etc.· Attached is the c# code to read from it.· As well as the BS2 code.

    Next step is Stamp to take the X,Y coordinates and turn the new stepper motors I got....

    THANKS AGAIN for helping me all!
Sign In or Register to comment.