I'm interested in using the SB70LC for, among other things, pulse counting. Certain devices provide a digital pulse (transition from logic high to low and back to high) denoting a unit of measure. For example, some flowmeters do this.
To count these events it will be necessary to sample an I/O line on a repetitive, priority basis.
The pulse events are expected to be no less than 1ms wide and occur at no greater than 200hz max. This means that we must sample an I/O line every 500us to catch a pulse (without any other interface).
Is the SB70LC capable of reliably sampling one of its I/O lines at this rate or is it better to use an i2c decade counter to provide some buffering?
Would be ideal to use a 32 bit i2c counter, but all I can find are dedicated to timekeeping applications.
SB70LC: counting external events with digital IO
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: SB70LC: counting external events with digital IO
See the app note at: http://www.netburner.com/downloads/mod5 ... rrupts.zip
You should be able to set up one of the EPORT pins to trigger an IRQ. The ISR can increment a 32 bit variable atomically each time it fires. I know these pins are available on the Mod5270, and they may be brought out on the SB70LC, not sure. 200Hz should be no problem. The 5270 Eports are schmidt triggers so the edges should also be pretty clean and should avoid multiple counts due to noisy edges. Some of the other NB devices have a pulse accumulator, although this device may only be on the 5213, and perhaps one of the 5234 eTPU pins. Check out the freescale manuals.
You should be able to set up one of the EPORT pins to trigger an IRQ. The ISR can increment a 32 bit variable atomically each time it fires. I know these pins are available on the Mod5270, and they may be brought out on the SB70LC, not sure. 200Hz should be no problem. The 5270 Eports are schmidt triggers so the edges should also be pretty clean and should avoid multiple counts due to noisy edges. Some of the other NB devices have a pulse accumulator, although this device may only be on the 5213, and perhaps one of the 5234 eTPU pins. Check out the freescale manuals.
Re: SB70LC: counting external events with digital IO
Thank you very much for that reference.
I had no idea that writing an ISR would be so easy under this processor.
Will update here as I progress...
I had no idea that writing an ISR would be so easy under this processor.
Will update here as I progress...