This is code for keyboard emulation(some keys) and kbddecs. It's work fine(sending ).
This is code for keyboard emulation(some keys) and kbddecs. It's work fine(sending ).
Last edited by faaktoo; - 5th June 2008 at 15:10. Reason: I forgat files
Dousbin:
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive
USBIn 1, USBBuffer, USBBufferCount, Dousbin ' read data, if available
If USBBuffer[?] = ? then
PORTA = %00000001
else
PORTA = %00000000
endif
return
I'm tried If USBBuffer > 0 then
PS
Are "KBDDESCMOJA" OK?
Dousbin:
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive
USBIn 1, USBBuffer, USBBufferCount, Dousbin ' read data, if available
If USBBuffer[?] = ? then
PORTA = %00000010
else
PORTA = %00000000
endif
return
I'm tried
If USBBuffer > 0 then 'If recieve anything
PORTA = %00000010
endif
but nothing hepend
My friend it programing on VB6 and he give me a small prog for sending commands for LED's(ON-OFF).
PS
Are "KBDDESCMOJA" OK?
If you looked in the other thread you would see the answer. You need to read the USB HID Class Device Description document from usb.org. In this document it tells you the exact format of the packet that the computer sends that has the status of the CAP Lock and other signals. You need to process this OUT packet.
Tim Barr
How many bytes USB keyboard receives? When? Where is LED's data stored?
Ok Faaktoo
Firstly the caps, numlock status are sent as bits in byte zero sent from the pc. These are are always sent from the pc on every DoUSBin service.
If you want to display the status of the caps, num lock, scroll lock on your pic than you could put some LEDs on a port and assign var to them , example:Code:' BYTE 0 - LEDS STATUS (USBIN, OUTPUT REPORT) 'BIT 0 = NUM LOCK 'BIT 1 = CAPS LOCK 'BIT 2 = SCROLL LOCK 'BIT 3 = COMPOSE 'BIT 4 = KANA 'BIT <5:7> = NOT USED PADDED DATA
If this bit is 1, the led is on. If it is 0, the led is off.Code:' the leds NUM VAR PORTB.0 CAPS VAR PORTB.1 SCRL VAR PORTB.2
Than in your main program your can display the satus of the scroll lock etc in a DoUSBin routine.
Example
To display the status of the Caps lock, Num lock etc on the keyboard (ie simulate the key press on a button connected to your pic) just send the key number for the caps, num lock etc as part of your DoUSBout Bytes.Code:' ------------------------------------------------------------------------------ DoUSBIn: ' ======================================= ' Check and receive data from the USB bus ' ======================================= USBBufferCount = USBBufferSizeRX ' RX buffer size USBService ' keep connection alive USBIn 1, USBBufferin, USBBufferCount, SHOWLEDS SHOWLEDS: NUM = USBBufferin.0(0) ' num lock CAPS = USBBufferin.0(1) ' Caps lock SCRL = USBBufferin.0(2) ' Scoll lock return
For caps lock it is $39
For scroll Lock it is $47
For num lock it is $53.
BTW, You still haven't said please yet.![]()
Last edited by Squibcakes; - 13th June 2008 at 01:35.
Why is this so hard to
find,
download
and use a USB sniffer as suggested many time here?
HHDSoft USB Monitor is one of the thousand one available.
BTW, You still haven't said please yet.
Who's your daddy huh?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks