Shop OBEX P1 Docs P2 Docs Learn Events
Emulate a UART Over an I/O Expander — Parallax Forums

Emulate a UART Over an I/O Expander

ZaggyZaggy Posts: 10
edited 2005-02-23 22:51 in General Discussion
I have a Philips PCF8574P 8 bit I/O expander on my I2C bus. This expander connects to a DMC-8 motorcontroller, that accepts commands at TTL levels running at 9600,8,N,1. I am getting the signals to the DMC-8, but no luck yet. Is it possible to emulate an UART over an expander? If so, any help would be greatly appreciated. Also, should I being sending LSB or MSB first?


Joe

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-02-13 03:37
    You're trying to bit-bang serial via an output on the PCF8574?.... Since each bit at 9600 baud is 104 microseconds, I don't think this is something you're going to pull off with a Javelin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-02-17 21:06
    What Jon said. You need to realize that the 'UART' virtual device on the Javelin uses a Javelin timer (in an interrupt context) to send the properly timed 'bits' to implement an RS-232 signal. At 9600 baud, each bit is 104 uSec (ie very short).

    This is not easy, but the Javelin can do it. However, if you now try to get an I/O expander output pin to toggle that fast -- well, you need to send into the I/O expander at least 8 times faster, right? I don't think the I2C bus can run that fast.

    That's the basics of your problem in a nutshell. You MUST connect the DMC-8 directly to a Javelin pin for this to work.
  • ZaggyZaggy Posts: 10
    edited 2005-02-18 22:34
    Thank you both for your help on this issue. I was affraid that I could not do it with the Javelin. I have purchased some chips that connect RS232 to I2C. Hopefully this allows me to do what I want.

    PS Has anyone worked with a BL233 chip?

    Thanks
    Joe
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-02-23 15:13
    Doesn't the Javelin have a native I2C bus Virtual Peripheral? I realize the 'master' -- 'slave' issue exists, but I thought the Javelin could handle it.
  • ZaggyZaggy Posts: 10
    edited 2005-02-23 22:51
    allanlane5,

    Yes, you are correct about the I2C and I am currently using it. I am sorry I did not explain why I was doing this. I wanted to extend the I2C bus to over 300 feet and keep my cable count down to my remote unit to one cable. But this plan was getting crazy, so I have decided to go with 3 cables and forget extending the I2C bus. I plan on using a protocol that is built for the distance. I plan on going from RS232 to RS 422/485 and back to RS232 and where needed, to I2C.

    Joe
Sign In or Register to comment.