PDA

View Full Version : Error[112]c:\pbp\pbppic14.lib 2945 missing operator - message when compiling!



Bigalscorpio
- 19th June 2012, 20:01
Can anyone explain why I am getting this message" Error[112]c:\pbp\pbppic14.lib 2945 missing operator".

Well actually 4 lines of the same error but each with a different number at the end!

First line is 2945 then 3052,3061 and 3069.

All I was doing was playing around with someones example of 3x A to D on a pic, and changed the actual isplay lines slightly to suit my LCD which is 2x20 instead of 16.

I compilee ok at first and successfully programmed the pic16F872 and all was well.

Then I changed a bit of the code after the $fe in the LCD part and got the strange errors.

This is the code below, can anyone explain the errors. The commented out parts are just bits I was trying when I got the code, otherwise the code is as was!

Thanks Al


' Define LCD pins
Define LCD_DREG PORTB
Define LCD_DBIT 0 1
Define LCD_RSREG PORTB
Define LCD_RSBIT 4
Define LCD_EREG PORTB
Define LCD_EBIT 5
Define LCD_LINES 2

TRISA = %00001011
' Allocate variables
x var byte
y var byte
z var byte

ADCON1 = 4 ' Set PortA 0, 1, 3 to A/D inputs

Low PORTB.6 ' LCD R/W line low (W)
Pause 100 ' Wait for LCD to start

Goto mainloop ' Skip subroutines


' Subroutine to read a/d converter
getad:
PAUSEUS 50 ' Wait for A/D channel acquisition time
ADCON0.2 = 1 ' Start conversion
WHILE ADCON0.2 ' Wait for it to complete
WEND
Return

' Subroutine to get pot x value
getx:
ADCON0 = $41 ' Set A/D to Fosc/8, Channel 0, On
Gosub getad
x = ADRESH
Return

' Subroutine to get pot y value
gety:
ADCON0 = $49 ' Set A/D to Fosc/8, Channel 1, On
Gosub getad
y = ADRESH
Return

' Subroutine to get pot z value
getz:
ADCON0 = $59 ' Set A/D to Fosc/8, Channel 3, On
Gosub getad
z = ADRESH
Return


mainloop:
Gosub getx ' Get x value
Gosub gety ' Get y value
Gosub getz ' Get z value

Lcdout $fe, 1, "x=", #x, " y=", #y, " z=", #z ' Send to LCD
'Lcdout $fe, 1,"TEST"
'Lcdout $fe,$80,"x=", #x ' Send to LCD
'Lcdout $80, 1 + 10, "y=", #y' Send to LCD
'Lcdout $fe, $C0, "z=", #z' Send to LCD
'Lcdout $fe, $C0 + 10, "v="' Send to LCD
Pause 100 ' Do it about 10 times a second

Goto mainloop ' Do it forever

End

Darrel Taylor
- 19th June 2012, 20:45
Your LCD_DBIT line has a "1" way off to the right.

Define LCD_DBIT 0 1

Bigalscorpio
- 19th June 2012, 21:24
DOH!

Thanks Darrel, thought I was going mad for a while there. ;)

Thanks again mate, Al