Pulse-Stretching, using an SX controller
Hi all,
for an motor control application with the SX, I need to detect and count tacho pulses generated by two motors. It turned out that these pulses were fairly short (about 8µs) and due to noise induced in the cable between the motors and the box with the controller, pulse-counting was wrong. As the pulses were that short, filtering out noise at the controller inputs did not work, because the "real" tacho pulses were filtered as well.
As the time between two pulses is 15ms (at maximum motor RPM), or higher (at lower motor speeds), I had the idea to stretch the pulses to approximately 8 ms, using two NE555s located close to the motors. It turned out that the pulses had the wrong polarity for the NE555s, so I would have needed two additional inverters. Instead, I decided to use a dedicated SX 28 for pulse-stretching. As timing here is not that ctitical at all, I use the internal 4MHz clock generator in order to minimize the component count. This SX is located in a box close to the motors, and I use additional level shifters at the SX outputs to raise the pulse level up to 24 Volts for additional noise immunity along the cable.
Please find addached the assembly program for the pulse stretcher. This code handles two inputs using the edge-detect feature of port B. If you like, you can easily enhance the code to handle up to eight inputs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
Günther
for an motor control application with the SX, I need to detect and count tacho pulses generated by two motors. It turned out that these pulses were fairly short (about 8µs) and due to noise induced in the cable between the motors and the box with the controller, pulse-counting was wrong. As the pulses were that short, filtering out noise at the controller inputs did not work, because the "real" tacho pulses were filtered as well.
As the time between two pulses is 15ms (at maximum motor RPM), or higher (at lower motor speeds), I had the idea to stretch the pulses to approximately 8 ms, using two NE555s located close to the motors. It turned out that the pulses had the wrong polarity for the NE555s, so I would have needed two additional inverters. Instead, I decided to use a dedicated SX 28 for pulse-stretching. As timing here is not that ctitical at all, I use the internal 4MHz clock generator in order to minimize the component count. This SX is located in a box close to the motors, and I use additional level shifters at the SX outputs to raise the pulse level up to 24 Volts for additional noise immunity along the cable.
Please find addached the assembly program for the pulse stretcher. This code handles two inputs using the edge-detect feature of port B. If you like, you can easily enhance the code to handle up to eight inputs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
Günther