******************************************
' Test values for Endpoint 1 IN Variables:
******************************************
TEST_WIDGET_INPUTDATA con 170
' Test values for Endpoint 1 OUT Variables:
******************************************
TEST_WIDGET_OUTPUTDATA con 85
' Endpoint 1 IN variables:
******************************************
widget_inputdata var byte
' Endpoint 1 OUT variables:
******************************************
widget_outputdata var byte
******************************************
' Widget_Interface_0
' Add code here to generate data to transmit to PC via Endpoint 1 In
' This code should:
' set flag EP1XmtDataReady = TRUE if there is new data to send out,
' or set flag EP1XmtDataReady = FALSE if data has NOT changed
' Test values for EP1 In (In to PC host):
widget_inputdata = TEST_WIDGET_INPUTDATA
EP1XmtDataReady = TRUE
' Receive Endpoint Snippet****************
asm
movlw low (Ep1RcvVarTable) ; Point to Ep1 Rcv VarTable
movwf TBLPTRL
movlw high (Ep1RcvVarTable)
movwf TBLPTRH
movlw 1 ; Select EP1
call UnPacket
movlb high (AsmPackResult) ; Point to proper bank
movwf AsmPackResult
endasm
' Transmit Endpoint Snippet****************
asm
movlw low (Ep1XmtVarTable) ; Point to Ep1 Xmt VarTable
movwf TBLPTRL
movlw high (Ep1XmtVarTable)
movwf TBLPTRH
movlw 1 ; Select EP1
call PackandShipPacket
movlb high (AsmPackResult) ; Point to proper bank
movwf AsmPackResult
endasm
Listing 1—This is a peek
at the USB Widget peripheral code. All I really want you to get from this is how
the data and endpoints are specified to the PIC. Also note that the data is packetized
and depacketized automatically by the HIDmaker FS code on both ends of the USB
link.