0
Offline
Newbie
Karma: 0
Posts: 46
Arduino rocks
|
 |
« on: October 31, 2012, 10:04:27 am » |
I have a piece of equipment that I am trying to hack together to make it do my bidding, and need a basic little logic circuit to do the job. I know this could easily be done with the Arduino, but I thought it would be a little overkill for this task.
I have a optical gate that counts mechanical teeth. I need the current microcontroller (out of my control) to count the teeth, but instead of 5 counts, I want it to see 4. I need it to control the motor 1 more click than it is now. I am thinking this may be able to be dealt with some logic gates, where it throws out the first click, and only counts the next four?
Voltage levels are in the 5v range, so logic gates should easily handle the job. The speed is slow in the world of electronics, Hz range I would guess.
Any suggestions?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #1 on: October 31, 2012, 10:16:12 am » |
It is fairly difficult to do with the gates.
I would use a 8pdip avr and program it for that.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 72
Posts: 6628
Arduino rocks
|
 |
« Reply #2 on: October 31, 2012, 11:27:23 am » |
It is fairly difficult to do with the gates.
I would use a 8pdip avr and program it for that.
Actually its impossible to do with just gates - you need at least a monostable or timer or equivalent to provide elapsed time information - you need to distinguish the starting pulse of a train of pulses based on the delay since the last pulse.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #3 on: October 31, 2012, 11:57:41 am » |
If I have to do it with logic gates, I would use a pll (4046) with a 4x divider and run the signal from the pll through a 1:5 divider.
So a 5khz signal into the pll will generate a 20khz output signal. Dividing that by 5 gives you a 4khz signal.
Overly complicated in my view.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 72
Posts: 6628
Arduino rocks
|
 |
« Reply #4 on: November 01, 2012, 08:33:52 am » |
Can the OP clarify if there are 5 teeth, or if the issue is frequency dividing - I thought it might be a case of counting distinct groups of 5 pulses.
If its a continuous signal you could use a divide-by-5 counter to gate the pulses.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #5 on: November 01, 2012, 08:45:46 am » |
The problem sounds like changing hardware vs. fixed software. The software is expected 4 pulses while the hardware is generating 5 pulses: for example, you have changed your encoder (from a 400-ppr encoder to a 500-ppr encoder, for example) but not able to rewrite the software.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 46
Arduino rocks
|
 |
« Reply #6 on: November 01, 2012, 11:27:10 am » |
dhenry is correct. I have a mechanical gear that the teeth are counted by a optical sensor. I want the gear to advance 5 teeth, but the software won't let it. My thought was that with a little board in the middle, I could have the base software only 'see' 4 pulses. I thought I might be able to just throw out the first pulse, and allow the rest to pass. The frequency of the pulses does not seem to be important, and the software doesn't even care how long the pulses take to get there (jammed hardware will run until the drive belt it gone, regardless of how long). This is to control a conveyor advancement mechanism,
I could use more than just gates, I was just trying to keep it simple if possible. However, if it takes more than a handful of chips, I might as well just use a microcontroller.
Thanks for the input though. Jim
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9421
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #7 on: November 01, 2012, 02:05:16 pm » |
I want it to see 4. Can you explain more precisely why you want to see 4 instead of 5?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 117
|
 |
« Reply #8 on: November 01, 2012, 04:35:09 pm » |
A long time ago they made rate multipliers (74167 is a decade one) . You could set the rate you wanted on the BCD pins and for every 10 clocks into it you could get out from 0-9 pulses. So all you would have to do is set it for 8 pulses and then for every 10 (5*2) you would get 8(4*2). The pulses would not be evenly distributed (jitter) but in your case it wouldn't matter.
In old nc machines this was a method for doing linear and circular interpolation without the need of a cpu.
I still have some in my junk drawer.
|
|
|
|
« Last Edit: November 01, 2012, 06:52:13 pm by justone »
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #9 on: November 02, 2012, 09:16:39 am » |
That (hc167) is actually an interesting chip. I have never seen it before.
|
|
|
|
|
Logged
|
|
|
|
|
|