nsw1216
Member level 3
I am creating a firmware for PIC18F4550 with the function of BlinkUSBStatus inside. But when i toggle one of my other LEDs from on to off or vice versa, the blinking LED stops blinking. I am wondering why it will stops blinking.
Actually the purpose of the blinking LED is to indicate the data transferring between the USB device and the PC. But once i toggle my LEDs, it stops blinking.
Anyone have any ideas towards this problem ?
Your replies are most welcome and appreciated.
Below is the code for the BlinkUSBStatus function.
Thank you.
Actually the purpose of the blinking LED is to indicate the data transferring between the USB device and the PC. But once i toggle my LEDs, it stops blinking.
Anyone have any ideas towards this problem ?
Your replies are most welcome and appreciated.
Below is the code for the BlinkUSBStatus function.
Code:
void BlinkUSBStatus(void)
{
static WORD led_count=0;
if(led_count == 0)led_count = 10000U;
led_count--;
if(USBSuspendControl == 1)
{
if(led_count==0)
{
mLED_3_Toggle();
}//end if
}
else
{
if(USBDeviceState == DETACHED_STATE)
{
mLED_3_Off()
}
else if(USBDeviceState == ATTACHED_STATE)
{
mLED_3_On()
}
else if(USBDeviceState == POWERED_STATE)
{
mLED_3_On()
}
else if(USBDeviceState == DEFAULT_STATE)
{
mLED_3_On()
}
else if(USBDeviceState == ADDRESS_STATE)
{
if(led_count == 0)
{
mLED_3_Toggle();
}//end if
}
else if(USBDeviceState == CONFIGURED_STATE)
{
if(led_count==0)
{
mLED_3_Toggle();
}//end if
}
}
}
Thank you.