LCD connection

Project 2 – Hello World with Parallel LCD

PROJECT 2

“Hello World” WITH PARALLEL LCD

Back to Project 1                                                                                                                Go to Project 3

For project 2, we will show you how to interface the SK40C board will parallel 16×2 LCD display. The connection are simple and the coding are easy to learn. We are going to display the “Hello World” on the LCD display by just adding a library that has been done for you.

————————————————————————————————————————————————————————-

COMPONENT NEEDED

————————————————————————————————————————————————————————-

16×2 LCD DISPLAY

————————————————————————————————————————————————————————-

CONNECTION

————————————————————————————————————————————————————————-

SK40C have offer a extra connecter for user to directly plug in the LCD display. This have save the user a lot of time from soldering the LCD display.
The data pin of the LCD are connected to the PORTD while the RS of LCD are connected to RB4 and E of LCD are connected to RB5.Please refer to LCD datasheet1, LCD datasheet2 and SK40C user manual for further information.

————————————————————————————————————————————————————————-

ADDITIONAL INFORMATION

————————————————————————————————————————————————————————-
LIQUID CRYSTAL DISPLAY
Before start program the LCD, we have to know the function of each pin on the LCD display to avoid wrong connection.


RS – LOW (0), data bytes transfer are treated as command.

HIGH (1), character can be transfer to and from module.

R/W – LOW(0), write command or character data to the module.

HIGH(1), read character data or status information from its registers.

E – HIGH(1) to LOW(0), writing to display.

LOW(0) to HIGH(1), reading from display.

D0 to D7 – Eight data bus line.
There are numbers of cool experiment inside the LCD datasheet which have teach us how to entering the text, addressing, shifting the display, character entry mode, user-defined graphic, 4-bits data transfer.

LCD BACKLIGHT CONTROL

To make your LCD look cool, we can ON the backlight of the LCD by just put or solder a mini jumper to short LCD B/L.

LCD CONTRAST CONTROL

There is a potential meter who is purposely added for user to adjust the different contrast of LCD. Turn left or right to adjust the contrast level.

————————————————————————————————————————————————————————-

CODE OVERVIEW

————————————————————————————————————————————————————————-

Figure above have show that we have included an lcd.h and system.h file inside our main program. The reason we are doing this is to separated our code in different file and for easily to relocated back by user if got any error. To refer back the LCD program, all we need is double-click the lcd.c and it will show up.

What’s inside “lcd.c” & “lcd.h” ?
Inside lcd.c, we have already defined all the code that needed to control the LCD such as the coding in figure below:

As for lcd.h is an header file. These files allow programmers to separate certain elements of a program’s source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers. Programmers who wish to declare standardized identifiers in more than one source file can place such identifiers in a single header file, which other code can then include whenever the header contents are required.

system.h

In system.h, we use to give a name to a port using. Besides from defining the crystal frequency, in here, we have also define the PORT that required to use by LCD which is RB4, RB5 & PORTD.

lcd_initialize();
Before start to send any data to LCD, the LCD should be initialize 1st. The initialization process are such as, clear LCD display, cursor home, cursor on/off, display/cursor shift and function set.

lcd_home();
To make sure that the cursor is back to home. We need to send a command for it which is in binary 00000010.

lcd_putstr(“Hello World”)
Send a string to LCD data bus to display it on the screen. The symbol “” is mean what the word or text inside are in ASCII format. The compiler will automatically convert it to binary and send to the required port. Finally the texts Hello World will be display on the screen.

*If you want faster response from author, please do post your comment/inquiry/feedback in our technical forum as we seldom check the comments section in tutorial site 🙂

Back to Project 1                                                                                                                       Go to Project 3

————————————————————————————————————————————————————————-

ATTACHMENT

1. P2 User Manual.pdf
2. Project_2.code.zip

Buy

, , , ,

Related Post

20160330_085520-e1459299689529-400x323

Control and Monitor via SMS Part 2

ciku-7-400x347

Simple steps to control Stepper Motor using 2Amp Motor Driver Shield and CIKU

18f4550arrowclock

PIC16F VS PIC18F:Analysis of PIC Mid-Range 8 bit family and Advanced 8-bits Family

10587-600x800

Using MDD10A with CIKU

10 thoughts on “Project 2 – Hello World with Parallel LCD

  1. hi, Im new here and just bought sk40c + pic18f887a and I attach a blue LCD on the board.
    When testing at shop the LCD had words and blue backlight. but after I attach it on board and power on it at home, the LCD does not had back light. does my LCD back light spoilt? I understand the [] [] [] [] [] display on LCD because I don’t program anything in the board yet, but I don’t understand why there is no LCD backlight. please help thanks

  2. Have you connect the jumper pin on SK40C? SK40C come with a jumper pad for user to decide whether to activate the LCD backlight or otherwise. Anyway do discuss in our technical forum where you can show photo of the whole project setup and we will try to trace the possible root cause.

  3. HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
    Copyright (C) 2011 Microchip Technology Inc.
    (1273) Omniscient Code Generation not available in Lite mode (warning)
    Error [800] Project_11.as; 45. undefined symbol “LVPDIS”
    Error [800] Project_11.as; 45. undefined symbol “MCLREN”
    Error [800] Project_11.as; 45. undefined symbol “BORDIS”
    Error [800] Project_11.as; 45. undefined symbol “PWRTEN”
    Error [800] Project_11.as; 45. undefined symbol “WDTDIS”
    Error [800] Project_11.as; 45. undefined symbol “HS”

    ********** Build failed! **********

    when i build lcd programme i get this error..please help me out

  4. This is due to different version of HI-TECH Compiler. You can try searching the solution in our technical forum as there are people discussing about it before.

  5. Hi, I have a small question.

    Is it possible to replicate the reading from an electronic ditigal weighing scale to another screen in another room.I am trying to avoid a lot of wiring. Is it possible to do this? hope someone can answer me this. If this is possible can you also advise me the diagram for this. I am not a tech guy but would love to do this myself if I can get the right information.

    Glad I found your website. I really like the things you people are doing.

    sincerely,
    Raghu.

  6. Hello,

    Just started on this PIC16F887 + SK40C projects and I wondering if I’m doing this correctly. The male header connector provided with SK40C is meant for a separate LCD display right. So I soldered the connector to the LCD display (just like the image in LCD BACKLIGHT CONTROL section above) and just plug it to the LCD slot on SK40C (no soldering here).

    I noticed that some of the connection are broken like for example the R/W of the LCD is not connected to GND and some other pins as well (Checked this with multimeter continuity test).

    I think my solder work is okay but it’s just that I think some of the header pins are not directly touching copper thing (since it’s loose). How do I fix this? I tried wiggling it around a bit to find the perfect position but nope doesn’t work.

    Thanks.

  7. You will need wireless device to transmit the data from the weighing machine to another room. It will become more complex, but it is possible. Do continue the discussion in our technical forum, thanks .

  8. @ober

    Yeah, I did that. Got a female header from a friend and soldered it to SK40C.
    After doing some troubleshooting, we realized it was actually the LCD display. It might be faulty or I soldered it wrong but the second backup LCD which I also soldered myself work perfectly.

    Guess it’s all fine now, I might try re-soldering the male pin header on the faulty LCD to see if that’s the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *