this
Member level 2
Hi there.
I want to control CD4094B with PIC12F509.
I've connected Clock(CL), Data(DT), Strbe(ST) and Enable(EN) to my pic, and 8 leds to 4094 outputs.
As far as I understand datasheet, procedure is:
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q9
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q8
...
...
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q1
put inpulse on Strobe(0,1)
Setting Enable = 1 should activate output.
So my code looks like this:
I was expecting all leds to flash every 200 ms, but instead they're flashing in some random manner.
What am I missing here?
Actually what does mean that my 4094 is "3 state"?
Thanks
I want to control CD4094B with PIC12F509.
I've connected Clock(CL), Data(DT), Strbe(ST) and Enable(EN) to my pic, and 8 leds to 4094 outputs.
As far as I understand datasheet, procedure is:
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q9
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q8
...
...
Set Data pin (0||1), put impulse on Clock pin(0,1) <- this will become output Q1
put inpulse on Strobe(0,1)
Setting Enable = 1 should activate output.
So my code looks like this:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 void set4094(unsigned char c) { EN = 0; for(unsigned char i = 0; i<8;i++) //iterate through char bits { DT = (c&(1<<i)) ? 1 : 0; //set data CL = 1; //pulse on clock CL = 0; } ST = 1; //pulse on strobe ST = 0; EN = 1; //enable output } void main() { TRIS = 0; //set all ports output while(1) { set4094(0); //all 4094 outputs low __delay_ms(200); //wait a bit set4094(0xFF); //all 4094 outputs high __delay_ms(200); //wait a bit } //repeat forever }
I was expecting all leds to flash every 200 ms, but instead they're flashing in some random manner.
What am I missing here?
Actually what does mean that my 4094 is "3 state"?
Thanks