i use this code but then i compile occurs some errors
help me with erros in lines please
i use picsimulator ide / assembler to test the code above.
ERRORS ARE IN RED
help me with erros in lines please
i use picsimulator ide / assembler to test the code above.
ERRORS ARE IN RED
Code:
DataPin equ 0x06 ;PIC Pin
ClockPin equ 0x07 ;PIC Pin
Char equ 0x35 ;buffer
BitCounter equ 0x36 ;number of bits to read
GetScanCode
bsf STATUS, RP0 ;select bank 1
sf TRISB, DataPin ;set pins as input
bsf TRISB, ClockPin
bcf OPTION_REG, NOT_RBPU ;pull-ups are enabled
bcf STATUS, RP0 ;select bank 0
call ClockWait ;wait for Pull up to take effect and keyboard to pull clock low
;--- Read Data Bits ----
ReadKey
clrf Char ;
movlw .8 ;bits to read
movwf BitCounter
ReadChar
rrf Char [COLOR="Red"]Error: Invalid argument[/COLOR]
bcf Char, 7 ;default value is 0
call ClockWait ;wait for clock to go high then low
btfss PORTB, DataPin ;read Data
goto Next [COLOR="Red"]Invalid argument of the instruction[/COLOR]
bsf Char, 7 ;Data is High
Next decfsz BitCounter [COLOR="Red"]Unrecognized instruction[/COLOR]
goto ReadChar ;read next Data Bit
call ClockWait ;Parity Bit
call ClockWait ;Stop Bit
;Pull Clock Line Low (keyboard will buffer any further keystrokes)
bsf STATUS, RP0 ;select bank 1
bcf TRISB, ClockPin ;set clock line as output
bcf STATUS, RP0 ;select bank 0
bcf PORTB, ClockPin ;set clock line low
movf Char, W
return
;----wait for clock to go high----
ClockWait
btfss PORTB, ClockPin
goto ClockWait
;----wait for clock to go low----
ClockWait2
btfsc PORTB, ClockPin
goto ClockWait2
Last edited: