Shop OBEX P1 Docs P2 Docs Learn Events
How to interface an RS485 Board to a MAC Via RS232/USB Adaptor — Parallax Forums

How to interface an RS485 Board to a MAC Via RS232/USB Adaptor

DavidMDavidM Posts: 630
edited 2011-02-20 23:14 in Propeller 1
Hi,

Many moons ago I designed and build an RS485 Interface board to work with the PROP, with a lot of help from users here.

I obviously need to write some code for this, So I need one end of my RS485 Board to Connect to my MAC's USB Port.

I have an RS232 to USB Adaptor ( that works with the mac), and was wondering how to hook up the pins on the DB9, to my RS485 Board,

I have attached the schematic, The part I want to connect to is the TOP LEFT where it says TO PROP CHIP.

Can this be done easily? I have a ribbon cable at this point.

Is it possible to MONITOR or SET other normally unused pins on the DB9, so I can control the 485 DRIVER, and to monitor the other outputs, Can I also power up the 485 Board via the USB to RS232 Adaptor?

I want to write code for my PROP DEVICE, get it to send data, and then monitor it on my mac.

I need to do it this way, BEFORE I write FULL WORKING CODE so that 2 or more PROP Devices can communicate.

My PROP Device is built and working, this board is an ADDTIONAL board.

I Promise I will SHARE my 485 Code, NO ONE has yet written a simple object for it yet?
I plan to write a wrapper method and just use the Extended FD Serial Object.


Thanks

DaveM

RS485-INTERFACE BOARD REV-Q.pdf

Comments

  • DavidMDavidM Posts: 630
    edited 2011-02-19 16:56
    Seems quiet around here!

    I have a RS232 to TTL convertor/adaptor that has a 6 pin header at one end, I have made up a schematic should how I can possible wire this up so I can use it with a RS232 to USB Converter that I also Have.

    I beleive I need to give this device 5V ( No problems )
    I belive that I need to hook up the RE & DE pins together and connect this to the RTS pin of the converter.

    I have attached a schematic showing this,

    Would this work?

    I also have a output called MS ( Master/Salve detect) that goes hi if my device is configured as a MASTER, Can this pin be detected using say the CTS line and feed that into my serial port application?

    thanks

    Dave M

    RS485toRS232.pdf
  • DavidMDavidM Posts: 630
    edited 2011-02-20 17:57
    can anyone help?

    dave M
  • Bill HenningBill Henning Posts: 6,445
    edited 2011-02-20 18:07
    It should work, I do something similar with my RS485Plug
  • DavidMDavidM Posts: 630
    edited 2011-02-20 21:47
    Ok,

    I have wired up a "RIG" I am not getting much happening

    Q1) Can the Extended_FDSerial Object be used for RS485?
    Q2) If so How do I treat the RE, DE pins?
    Q3) Are there any particular setting i need to have in the INIT of the serial Object?

    For now I just want to send a message to my serial port app on my mac.

    Thanks
    Dave M
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-20 22:47
    The Extended_FDSerial object is, as the name suggests, designed to handle a full duplex connection, so it can't handle control lines like RE and DE without changing the underlying FullDuplexSerial driver. That's possible to do, but non-trivial.

    Try using the Simple_Serial object and control the RE and DE lines each from one I/O pin. There's no buffering in the Simple_Serial object, so you'd change direction before starting to transmit and switch back to receive mode after transmitting a block of data or "automatically" when any of the receive routines are called.

    The Simple_Serial routines are limited to about 19200 Baud. If that's adequate, you could easily modify them to use a buffer and run in its own cog.
  • DavidMDavidM Posts: 630
    edited 2011-02-20 23:14
    HI Mike,

    Actually I just got it working!


    I was not enabling the 485 device ( at the MAC end) to receive, So i connected the RE & DE pins to GND and the messages starting flowing IN!

    So now I can RECEIVE data into my MAC SERIAL TERMINAL APP!!

    What I have discovered is,

    for TRANSMITTING..

    I set HIGH the DE & RE pins,
    send my message as a string using EXTENDED_FD Serial
    then I have to WAIT until that string has finished before I disable the DE & RE Pins,

    So far to send about 25 characters, I need about..

    WAITCNT(500_0000 + CNT)

    Any less than that for this amount characters and the message get cut of short!

    So As you said, I need a way to WAIT for the message to be finished transmitting, before disabling it.

    Any Suggestions,

    Is it true that the Serial OBJECT is Asynchronous, Can this be changed? I don't know anything about ASSEMBLY, spin I am pretty good with.


    thanks

    Dave M
Sign In or Register to comment.