Shop OBEX P1 Docs P2 Docs Learn Events
Peer Review, Please : Half-Duplex EIA-485 Driver — Parallax Forums

Peer Review, Please : Half-Duplex EIA-485 Driver

JonnyMacJonnyMac Posts: 9,235
edited 2011-09-26 17:17 in Propeller 1
EFX-TEK has a new product coming that has a MAX489 built in so I wanted to write a straightforward, half-duplex driver (keeping things simple) for networked projects. It works, I'm just looking for review and feedback in case I did something silly and just got lucky.

I'd also appreciate thoughts on adding parity (8E1, 8O1 for MODBUS).

Thanks.

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-09-26 07:45
    Just two things from a quick glance, in the start method you should setup ok as alias for result and not as a local variable. Or scrap the whole ok[ay] business and use
    return cog := cognew(@hd485, @rxhead) + 1
    
    Also, why bother with clearing the input buffer? rxtail == rxhead means empty which is already done in the longfill.
  • Tracy AllenTracy Allen Posts: 6,667
    edited 2011-09-26 09:04
    The voltage divider on rx should be 5k/10k, to bring the 5V output of the MAX485 down to 3.3 for the Prop. (not 3.3k/10k?) There are Vcc=3.3V versions of the '485 available.

    Since it is half duplex, what do you think of tying RO and DI together to one Prop pin? RO is high Z when RE\ is high.

    It may not matter for your app, but for some battery powered systems the shutdown mode can be useful (RE\=high, DE=low).
  • kuronekokuroneko Posts: 3,623
    edited 2011-09-26 17:17
    Re: data-off-chip, it may be beneficial to delay the txtail update until after the character has been sent. This way you can avoid the waitcnt in tx_flush.
Sign In or Register to comment.