Custom Character in LCD 16x2 Module

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
joprinz
Posts: 8
Joined: 04 Apr 2008 14:25

Custom Character in LCD 16x2 Module

#1 Post by joprinz » 04 Apr 2008 14:29

My project requires a couple of custom characters to be output to ta 16x2 LCD Module. I was wondering if its possible using mikroBasic. A friend of mine suggested BASCOM AVR has it implimented. Can anyone help me in finding a way to do the same in mikroBasic for AVR?

Please Advice!

Thank You

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

#2 Post by filip » 07 Apr 2008 14:23

This can be done my LCD Custom Character tool.
This is not yet implemented in mikroBasic for AVR, but you can find it in mikroBasic for dsPIC,
which can be downloaded for the following location:

http://www.mikroe.com/en/compilers/mikrobasic/dspic/

If this is a big file to you, please leave you e-mail, so I could send you this tool.

joprinz
Posts: 8
Joined: 04 Apr 2008 14:25

#3 Post by joprinz » 07 Apr 2008 22:44

Thank You for your reply.

My project uses ATMEL MEGA based controllers. Can the tool be used with MikroBasic for AVR too? if not can this feature be expected in the next release of mikrobasic for AVR?

My e-Mail is joprinz@yahoo.com

Please Advice!

Thank You

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

#4 Post by filip » 08 Apr 2008 13:29

This tool is compatible with mikroBasic for AVR.
I'm sending it to you right now.

joprinz
Posts: 8
Joined: 04 Apr 2008 14:25

#5 Post by joprinz » 11 Apr 2008 17:46

Thank You for your Reply.

However I am unable to display custom characters using the same.
Here is the code I am using

Code: Select all

program MikroBasicCustomLCDTest
const character as byte[8] = (0,0,1,2,20,8,0,0)
 sub procedure CustomChar(dim pos_row as byte, dim pos_char as byte)
  dim i as byte
    LCD_Cmd(72)
    for i = 0 to 7
      LCD_Chr_Cp(character[i])
    next i
    LCD_Cmd(LCD_RETURN_HOME)
    LCD_Chr(pos_row, pos_char, 1)
end sub

main:
Lcd_Init(PORTA, 2, 1, PORTA, LCD_HI_NIBBLE)  ' Initialize LCD
Lcd_Cmd(LCD_CURSOR_OFF)
CustomChar(1,1)
end.
Plz Advice where I am going wrong!

Thank You.

Southern Bear
Posts: 15
Joined: 04 Jul 2007 05:22
Location: Crimea

#6 Post by Southern Bear » 11 Apr 2008 20:04

Code: Select all

const char_00 as byte[8] = (0,0,1,2,20,8,0,0)
dim
   i,
   addr       as byte

main:
Lcd_Init(PORTA, 2, 1, PORTA, LCD_HI_NIBBLE)  ' Initialize LCD
Lcd_Cmd(LCD_CURSOR_OFF) 
   addr = 0
   Lcd_Cmd($40 + addr)
   for i = 0 to 7
       Lcd_Chr_Cp(char_00[i])
   next i

   Lcd_Chr(1, 1, 0)

joprinz
Posts: 8
Joined: 04 Apr 2008 14:25

#7 Post by joprinz » 11 Apr 2008 21:36

Thank You :D

Ledinblue
Posts: 1
Joined: 12 Dec 2008 12:14

#8 Post by Ledinblue » 12 Dec 2008 12:56

joprinz wrote:Thank You :D

Hello,
Sorry about the delay but I post the same problem.
Here is my code, custom character does not


Thank you

Code: Select all

program Basiclcd

'*******************************************************************************
'* Procedure:
'*******************************************************************************

sub procedure fred()
Lcd8_Out(1, 2, "Laser Beam 6000RGB")
end sub

     const char_00 as byte[8] = (0,0,1,2,20,8,0,0)
     const char_01 as byte[8] = (0,0,1,2,20,8,0,0)
dim    i,addr       as byte


 '*******************************************************************************
'* Variable:
'*******************************************************************************

dim templcd as byte                                                              'Variable Lcd Demarrage
dim placlcd as byte                                                   'Variable Lcd Demarrage

'*******************************************************************************
'* Symbole:
'*******************************************************************************

'*******************************************************************************
'* Config:
'*******************************************************************************
Lcd8_Config(PORTE,  PORTD,  5,6,7, 7,6,5,4,3,2,1,0)

 TRISE=%00000000
 TRISA=%11111001
 ADCON1= %11111111

'*******************************************************************************
'* Constante:
'*******************************************************************************


'*******************************************************************************
'* Fonctions:
'*******************************************************************************


'*******************************************************************************
'* Startup:
'*******************************************************************************
PORTE.4=1
PORTA.1=0

Lcd8_Out(1, 2, "Laser Beam 4000RGB")
Lcd8_Out(2, 1, "Shiftech Engineering")
Lcd8_Out(3, 4, "Starting laser")
Lcd8_Out(4, 1, "[")
Lcd8_Out(4, 20, "]")

placlcd=2
            for templcd = 2 to 19
            Lcd8_chr(4,placlcd, $ff)
            placlcd=placlcd+1
            Delay_ms(200)
            next templcd

Lcd8_Cmd(LCD_CLEAR)
Lcd8_Out(1, 2, "Laser Beam 4000RGB")
Lcd8_Out(2, 1, "Shiftech Engineering")
Lcd8_Out(3, 3, "Key Switch OFF")

key:
if PORTA.0=0  then
goto lop
end if
goto key


'*******************************************************************************
'* Main prog:
'*******************************************************************************

lop:


    Lcd8_Cmd(LCD_CLEAR)
    Lcd_Cmd(LCD_CURSOR_OFF)
     addr = 0
     Lcd_Cmd($40 + addr)
       for i = 0 to 7
       Lcd_Chr_Cp(char_00[i])
          next i

   Lcd_Chr(1, 1, 0)
      Delay_ms(2000)

goto lop

end.

Post Reply

Return to “mikroBasic for AVR General”