I aquired an hctl2000 ic which is used to count the position of a quadraturre decoder so the microprocessor doesn't have to It has a 12bit number of the location read by an 8bit bus, however im slightly confused about reading it, it has some sort of inhibit logic im only planning on reading the last 8 bits so im gonna tie the sel pin low, selecting the lower bit however im slightly confused about the oe pin, do I need to set that high every time I want to read the byte and then set it back? I was planning on just tieng the 8bit bus and using the pin register to get my location byte directly from a port without having to do extra, is there a way I can do this? Or am I reading the datasheet wrong and it'll work how I hope link http://www.avagotech.com/docs/5988-5895EN
SEL pin stays high for the lower eight bits. You set OE low when you want to read the eight data pins.
Doing the above, however, means you will not activate the inhibit and the data pins could change value while you're reading them ("When only 8-bits of count are required, a simple 8-bit (1-byte) mode is available by holding SEL high continuously. This disables the inhibit logic"). To prevent this you should dip the SEL pin low and then back high to enable inhibit. As soon as OE goes high afterward then inhibit is turned off.
(that's my read on it)
I think the best solution is to read both high and low bytes and ignore the high byte - some day you might want the high byte, and the inhibit logic will DTRT. Without the inhibit logic you will get errors as far as I can see, so you need to drive the SEL line anyhow.
I had a look once for a nice counter chip with a serial interface but they seem to prefer parallel interfaces which is a bit annoying.
So you think it would be best to drive both the sel and oe pin?
Do what the datasheet says will work - the timing diagram says than both SEL and OE must be used to control the internal inhibit so you can't just wire one permanently... Bit of a shame, most counter chips just provide a separate clock to copy counter to storage register and the output enable just does output enable. This chip is designed as a memory-mapped microprocessor support chip, not a microcontroller peripheral.
I guess ill have to give up two more I/0 then, good thing I don’t need much since im already using half of what I got just for a quadrature decoder
but atleast it will be faster than counting on the arduino
Indeed - it is a hassle. I used a 74LV8154 counter for a frequency meter and wanted to also drive lots of LED 7-segment displays (run out of pins problem). Piping the parallel output of the counter through a parallel->serial shift register meant I could reduce the pin count to 4, 3 of which were clocks - to sample the count, to feed out the bits and to switch between high and low bytes i think. So consider a shift register if you run out of pins.
I liked the speed and simplicity of just reading the portand of other hardware doing the menial work, I think I have an old octal latch ic, perhaps I will set that and something else to buffer the parallel so I don't need the atmega328 to clock it