Can I use an ATtiny analog comparator as RS422 receiver?

The background

I'm planning a project for an ATtiny841 which has two internal analog comparators.

I want a small physical size.

I have a RS422 signal to read (not serial data, it is actually a quadrature signal)

I notice the comparator can have selectable hysteresis and generate interrupts.

The signals will arrive from around 2 meters away via a screened twisted pair cable.

The questions

  1. Would it work?
  2. Is it a stupid idea? I have reservations about connecting a 2 meter "antenna" to the micro, possibly causing damage to the IC

Bob

bobdring:
I have a RS422 signal to read (not serial data, it is actually a quadrature signal)

"RS422" can, in practice, mean quite a range of actual voltage levels. It may be implemented as +-5v or so or might be more like RS485 and be +ve voltages only.

In any case, a few resistors should shift up and limit the voltages to within whatever voltage you are running the CPU at. If the environment is particularly noisy, you might need to add some catch diodes... but other than that I can't see why it should be a problem.

Yours,
TonyWilk

If it is not serial data, what is it?

Thanks for the replies.

jremington

It's a quadrature encoder. Two square wave signals with a 90 degree offset.

TonyWilk

In this particular case the encoder is powered from the micro VCC and GND, so there would be no problem with the voltage levels at least.

I will give it a try and report back when the chips arrive...

TonyWilk:
"RS422" can, in practice, mean quite a range of actual voltage levels. It may be implemented as +-5v or so or might be more like RS485 and be +ve voltages only.

In any case, a few resistors should shift up and limit the voltages to within whatever voltage you are running the CPU at. If the environment is particularly noisy, you might need to add some catch diodes... but other than that I can't see why it should be a problem.

Yours,
TonyWilk

RS-422 is so rare, I had to get the book to review it. RS-422 is a balanced circuit with voltages +-2 to +-6 volts DC. If the OP is not getting a balanced pair, it may be RS-423, voltage is 0 to 4-6 volts, unbalanced to ground.

Either circuit may have devices daisy chained together.

Paul

It's a quadrature encoder.

OK, not RS422. Use polling or interrupts. There are several perfectly functional encoder libraries.

jremington:
OK, not RS422.

Strictly speaking, that is true, although it used to be quite common for encoders to be described as "RS422 levels", some still are.

Ages ago "RS422" was usually +-5V differential levels, this drifted to 0-5V levels as less stuff was designed with -ve power rails. Depending on the range of the receiver device, this either made no difference, didn't work at all or worked some of the time - illustrating the joy of having a 'standard' and then corrupting its use.

Yours,
TonyWilk

TonyWilk:
Strictly speaking, that is true, although it used to be quite common for encoders to be described as "RS422 levels", some still are.

Ages ago "RS422" was usually +-5V differential levels, this drifted to 0-5V levels as less stuff was designed with -ve power rails. Depending on the range of the receiver device, this either made no difference, didn't work at all or worked some of the time - illustrating the joy of having a 'standard' and then corrupting its use.

Yours,
TonyWilk

So true. Everyone wants a standard for an industry. Then they proceed to violate so someone else can't integrate their product with the standard.

Paul

Whats the encoder pulse count and the max speed of the motor? You’ll be lucky to get 5KHz response out of two analog inputs.