TITLE "polling mode example for USBoLo" LIST P=18F2550 INCLUDE ; Echo bytes in hexadecimal text format (paddy.strebel@datacomm.ch) usbrx EQU H'0004' ; USB receive to W, usbds while waiting usbtx EQU H'0006' ; USB transmit W as soon as buffer ready tmp0 EQU H'000' ; temporary storage tmp1 EQU H'001' ORG H'0800' ; user code without interrupts mloop CALL usbrx ; calls usbds CALL txhex MOVLW ' ' CALL usbtx BRA mloop ; transmit W as two hexadecimal characters txhex MOVWF tmp1 SWAPF tmp1,W RCALL hexchr CALL usbtx MOVF tmp1,W RCALL hexchr CALL usbtx MOVF tmp1,W ; restore W RETURN ; lower nibble of W to hexadecimal char '0'..'F' hexchr ANDLW H'0F' MOVWF tmp0 SUBLW D'09' MOVLW D'48' BTFSS STATUS,C ADDLW D'07' ADDWF tmp0,W RETURN END