sp2012
Junior Member level 3
Hi to all,
I am using 8051 and two 74HC595 shift register to control 16 leds.
In my schematics:
1st HC595 QA to QH connected to 8 leds
and
2nd HC595 QA to QH connected to next 8 leds.
1st HC595 Clock and 2st HC595 Clock pin connect to P1.2
1st HC595 latch and 2st HC595 latch pin connect to P1.3
1st HC595 serial data input connected to P1.4
and 1st HC595 QH'(9th pin) connected to 2nd HC595 serial data(14th pin)
and gnd(8 and 13th pin),vcc(16 and 10th pin) both HC595 given.
Thats all in schematics.
and my code are:
Here in my led output
1st HC595 4leds on
and
2nd HC595 4leds on.
I need to toggle one by one leds.
Can anybody guide me how to do this please?
Regards
surya
I am using 8051 and two 74HC595 shift register to control 16 leds.
In my schematics:
1st HC595 QA to QH connected to 8 leds
and
2nd HC595 QA to QH connected to next 8 leds.
1st HC595 Clock and 2st HC595 Clock pin connect to P1.2
1st HC595 latch and 2st HC595 latch pin connect to P1.3
1st HC595 serial data input connected to P1.4
and 1st HC595 QH'(9th pin) connected to 2nd HC595 serial data(14th pin)
and gnd(8 and 13th pin),vcc(16 and 10th pin) both HC595 given.
Thats all in schematics.
and my code are:
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 27 28 void delay(int a) { int i; for(i=0;i<a;i++); //null statement } void HC595_DISPLAY(unsigned char dat) { HC_LATCH = 0; HC_CLK=0; for(cnt=0;cnt<8;cnt++) { HC_DATA = dat & 0x01; HC_CLK = 1; delay(2); HC_CLK = 0; delay(2); dat = dat >> 1; } HC_LATCH = 1; } int main() { while(1) { HC595_DISPLAY(0xf0); } }
Here in my led output
1st HC595 4leds on
and
2nd HC595 4leds on.
I need to toggle one by one leds.
Can anybody guide me how to do this please?
Regards
surya
Last edited by a moderator: