Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Solution to syntax errors in code

Status
Not open for further replies.

mpardinho

Newbie level 5
Joined
Aug 7, 2006
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,340
i use this code but then i compile occurs some errors
i help me with erros


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
bsf 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 ERROR
movlw .8 ;bits to read
movwf BitCounter

ReadChar
rrf Char ERROR
bcf Char, 7 ;default value is 0
call ClockWait ;wait for clock to go high then low

btfss PORTB, DataPin ;read Data
goto Next ERROR
bsf Char, 7 ;Data is High ERROR
Next decfsz BitCounter
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

ClockWait
;wait for clock to go high
btfss PORTB, ClockPin
goto ClockWait

ClockWait2
;wait for clock to go low
btfsc PORTB, ClockPin
goto ClockWait2

return ERROR
 

Re: Error in code

What compile errors are you getting?
 

Re: Error in code

bcf OPTION_REG, NOT_RBPU ;pull-ups are enabled << is the text right for the task you need

pullups NOT enabled maybe 1 issue




goto next ERROR is wrong for a start

you cant goto something that is returned
if you goto it it must be a structured function it calls

goto next >???? is this a command ???


something thats returned has a value so is a variable
and must be declaired

like BYTE ERROR etc
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top