cancel
Showing results for 
Search instead for 
Did you mean: 

STM8s003k3 interfacing with a shift register

KRiaz.1
Associate II

Hi Everyone 

I want to interface hef 4094B shift register with stm8s003k3. I understand the general working of the shift register but right now I am confused about how to send data to the pins of the shift register. 

It would be a great help if someone just gives me hint on how to send data on input pins of hef 4094b shift register

Thanks

3 REPLIES 3

You'd use a GPIO to connect to the D pin, setting the next state.

The STR pin should be HIGH

The GPIO connected to CP is transitioned LOW-HIGH-LOW ( if starting LOW, just need to go HIGH, then back LOW)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Tom Schrauf
Associate II

You start with all three GPIO pins low,

The method you need is named "bit-banging". So you will require two or better three GPIO pins clocking out every bis and after all bits are in the shift register activate strobe.

Set the Pin attached to the D Input of the shift register accordingly and then toggle on (switch on/off) the CLK pin.

set next bit value and continue until all 8 bits have been banged out.

After shifting all 8 bits activate the Strobe pin so the internal states of the shift register are output at the 8 output pins of the 4094. If the strobe pin is active al the time the bitmap will "run" on your output pins while you shift the bits out. This is sometimes not wanted.

If you also need input pins this can be easily done by combining a shift in register sharing strobe, and clk pins and only requiring an additional input pin. shifting in and out can than be done within the same bit banging cycle and a function like:

uint8_t shiftInOut( uint8_t output)

In this case I think you have to activate the strobe line two times at the beginning (to latch the values into the shift in register) and after the bit banging cycle to latch the output values otherwise you get the input values from the last bit banging cycle.

Thanks