PDA

View Full Version : Need help in VB codes to detect input switch of Picdem FS USB



jimmygan
- 14th December 2006, 15:02
I have a PICDEM FS USB demo board.
From www.comvcon.com , it explains on how to write a simple program to turn on the LED3 and LED4 of the demo board.
but what should i do if i wan to detect the input switch as well ?

the firmware in the PICDEM FS USB is Demo firmware, where RB5 is declared as digital input connected to switch S3. When S3 is press, the RB5 will be grounded.

How should i write the VB program so that when i press S3 on the demo board, my VB will detect it and display something ?
Is it possible without changing the firmware ?

sorry...newbie here.....im still a student..

comvcon
- 7th November 2007, 20:36
Hi,

In USB, host is always MASTER, and device is always SLAVE.

What it means is host always need to enquire the SLAVE about the required information.
Even to send some information to the device, the host first prepares the device for reception and then sends the data.

So, in this context.. In UserIO routine of the Bootloader you read the Key status, and store it in variable. From host send a command to enquire about the button status. Now, let the firmware send the response to the host when this request arrives.

Hope this helps.