Counter for I2C ?

K

Kaido Kert

Guest
Im looking for a solution of a simple homebrew incremental shaft encoder for
robot navigation.
I only have single sensor looking at encoder wheel, as i dont need
directional information ( i know which way the wheel is turning), so i only
need to count the impulses while moving, to get correct positioning info.
Tried to do that with Basic Stamp ( BS2 ), obviosly its just too slow for
simultaneously controlling servos AND monitoring encoders.
So i thought, im gonna just put a simpe counter to do the job, but then i'll
need loads of inputs on micro to read it. Well BS2 is able to read I2C
pretty good, so i started looking for a chip that could count and be read
over I2C.
The closest matches seem to be various Philips I2C clock/calendar chips like
PCF8583 and PCF8593.
The whole family is listed here:
http://www.philips.semiconductors.com/cgi-bin/catalog/catalog.pl/42460/42472
/index.html

Unfortunately i havent found any sample circuits/info on how to run it in
event-counting mode. Does anyone have any info, or could someone suggest
alternative solution ?
I really would like to have a dedicated chip for encoder. I already went
through trying to use old serial and PS2 mouse parts for encoder readings.
Serial mouse could be connected to BS2, through MAX232 or somesuch. But i
wasnt figure out how to turn it to "remote" mode, and thus it would need to
be polled constantly thus still being unable to control the servos properly.
PS/2 mice can be switched to "remote" or accumulated mode easily and they
can count up to 256 pulses before overflowing. But BS2 is just too slow to
talk over PS/2 bus directly. I could use the PAK-VIa PS/2 coprocessor (
http://www.al-williams.com/pak6.htm ), but its gonna take some time to order
it, and im not so sure its gonna work so well.

So, any ideas ?

-kert
 
On Tue, 9 Sep 2003 13:45:31 +0300, "Kaido Kert"
<kaido_kert@hotmail.com> wrote:
Im looking for a solution of a simple homebrew incremental shaft encoder for
robot navigation.
I only have single sensor looking at encoder wheel, as i dont need
directional information ( i know which way the wheel is turning), so i only
need to count the impulses while moving, to get correct positioning info.
Tried to do that with Basic Stamp ( BS2 ), obviosly its just too slow for
simultaneously controlling servos AND monitoring encoders.
So i thought, im gonna just put a simpe counter to do the job, but then i'll
need loads of inputs on micro to read it. Well BS2 is able to read I2C
pretty good, so i started looking for a chip that could count and be read
over I2C.
What is the max. frequency you are counting? And how many pulses do
you want to count? Maybe you could use a simple I2C io chip (Philips)
with a separate hardware counter?

I have never used the BS2. Doesn't it have interrupt inputs? If so,
you that for counting.

The closest matches seem to be various Philips I2C clock/calendar chips like
PCF8583 and PCF8593.
The whole family is listed here:
http://www.philips.semiconductors.com/cgi-bin/catalog/catalog.pl/42460/42472
/index.html

Unfortunately i havent found any sample circuits/info on how to run it in
event-counting mode. Does anyone have any info, or could someone suggest
alternative solution ?
I would use a separate processor, and build some slave I2C software in
it. And count on interrupt base, so it can run simultaneously with
I2C. Is have made such things before.

I really would like to have a dedicated chip for encoder. I already went
through trying to use old serial and PS2 mouse parts for encoder readings.
Serial mouse could be connected to BS2, through MAX232 or somesuch. But i
wasnt figure out how to turn it to "remote" mode, and thus it would need to
be polled constantly thus still being unable to control the servos properly.
You really should try to have things run simultaneously. For example:
I made software for controlling stable temperatures, where the main
loop did the control, check setpoints etc. A 20 msec timerinterrupt
did the user interface, mainly leds so values would readout fast. A
fast (I think it was 1 msec or so) timerinterrupt did PWM control, it
got the pwm data from the main program. And then there were i/o
interrupt for warnings etc. Once you know how to program it makes
small processors very powerful, and multitasking. But you do need
interrupts!

Regards,

Pieter Hoeben
 

Welcome to EDABoard.com

Sponsor

Back
Top