Hardware Reference
In-Depth Information
; enable interrupts again
bsf INTCON,PEIE ;peripheral interrupt sources
bsf INTCON,GIE ;global interrupt enable bit
; the following return command redirects program execution to the computed
subroutine entry address
; and the reentrance point of all command subroutines is also here:
get_here
return
Das folgende Segment aus dem Quellcode zeigt einen Parser, der mit den zuvor
genannten Aufgaben fertig wird.
; parse bulk OUT buffer content after the header
parseMessage
; but get transfer size from header first
movlw 0x04
movff WREG,FSR2L
movlw 0x06
movff WREG,FSR2H ;bulk OUT TransferSize: least significant byte
movff INDF2,BULKOUT_RXD
movlw 0x00
cpfseq BULKOUT_RXD
bra
parse_netto
bra
OUTMsgError
parse_netto
call
USB_response_formatter_init
bcf
UEP1,EPSTALL ;unstall endpoints
movlw 0x0C
movff WREG,OUT_LPOINTER
movlw 0x06
movff WREG,OUT_HPOINTER
;bulk OUT message payload start address
USB_parser_compare_bytes
; a single byte in the bulk OUT endpoiont will be compared with the command-
lookup table only once
; check before if the message is read out without new line character at the end
movlw 0x00
cpfseq BULKOUT_RXD
bra parse_next
; insert a line feed at last
movlw 0x0 A ;line feed
movwf BULKOUT
bra
parse_filter
parse_next
movff OUT_LPOINTER,FSR2L
movff OUT_HPOINTER,FSR2H
movff INDF2,BULKOUT
decf BULKOUT_RXD
; legal character filter, whitespacer and uppercaser
parse_filter
movlw 0x7F
Search WWH ::




Custom Search