Hi there,
Is that your entire code?
Shouldn't be also something like: " include KBDDESC.ASM " in the main code ?
Regards
Rui
Wouldn't it shorten things to do this:
Code:if portb.7 = 1 then FOR i = 0 to 7 IF i = 2 then USBBuffer[i] = $33 ; 33=";" ELSE USBBuffer[i] = 0 ENDIF NEXT i gosub DoUSBOut ELSE ....clear buffer... ENDIF
Last edited by andywpg; - 15th September 2014 at 23:29.
"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"
-Stephen Hawking
Many Thanks, Its Working Now , And The Code Is Down , But Any One Knows How Can I Include Multimedia Keys (Play,Stopn, Mute . . .etc) , i know i must add it to usb descreptor but i never knows how , i read alot without luck .
DEFINE OSC 48
@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
@ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
@ __CONFIG _CONFIG4L, _LVP_OFF_4L &_XINST_OFF_4L
INCLUDE "DT_INTS-18.bas"
ASM
INT_LIST macro
INT_Handler USB_INT, _DoUSBService, ASM, yes
endm
INT_CREATE
endasm
USBBufferSizeTX con 8
USBBufferSizeRX con 8
USBBufferCount Var Byte
USBBufferIn var byte[8]
USBBufferOut Var Byte[8]
DataToSend var byte[8]
asm
SendUSB macro array
variable i=0
while i<8
MOVE?BB (array+i),(_USBBufferOut+i)
i+=1
endw
L?CALL _DoUSBOut
endm
endasm
SwHwInit:
GOSUB DoUSBinit:
Start:
clear
if portb.7 = 1 then
DATATOSEND[1] = 0
DATATOSEND[2] = 0
DATATOSEND[3] = $51 ; if i change it to be "80" >> volume up, it didnt work .
DATATOSEND[4] = 0
DATATOSEND[5] = 0
DATATOSEND[6] = 0
DATATOSEND[7] = 0
gosub DoUSBOut
else
clear
DATATOSEND[1] = 0
DATATOSEND[2] = 0
DATATOSEND[3] = 0
DATATOSEND[4] = 0
DATATOSEND[5] = 0
DATATOSEND[6] = 0
DATATOSEND[7] = 0
endif
@ SendUSB _DataToSend
gosub dousbin
goto start
DoUSBIn:
@ INT_DISABLE USB_INT
USBBufferCount = USBBufferSizeRX
USBService
USBIn 1, USBBufferin, USBBufferCount, Timeout
Timeout:
@ INT_ENABLE USB_INT
DoUSBOut:
@ INT_DISABLE USB_INT
WaitPC:
USBBufferCount = USBBufferSizeTX
USBService
USBOut 1, USBBufferOut, USBBufferCount, Waitpc
@ INT_ENABLE USB_INT
return
usb_device_state var byte EXT
CONFIGURED_STATE CON EXT
DoUSBinit:
pause 500
usbinit
repeat
usbservice
until usb_device_state = CONFIGURED_STATE
@ INT_ENABLE USB_INT
return
DoUSBService:
usbservice
@ INT_RETURN
Sorry , But Didn't work i tried it , Beside its just multimedia keybad not full qwerty & Media Keyboard .
You forgot element zero (length of 8 is from 0 to 7):
DATATOSEND[0] = 0
I can't help you with the keyboard command, sorry.
Robert
1. That PAUSE can screw up USB.Code:DoUSBinit: pause 500 usbinit repeat usbservice until usb_device_state = CONFIGURED_STATE @ INT_ENABLE USB_INT return
2. DT INT takes care of USB INIT for you.
3. You shouldn't have to write your own assembler routines for USB, they should be available in DT INT.
4. I didn't see ReEnterPBP-18.bas included.
Robert
Bookmarks