PDA

View Full Version : Beginners Question



sawicki
- 13th June 2005, 01:16
I just bought a copy of Picbasic Pro and tried my first program, the LCD sample with the error shown below. Could someone tell me what I'm doing wrong or point me to the appropriate instructions?

Thanks,

Felix
__________________________________________________ ___________
Executing: "H:\PBP\PBPW.EXE" -p16F688 -ampasmwin -oq -z -v "LCD.bas"
PicBasic Pro Compiler 2.46, (c) 1998, 2005 microEngineering Labs, Inc.
All Rights Reserved.
Pass 1:
Pass 2:
Code Gen:
Macro Pass:
mpasmwin /q "H:\Pic Projects\Test Basic\LCD.ASM"
COD Pass:
Warning[219] H:\PBP\PBPPIC14.LIB 2780 : Invalid RAM location specified.
Warning[219] H:\PBP\PBPPIC14.LIB 2785 : Invalid RAM location specified.
Warning[219] H:\PBP\PBPPIC14.LIB 2909 : Invalid RAM location specified.
Warning[219] H:\PBP\PBPPIC14.LIB 2930 : Invalid RAM location specified.
BUILD SUCCEEDED: Sun Jun 12 20:07:44 2005
_______________________________________
' PicBasic program to demonstrate operation of an LCD in 4-bit mode
'
' LCD should be connected as follows:
' LCD PIC
' DB4 PortA.0
' DB5 PortA.1
' DB6 PortA.2
' DB7 PortA.3
' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
' E PortB.3
' RW Ground
' Vdd 5 volts
' Vss Ground
' Vo 20K potentiometer (or ground)
' DB0-3 No connect

Pause 500 ' Wait for LCD to startup

loop: Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second

Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second

Goto loop ' Do it forever

Bruce
- 13th June 2005, 02:32
You get this error because there is no PORTB on the 16F688. Only PORTA,
and PORTC.

Invalid RAM location specified is returned because the LCDOUT library
function is attempting to use an I/O port that is not defined in the device
header file for the 16F688.

Use the LCDOUT defines "shown in your manual" to reassign PORTA & PORTC
for LCDOUT control I/O-pins.

Tip: You will also want to turn off A/D & comparators with;

ANSEL = 0 ' All pins digital
CMCON0 = 7 ' Comparators disabled
CMCON1 = 0 ' For RA4

sawicki
- 13th June 2005, 02:58
Thanks Bruce

I added

DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 5

and it works just as it should. Thanks also for the other tips.

Felix