using decoders without clock pin ?

HI all,

I am using thge arduino to replicate a model railroad level crossing, eg. 3 led's to

resemble traffic lights and a 3v motor raising and lowering the barrier.

So far i have messed around controlling it via a remote control with a L293 to control the

motor through pwm. I have this working perfect after a lot of learning but i want to go

further. I have about 10 4-16 decoders/ demultiplexers that i would like to use in

conjunction with the arduino to control 10 "level crossings" but this is a serious amount of

arduino pins and to be honest would just be extreemly sloppy.

After reading the datasheet over and over I have been able to get the decoders to function

as demultiplexers using the 4 pins to make each pin high or low using the high or low

arangements from the datasheet, but i actually wanted to send the binary bits to the decoder

to sellect which pin is high or low. From what i read my decoders are able to do this but i

just cant work it out. I have been reading for 2 days now and i think at this stage im just

confussing myself more and more.
MY basic problem is clock pin, i cant work it out with these decoders. Do they have one ?

are they the same as decoders with a clock pin ? anything i read or try uses clock pin. I

suppose my basic question is how to use these decoders before i break my pressios arduino.

Its driving me crazy at this stage (nothing worse than feeling stupid) i dont want to give

up even tho im close. Am i just missing something simple or am i way off ? I presumed i

could use a couple of 4-16 decoders but only use 5 or 6 of arduino pins excluding the power(seperate source) and just sent a series of 0's and 1's to controll each output.

If someone could point me in the right direction i would really appriciate it
I have 3 different types of latch decoders 74hc259n, cd74hc4514ene4, cd4514bee4.
arduino mega 2560

The decoder has a truth table

Each rail road motor or light can be connected to one output of 16 outputs. The 4 pins from Arduino go to 4 pins of each of 10 decoders, all the same wiring. The 10 lights are activated by wiring a different output from each decoder, like y1 for light 1 , y2 for motor 2, y3 for tressle 3. The clock is a fifth pin from Arduino to Enable E all decoders after the signals settle, so it does not get glitches.

I don't think the 4514 is the IC you want.
I believe having looked through the datasheet that all outputs are 0 apart from the one which is addressed which is equal to !E.
The output data cannot be latched, so if you say have address 0 selected and output a 1, when you move on to select address 1, then the output Y0 returns to being 0.

The 74hc259n seems more promising. That has an output latch which can be set up to remember the previous state. There is no clock, but there is a Latch pin which you can use as one - basically you set the address of the pin you are interested in, then set the data pin to the state you require, finally set the LE pin LOW, and within a short period (usually <100ns), the data will be latched in. You should then set the LE pin back HIGH to prevent any further changes until you are ready to change another output. For this to work, the MR pin should be connected to +5v.
You can connect multiple 74hc259s in a circuit. Simply use the same Data and Address lines for each (so that means you only need 4 common pins), and then have a separate output for each LE pin (this allows you to select which decoder should change its data).
So:
8 Outputs = 5 pins, 1 decoder
16 Outputs = 6 pins, 2 decoder
24 Outputs = 7 pins, 3 decoders
and so on.

If you have the parts already, then perhaps a bank of shift registers in front of them is what is needed.
Use 4 bits from each shift register to latch the data for a decoder, 2 decoders per shift register.
Shift the data to all crossings together, update them all at once. If a crossing is not change, just send it the same data anyway.

guys thank's so much for your replies, 3 replies have educated me more than Google did all morning :blush: so thanks again. I guess its a bit of "back to the drawing board" but with a lot more knowledge. At-least I didn't give up I suppose :roll_eyes:
" a bank of shift registers " now that sounds like a task (i love tasks btw) but here goes ...
thanks for the point in the right direction

guys i think ill just try start from scratch and iron out this confusion in my head before it explodes ...
Is it possible to use any of the decoders i have to complete the shift out tutorial ?
or should i just purchase a 74HC595 ?

I would try another way. There are cheap and 'easy to connect' modules on Ebay to make LCD displays serial. They convert I2C to seven or eight pins, and cost less than two dollars each. Up to eight of them can be connected to the same I2C-bus at the same time, so you can have a thin cable to each crossing and put one or two modules there.
The only drawback is that using I2C is somewhat slow, it will take a ms or two to send the command, so I guess it is not a good way to send PWM signals, but for traffic lights and sensors they are good. (They are semi-bi-directional, but I have not experimented with them as inputs.) I think the controllers name is PCF8574.

Search Ebay for "LCD I2C serial interface" or similar.

Well, you could just use shift register straight up without the decoders.
10 crossings, 3 lights each, is 30 IO pins. So 4 shift registers would do it, providing 32 IO with 3 or 4 pins committed on the Arduino.

The stuff on the left you'll recognize as an arduino less its USB interface, the 4 chips on the right are TCIP6B595 open drain shift registers, designed for things like sinking 20mA of current thru 8 LEDs. Preferred over 74HC595 with its 70mA absolute max current control capacity (so 8-9mA per output max).

Thanks for the homework guys its much appreciated, ill report back how i get on.