General discussion relating to the library modules supplied with the compiler
Moderators: David Barker, Jerry Messina
-
AndyO
- Registered User
- Posts: 48
- Joined: Sat Oct 27, 2007 7:08 pm
- Location: Beijing, China
Post
by AndyO » Sat Mar 01, 2008 2:58 pm
I'm a newbie to the world of PICs and Swordfish and would be grateful for any help anyone can offer.
I've been trying to get a character LCD to work with an 18F1220 on PORTA. The following code results in no LED lit or anything on the display:
Code: Select all
Device = 18F1220
Clock = 8
'LCD options
#option LCD_DATA = PORTA.0
#option LCD_RS = PORTA.6
#option LCD_EN = PORTA.7
Include "LCD.bas"
Include "UTILS.BAS"
Dim LED As PORTB.0
'Set clock source to internal oscillator, I/O on RA6 & RA7
Config OSC = INTIO2
'Disable MCLR on Pin 4 (RA5)
Config MCLRE = OFF
'Set internal clock speed to 8MHz
OSCCON = $7F
'Turn off analogue functions
SetAllDigital
'Program Start
High(LED)
DelayMS(150)
LCD.Cls
LCD.WriteAt(1,1,"Hello World")
Repeat
Toggle(LED)
DelayMS(500)
Until FALSE
Commenting out the CLS and WriteAt lines still results in nothing. If I take out the Include "LCD.bas" line then I get a blinky LED so I think the PIC is working.
Tried the same code on an 18F4520 and it worked fine.
I'm sure I'm doing something stupid but I can't see it! Thanks in advance for any words of wisdom.
-
AndyO
- Registered User
- Posts: 48
- Joined: Sat Oct 27, 2007 7:08 pm
- Location: Beijing, China
Post
by AndyO » Sat Mar 01, 2008 6:35 pm
Many thanks.
Putting the Config and OSCCON instructions into a module as you suggested did the trick - Top tip!
-
webrains
- Posts: 1
- Joined: Fri May 15, 2009 6:00 am
- Location: India
Post
by webrains » Fri May 15, 2009 6:24 am
Hi i am trying to connect LCD to 18f2620
I want to use following available pins pb4,5 and pc0,1 and pa2-5 to use a 16X2 LCD display
Can you please suggest me what settings i use in SetALLDigital and my program
regards