LCD library Function for 8 Bit

Beta Testing discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
K6XOX
Posts: 5
Joined: 11 Mar 2011 20:00

LCD library Function for 8 Bit

#1 Post by K6XOX » 18 Mar 2011 07:01

Hi,

I was try to use the 8-Bit mode for the LCD display for one of My Equipment at my Work. I know that LCD 4 bit much less wire but the Hard ware already design and on PCB to have 2 Ports dedicated For data and Control, I don't want to Cut Circuit and re-wire.

I did not find any of the Library Function that have 8 Bit Mode to use or I missed somewhere, Please advise :)

THank you in ADVANCE,

Pete

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: LCD library Function for 8 Bit

#2 Post by tihomir.losic » 18 Mar 2011 16:06

Hello Pete,

please, follow this link:
http://www.mikroe.com/eng/projects/index/page:12/
Here users can view project made by users of our compilers. Users can also post their project in order to share experience and knowledge using mikroElektronika compilers.

You can download LCD8bit project by clicking here:
http://www.mikroe.com/download/projects ... amples.rar
This project provides communication with Lcds (with HD44780 compliant controllers) through the 8-bit interface.
Included in this project is __Lib_Lcd8.mcl (binary distribution of Lcd 8-bit library) that can be used in other projects.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

K6XOX
Posts: 5
Joined: 11 Mar 2011 20:00

Re: LCD library Function for 8 Bit -- still not work

#3 Post by K6XOX » 18 Mar 2011 19:39

Hi,

I did try with the 4-Bit code with my wiring board and Worked fine, VERY NICE!!

Now, I rewired my LCD to 8 Bit to be exacted the same as my equipment board,

Port D same as the 4 bit but added the RD0...RD3 and used RB2 = RS, RB3= RW, RB4 = EN

It did not work and I also did try to move to other PORT and still did not work... Screen dark :( Is this 8 Bit mode worked? because I try to read on the Library function in the 'USER Guide" never explain for 8 Bit MODE.

I know many people prefered 4 bit only work with 1 port but I have situation that previous design on Hardware PCB already have in place but if anyone can help me to test this that would be the great help. I was struck here for so many days so that I can move on the Ethernet Library and DAC library that i already purchased board from MIKro.

Help Please

Pete....

Code: Select all

sbit LCD8_RS at RB2_bit;
sbit LCD8_RW at RB3_bit;
sbit LCD8_EN at RB4_bit;
sbit LCD8_D7 at RD7_bit;
sbit LCD8_D6 at RD6_bit;
sbit LCD8_D5 at RD5_bit;
sbit LCD8_D4 at RD4_bit;
sbit LCD8_D3 at RD3_bit;
sbit LCD8_D2 at RD2_bit;
sbit LCD8_D1 at RD1_bit;
sbit LCD8_D0 at RD0_bit;

sbit LCD8_RS_Direction at TRISB2_bit;
sbit LCD8_RW_Direction at TRISB3_bit;
sbit LCD8_EN_Direction at TRISB4_bit;
sbit LCD8_D7_Direction at TRISD7_bit;
sbit LCD8_D6_Direction at TRISD6_bit;
sbit LCD8_D5_Direction at TRISD5_bit;
sbit LCD8_D4_Direction at TRISD4_bit;
sbit LCD8_D3_Direction at TRISD3_bit;
sbit LCD8_D2_Direction at TRISD2_bit;
sbit LCD8_D1_Direction at TRISD1_bit;
sbit LCD8_D0_Direction at TRISD0_bit;
// End Lcd8 module connections

char txt1[] = "mikroElektronika";    
char txt2[] = "EasyPIC5";
char txt3[] = "Lcd8bit";
char txt4[] = "example";

char i;                              // Loop variable

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void main(){
  ANSEL  = 0;                        // Configure AN pins as digital I/O
  ANSELH = 0;
  C1ON_bit = 0;                      // Disable comparators
  C2ON_bit = 0;
  
  Lcd8_Init();                       // Initialize Lcd8

  Lcd8_Cmd(_LCD_CLEAR);              // Clear display
  Lcd8_Cmd(_LCD_CURSOR_OFF);         // Cursor off
  Lcd8_Out(1,6,txt3);                // Write text in first row

  Lcd8_Out(2,6,txt4);                // Write text in second row
  Delay_ms(2000);
  Lcd8_Cmd(_LCD_CLEAR);              // Clear display

  Lcd8_Out(1,1,txt1);                // Write text in first row
  Lcd8_Out(2,5,txt2);                // Write text in second row

  Delay_ms(2000);

  // Moving text
  for(i=0; i<4; i++) {               // Move text to the right 4 times
    Lcd8_Cmd(_LCD_SHIFT_RIGHT);
    Move_Delay();
  }

  while(1) {                         // Endless loop
    for(i=0; i<8; i++) {             // Move text to the left 7 times
      Lcd8_Cmd(_LCD_SHIFT_LEFT);
      Move_Delay();
    }

    for(i=0; i<8; i++) {             // Move text to the right 7 times
      Lcd8_Cmd(_LCD_SHIFT_RIGHT);
      Move_Delay();
    }
  }
}

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: LCD library Function for 8 Bit

#4 Post by tihomir.losic » 21 Mar 2011 16:25

Hello,

unfortunately, I didn't reproduce your issue.
I tested project on character LCD 4x20 with blue back-light which we offer to our users:
http://www.mikroe.com/eng/products/view ... omponents/
datasheet:
http://www.mikroe.com/eng/downloads/get ... ar_lcd.pdf

Can you give me model of your LCD on which you ran this project?

Thanks.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

K6XOX
Posts: 5
Joined: 11 Mar 2011 20:00

Re: LCD library Function for 8 Bit

#5 Post by K6XOX » 21 Mar 2011 21:43

Hi,

I used Character LCD 2x16 with blue backlight same as you have in the list and It worked with 4BIT mode fine. I just want to see if I can use 8 Bit mode.

I used PIC16F877 and work fine. Just want to see if I missed anything on 8 Bit mode.

Pete

Post Reply

Return to “mikroC PRO for PIC32 Beta Testing”