PIC18F4550 with UMDF USB Driver

USB PICs and the UBW

Moderator: phalanx

Post Reply
at2
Posts: 1
Joined: Wed Mar 21, 2012 4:48 pm

PIC18F4550 with UMDF USB Driver

Post by at2 » Wed Mar 21, 2012 6:46 pm

Hi,

hardware <-> USB hardware firmware <-> WinUSB(as lower filter) <-> UMDF USB driver <-> App

Code: Select all

    
//main.c  main-loop
while(1)
    {
        USBDriverService();     // See usbdrv.c
        BootService();          // See boot.c
    }//end while

Code: Select all

// boot.c 
void BootService(void)
{
    BlinkUSBStatus();
......
I think this is the right point were the function must be placed?

Code: Select all

//boot.c
 switch(usb_device_state)
    	{
	    	case DETACHED_STATE:
	    		break;
	    	case ATTACHED_STATE:
	    		break;
	    	case ADDRESS_STATE:
	            break;
	        case POWERED_STATE:
	        	break;
	        case DEFAULT_STATE:
	        	break;
	        case CONFIGURED_STATE:
	            //if(led_count==0)
	            //{
	            //    mLED_1_Toggle();
	            //    mLED_2 = !mLED_1;       // Alternate blink                
	            //    mLED_3_Toggle();
	            //    mLED_4 = !mLED_3;       // Alternate blink                
	            //}//end if

                   //
                   // PLACE THE CODE???
                   //

	            break;
	        default:		//For POWERED_STATE and DEFAULT_STATE
	        	mLED_Both_On();
	        	break;
	    }    	
On the PortB are 8 buttons connected.
On the PortD are 8 leds connected.

Now I would poll if a button was pressed.
Press x button first time -> set status 1 -> LED ON
Press x second time -> set status 0 -> LED OFF

How should I begin?

regards,
at2

Post Reply