Getting The LCD To Work??

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Fritzables
Posts: 61
Joined: 07 Jun 2008 13:20
Location: Brisbane AUSTRALIA

Getting The LCD To Work??

#1 Post by Fritzables » 01 Jul 2008 12:19

I am trying my first code on my new EasydsPIC4 which I also got the LCD with.

I am trying the sample code to see the LCD working, but when compiling and flashing into the processor - not too much happens at all. The screen lights up but I don't have the text as I'd expect.

The code I am using is below. What haven't I done yet?? I have made no changes to the SW settings.

Fritzables


' * Project name:
' Lcd4bitTest
' * Copyright:
' (c) MikroElektronika, 2006.
' * Revision History:
' 20060515:
' - Initial release
' * Description:
' The program is a simple demonstration of the LCD library routines.
' It writes the word mikroElektronika across two rows.
' * Test configuration:
' MCU: dsPIC30F4013
' Dev.Board: EasydsPIC4
' Oscillator: XT-PLL8, 10.000MHz
' Ext. Modules: LCD 2x16
' SW: mikroBasic for dsPIC30/33 and PIC24 v4.0.0.0
' * NOTES:
' - None.

program LCD4bitTest

dim txt as string[15]

main:
ADPCFG = $FFFF
Lcd_Init_EasydsPIC4()

Lcd_Cmd(LCD_CURSOR_OFF)
Lcd_Cmd(LCD_FIRST_ROW)

LCD_Chr_Cp("m") ' m
LCD_Chr_Cp(105) ' i
LCD_Chr_Cp(107) ' k
LCD_Chr_Cp("r") ' r
LCD_Chr_Cp(111) ' o

Lcd_Cmd(LCD_SECOND_ROW)
Lcd_Out(2, 6, "Elektronika")

Delay_ms(1000)

txt = "Elektronika"
Lcd_Out(1, 6, txt)

end.

bt
Posts: 217
Joined: 10 Nov 2005 23:08
Location: Oregon, USA
Contact:

#2 Post by bt » 01 Jul 2008 16:01

Check the LCD contrast pot next to the LED's (turn it) - contrast adjustment can make the text completely dissappear. And, if your LCD has a backlight, turn on the little switch for LCD-BCK on SW7.

BT

Fritzables
Posts: 61
Joined: 07 Jun 2008 13:20
Location: Brisbane AUSTRALIA

#3 Post by Fritzables » 01 Jul 2008 22:13

G'Day BT,

Yea, did all that - I also thought it was a contrast issue but no adjustment made the type appear.

Taking a look at the User's Guide - it shows a graphic of the LCD in place but one thing I had noticed is that on SW2 that ALL switches were in the OFF state except for #7.

There is no mention of it in the text though..... :?

bt
Posts: 217
Joined: 10 Nov 2005 23:08
Location: Oregon, USA
Contact:

#4 Post by bt » 01 Jul 2008 23:32

Hello down under... :lol:

I avoid using mE defaults that are specific to their boards - it makes it easier to transfer code to a real project. Thus, in the code, below, I don't use the easypic init.

I threw this code together for your testing - works on my easydspic4. I counts and displays numbers...

BT

Code: Select all

program Junk_Testing
dim i as integer
dim iout as char[15]
''===================================================================
MAIN:
  ADPCFG = $FFFF ' Turns off Analog on ports
  LCD_init(portB,3,2,1,0,PortD,0,2,1) ' LCD initialization Must put it here
  Lcd_cmd(Lcd_cursor_off)

   Adcon2   = $0000    ' $0000 turn off analog, set to digital
   Adcon3   = $0000    ' $0000 turn off analog, set to digital
   Adcon1   = $0000    ' $0000 turn off analog, set to digital
   OC1CON   = $0000    ' Turn off capture and compare
   OC2CON   = $0000    ' Turn off capture and compare
   PWMCON1  = $0000    ' Turn off PWM
   PWMCON2  = $0000    ' Turn off PWM

LatB  = $0030   ' setting LCD to 0's and buttons to 1's
TrisB = $0030   ' 0,1,2,3=LCD out, 4,5 = input
 i = 0
'===================================================================
Do
  IntToStr (i, iout)
  Lcd_out(1,1,iout)
  delay_ms(500)
    i = i + 1
Loop Until i>=21
end.

Fritzables
Posts: 61
Joined: 07 Jun 2008 13:20
Location: Brisbane AUSTRALIA

#5 Post by Fritzables » 02 Jul 2008 00:05

Hey mate....... :D

Thanks for the code - will try it when I get home from work later this arvo.

Will let ya know.

Fritzables

Fritzables
Posts: 61
Joined: 07 Jun 2008 13:20
Location: Brisbane AUSTRALIA

#6 Post by Fritzables » 02 Jul 2008 09:30

Hey bt,

Well, all is good - used your code to get it up and running again and have been trying various changes to see what the net effect would be.

Thanks a mill again - That's one Fosters I owe you when you come DU.

Fritzables :lol:

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”