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.
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 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:
' the leds
NUM VAR PORTB.0
CAPS VAR PORTB.1
SCRL VAR PORTB.2
If this bit is 1, the led is on. If it is 0, the led is off.
Than in your main program your can display the satus of the scroll lock etc in a DoUSBin routine.
Example
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
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.
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.
Bookmarks