This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Best way to read hall sensor

Other Parts Discussed in Thread: CC2530

Hi,

I am working with the CC2530 on an application where I need to control the rotation of a motor. The motor has a hall sensor and as it rotates the hall sensor emits digital pulses from 90HZ to 180HZ. The hall sensor output is connected to one of the I/O ports of the CC2530. I need to count the pulses to figure out the rotation and movement of the motor. What is the best way to accomplish this in your experience? By using one of the hardware timers in input capture mode? Or by setting the input as a key and count each pulse with a callback function or an interrupt? Any suggestions are highly welcome!

Thanks in advance for your comments.

 

Federico

  • Hi Federico,

    Unless you need to time each input pulse, you don't need to use the Input Capture mode of a timer. It would then suffice to use an interrupt routine. 180Hz would mean a period of >5ms. This is more than enough to update a counter using the CPU.

    Be careful with the kind of pulses you send, you might have to implement some kind of debouncing to avoid unwanted interrupts.

     

    Best regards,

    Torbjørn