hi
I am using 74hc595 shift register interfaced with freescale HCS12 controller.i am using 3 74hc595 Ic for interfacing anf I am glowing 20 LEDs using it.
My problem is that when I am setting single LED at a time.This led is setting on correctly but I am getting fluctuations on all LEDs. my code is like this .``
CPU_LED_LATCH =0;
CPU_LED_ENABLE = 0;
ulVal is the input to drive any LED.
ucShiftValue = (ulVal >> 16) & 0xff;
uci=8;
while (uci > 0)
{
CPU_LED_SRCLK=0;
if((ucShiftValue & 0x80)==0x80)
CPU_LED_DATA=1;
else
CPU_LED_DATA=0;
CPU_LED_SRCLK = 1;
ucShiftValue = ucShiftValue << 1; // Shift left or one bit
uci--;
}
ucShiftValue = (ulVal >> 8) & 0xff;
uci=8;
while (uci > 0)
{
CPU_LED_SRCLK=0;
if((ucShiftValue & 0x80)==0x80)
CPU_LED_DATA=1;
else
CPU_LED_DATA=0;
CPU_LED_SRCLK = 1;
ucShiftValue = ucShiftValue << 1; // Shift left or one bit
uci--;
}
ucShiftValue = ulVal & 0xff;
uci=8;
while (uci > 0)
{
CPU_LED_SRCLK=0;
if((ucShiftValue & 0x80)==0x80)
CPU_LED_DATA=1;
else
CPU_LED_DATA=0;
CPU_LED_SRCLK = 1;
ucShiftValue = ucShiftValue << 1; // Shift left or one bit
uci--;
}
CPU_LED_LATCH=1;
DOes anyone know what is the problem ?n how can I get single LED on at at ime with no fluctions on other LEDs.