Maker Pro
Maker Pro

Why don't counter chips have a polarity sign?

  • Thread starter Product developer
  • Start date
P

Product developer

Jan 1, 1970
0
After designing a few quadrature interfaces using a variety of
counters from the usual suspects to the Agilent HCTL line I have yet
to find a chip with a polarity sign bit. One would think that there
are enough machine control applications where direction reversal will
require counting in a negative direction. Granted the index occurs
during zero of both direction's output allowing detection of the first
leading edge to set a flop for polarity but why this isn't a standard
function on the counter chip is beyond me.
 
T

Tim Wescott

Jan 1, 1970
0
Those chips count up or down depending on the shaft direction -- if you're
implementing a controller based on that you can just look at how much the
count has changed to know the magnitude and direction.
 
L

legg

Jan 1, 1970
0
After designing a few quadrature interfaces using a variety of
counters from the usual suspects to the Agilent HCTL line I have yet
to find a chip with a polarity sign bit. One would think that there
are enough machine control applications where direction reversal will
require counting in a negative direction. Granted the index occurs
during zero of both direction's output allowing detection of the first
leading edge to set a flop for polarity but why this isn't a standard
function on the counter chip is beyond me.

Surely, if you've got a counter that can count either up or down, then
the polarity bit is the bit instructing the count's direction.

RL
 
P

Paul Burke

Jan 1, 1970
0
Product said:
After designing a few quadrature interfaces using a variety of
counters from the usual suspects to the Agilent HCTL line I have yet
to find a chip with a polarity sign bit. One would think that there
are enough machine control applications where direction reversal will
require counting in a negative direction. Granted the index occurs
during zero of both direction's output allowing detection of the first
leading edge to set a flop for polarity but why this isn't a standard
function on the counter chip is beyond me.

Don't quite get what you mean. You can get direction of count by taking
two successive samples and subtracting. The MS bit of the binary output
word (2s comlpement) gives you the sign of the integrated position
(since last index of course). Perhaps you mean an output giving the
instantaneous direction of count? Easy enough to design your own with a
PLD, and probably a lot cheaper than HP anyway.

Paul Burke
 
F

Frank Bemelman

Jan 1, 1970
0
Product developer said:
After designing a few quadrature interfaces using a variety of
counters from the usual suspects to the Agilent HCTL line I have yet
to find a chip with a polarity sign bit. One would think that there
are enough machine control applications where direction reversal will
require counting in a negative direction. Granted the index occurs
during zero of both direction's output allowing detection of the first
leading edge to set a flop for polarity but why this isn't a standard
function on the counter chip is beyond me.

Doesn't the HCTL2020 have a pin 5 that gives U/D output signal?
Or do you want a signal telling the encoder has reversed past
the index again? That would cause problems if the size of the
counter is too small, once the counter overflows, it could never
detect that same spot again, and your signal is unreliable.

Such things are better done in software, or additional logic
that deals with the situations at hand.
 
S

Spehro Pefhany

Jan 1, 1970
0
Doesn't the HCTL2020 have a pin 5 that gives U/D output signal?
Or do you want a signal telling the encoder has reversed past
the index again? That would cause problems if the size of the
counter is too small, once the counter overflows, it could never
detect that same spot again, and your signal is unreliable.

Such things are better done in software, or additional logic
that deals with the situations at hand.

(I think) he means that the accumulated count should go
-3,-2,-1,0,1,2, 3 etc. like on a machine tool DRO. Firmware or PLD..


Best regards,
Spehro Pefhany
 
K

Keith R. Williams

Jan 1, 1970
0
Spehro Pefhany said:
(I think) he means that the accumulated count should go
-3,-2,-1,0,1,2, 3 etc. like on a machine tool DRO. Firmware or PLD..

Use an U/D counter and define the MSB as the sign bit.
 
K

Keith R. Williams

Jan 1, 1970
0
Are you sure?

Sure, the coding wasn't specified (I chose 2's compliment). ;-)

FD = -3
FE = -2
FF = -1
00 = 0
01 = 1
02 = 2
03 = 3
 
S

Spehro Pefhany

Jan 1, 1970
0
Are you sure?

If you're happy enough with two's complement. I think there's
typically a transformation that happens between the "raw" count on a
DRO and what gets displayed to the hairy-eared machinist, so it might
be as good as anything. For example, you want to switch between inches
and mm, and offset by some arbitrary amount. If there is no scaling
operation, counting in signed BCD or packed BCD might be more
sensible, as long integer to bcd is a pretty slow conversion.

Best regards,
Spehro Pefhany
 
F

Frank Bemelman

Jan 1, 1970
0
Spehro Pefhany > said:
If you're happy enough with two's complement. I think there's
typically a transformation that happens between the "raw" count on a
DRO and what gets displayed to the hairy-eared machinist, so it might
be as good as anything. For example, you want to switch between inches
and mm, and offset by some arbitrary amount. If there is no scaling
operation, counting in signed BCD or packed BCD might be more
sensible, as long integer to bcd is a pretty slow conversion.

Oh, I use sprintf for that ;-)
 
K

Keith R. Williams

Jan 1, 1970
0
Oh, I use sprintf for that ;-)

I don't think the "product developer" is going to be happy with the
sprintf "overhead" either. ;-)
[/QUOTE]
 
F

Frank Bemelman

Jan 1, 1970
0
Keith R. Williams said:
I don't think the "product developer" is going to be happy with the
sprintf "overhead" either. ;-)

I know what would make him happy, a controller with a
build-in quadrature decoder !
 
S

Spehro Pefhany

Jan 1, 1970
0
I know what would make him happy, a controller with a
build-in quadrature decoder !

Which one do you suggest? I think the Motorola TPU module can do it.

BTW, if it's just for indication, the sprintf may be just fine, once
you uncouple the maximum counting frequency frome the display update
rate. The former might be 1MHz on a CNC machine doing a rapid,
whil[e|st] updating a digital display more frequently than about 10Hz
is a waste (and sometimes bad in other ways).

Best regards,
Spehro Pefhany
 
P

Product developer

Jan 1, 1970
0
Keith R. Williams said:
Use an U/D counter and define the MSB as the sign bit.

You got it. In a dual direction system like a planetary in an vacuum
chamber there are times when you will want to reverse direction and
count below the index which will be a negative number. All counter
modules I know of have this feature built in. A polarity sign will
change from pos to neg when you go below zero or index.

In other words there are applications where you need to know what side
of the index you are on. If all you are doing is going continously in
one direction that is straight forward. You count from 0 to say 1,999
in a 2,000 CPR setup and every time you get an index you reset the
count which provides absolute position. In situations where you will
be traversing the index in both directions without completing a full
rotation you would get counts on either side of the index and without
polarity there is no way of knowing which side of the index you are
on. If the index is at 12 o'clock and the rotation of the wheel goes
back and forth from 10 o'clock to 2 o'clock you get the same count at
each position yet the position is not the same. A polarity or "sign"
bit would give this indication without the need for secondary decoding
of the index to direction relationship.
 
F

Frank Bemelman

Jan 1, 1970
0
Spehro Pefhany > said:
Which one do you suggest? I think the Motorola TPU module can do it.

Seems so, after a brief check. Strange that a QD is not (yet)
amongst the common standard peripherals found on controllers.
Thousands have been fighting this problem, and it can only
be done in software for digital encoder type *potentiometers*
or encoders with a low rpm and low resolution. The HCTL
solution are imo too expensive. So what we want are AVR's,
PIC's, SX's, 8051's with build-in QD's.

BTW, if it's just for indication, the sprintf may be just fine, once
you uncouple the maximum counting frequency frome the display update
rate. The former might be 1MHz on a CNC machine doing a rapid,
whil[e|st] updating a digital display more frequently than about 10Hz
is a waste (and sometimes bad in other ways).

Good advice. I tend to write software so that it does only
things once when nothing has changed, and do it at a rate
not faster than needed. The cycles saved are greatly appreciated
later ;) A few hundred years ago, on an apple][, I wrote a loop
that continously wrote a string with some numbers to the screen.
When it runned, it showed all kinds of funny artefacts, like
crossfading and disappearing, coming back again etc. Magic!
 
S

Spehro Pefhany

Jan 1, 1970
0
A few hundred years ago, on an apple][, I wrote a loop
that continously wrote a string with some numbers to the screen.
When it runned, it showed all kinds of funny artefacts, like
crossfading and disappearing, coming back again etc. Magic!

We can blame Woz for not buffering the data properly, I think.

Best regards,
Spehro Pefhany
 
F

Frank Bemelman

Jan 1, 1970
0
Spehro Pefhany > said:
A few hundred years ago, on an apple][, I wrote a loop
that continously wrote a string with some numbers to the screen.
When it runned, it showed all kinds of funny artefacts, like
crossfading and disappearing, coming back again etc. Magic!

We can blame Woz for not buffering the data properly, I think.

Not to mention Nipkov, Baird and Zworykin ;)
 
C

CBarn24050

Jan 1, 1970
0
several of the hitachi h8s and fujitsu 162lx chips have qdcounters
 
Top