Thread: PIC18F4520 interfacing with hitachi 44780

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    12

    PIC18F4520 interfacing with hitachi 44780

    Hi guys,

    im a final year poly student doing my project. im doing C programming using MPLAB C18 Compiler. My project is to build a program to detect temperature.. can anyone advise me on how to do it ?

    Thank you

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    There's no need to detect temperature - it's always there. Unless you meant you want to read temperature.

    In that case, you need the proper hardware (i.e. thermal sensor to read data, and a display or equivalent to display data) to connect to your device. The PIC18F4520 has a built in 10-bit ADC - that's a big plus.

    So you would need to follow these steps (not necessarily in the given order). Point out where you're having trouble, if you want further assistance.

    1. Select the appropriate hardware/components required to achieve your goal
    2. Read the datasheet of the MCU to understand how to use it, and its peripherals functions
    3. Read the datasheets of the other components to understand how they're used
    4. Design the circuit to power/control your MCU, and connect your other components
    5. Make sure all required software is installed on a computer somewhere
    6. Design your basic logic (block diagrams, flowcharts, etc)
    7. Write a basic program to get readings from your other hardware
    8. Built a prototype to test your initial program
    9. Debug
    10. Add more features to your code, in stages
    11. Debug
    12. Continue until it works
    Last edited by Matticus; 12-11-2012 at 07:53 PM.

  3. #3
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    i have a TC74 which is a thermal sensor am i right ?
    need to display the temperature on the 4bit LCD

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Quote Originally Posted by InNeedOfHelp View Post
    i have a TC74 which is a thermal sensor am i right ?
    It would appear so.

    Quote Originally Posted by microchip.com
    TC74 is a serially accessible digital temperature sensor particularly suited for low cost and small form-factor applications. Temperature data is converted from the on-board thermal sensing element and made available as an 8-bit digital word. Communication with the TC74 is accomplished via a simple 2-wire SMBus/I2C-compatible serial port.
    No offense, but if you're lost here (as you seem to be), you might be better of finding a device that gives an analog output voltage proportional to the temperature. Select your challenge - serial communication, or analog to digital conversion.

    Quote Originally Posted by InNeedOfHelp View Post
    need to display the temperature on the 4bit LCD
    Do you have one selected?

  5. #5
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    Yes im very lost... my lecturer say that need to use the I2C 2 wire protocol.. My lcd is hitachi 44780

  6. #6
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    "Lost" isn't really so bad, but "clueless" is doomed.

    Do you have a specific question about 'C' code? Or do you need support with this project from the ground up? If the former, please be more specific about the problem.

  7. #7
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    well , im unsure of the schematic that is given to me by my lecturer. from what i learn from the schematic and personally test the connection using a multimeter. there seems to be a little problem with the connection from the LCD to the MicroChip. i need to learn the basics of C programming and understand what is the wrong connection with the board...

  8. #8
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    So far we have:

    - You're in your final year at Poly.
    - You're working on a final project, but you "need to learn" the basics of 'C' programming, as well as hardware design, to accomplish this.

    Yikes.

    FYI, this is not a programming problem. A hardware problem is not a programming problem, it's a hardware problem.

    (Moderators: You might want to move this thread to the tech board.)

    Were you given a test program that can verify the functionality of the display? If not, can you use an oscilloscope to verify that data is being passed on through the connector? If that's a tall order, many DVMs will illustrate that a pulse is happing by watching the scale jump (in addition to providing the average voltage).

    Please tell us exactly where you are stuck to get better answers.

  9. #9
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    i am given a hardware (all soldered finish and everything), i just need to program to the PIC18F4520 to make it display temperature in the LCD . but im stuck in the simplest displaying strings like "hello world" in it ..

  10. #10
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by InNeedOfHelp View Post
    well , im unsure of the schematic that is given to me by my lecturer. from what i learn from the schematic and personally test the connection using a multimeter. there seems to be a little problem with the connection from the LCD to the MicroChip. i need to learn the basics of C programming and understand what is the wrong connection with the board...
    Please state what makes you think there is a hardware problem!

    Please describe the hardware connection.

    4 or 8 bit data connection?

    Is any thing at all showing up on the display.
    Some clones of the hitachi 44780 light up one of the two lines when power is applied along with the contrast being adjusted correctly.

    How long of a turn on delay are you waiting?

    How long of a initial command delay are you waiting?

    If you are waiting for us to post C code then you are wasting our time;
    because until you post some code there is no reason for us to post any code.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  11. #11
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    from the schematic LCD Pin RW is suppose to be by right connected to the Microchip RD5 but when i test it out using a multimeter, it didnt display any beepings sounds .

  12. #12
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    And how are you toggling this pin? Without any program running this pin will be either zero volts or some positive voltage. You will need to write a program to initialize the display, and then write some message to this display.

    I suggest you visit Microchip's web site and see if you can find some example programs written for your processor that you can modify for your application.

    Jim

  13. #13
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    What have you done from the advice I gave you here - Urgent Help Request

    C18 has peripheral libraries - Search your computer for this file "PIC18F Peripheral Library Help Document.chm" - They would be the easiest way to implement I2C

    The first thing you need to do is draw a box on a piece of paper, label it "PIC" - Do this for every device you plan on using. Draw lines between each box, and on that line write how the communication is done -> i.e. "Analogue", "I2C", "SPI", ...
    Fact - Beethoven wrote his first symphony in C

  14. #14
    Registered User
    Join Date
    Dec 2012
    Posts
    12
    Jim: i have checked several times , there is not examples program for my processor at all..

  15. #15
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    but when i test it out using a multimeter, it didnt display any beepings sounds .
    What type of multimeter? Usually, beeps are associated with resistance readings (i.e. short circuits, or <100 ohms). I'm not familiar with meters that beep for voltage readings.

    Just to clarify - have you ever written a program for the PIC before? Or is this somehow the first time?

    If you're checking for voltage on a pin, I'm assuming you already have some kind of program written. Would you be able to provide the code?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 08-02-2012, 06:15 PM
  2. PIC16F684 Interfacing with Hitachi 44780
    By JTerry in forum C Programming
    Replies: 36
    Last Post: 12-13-2010, 12:13 PM
  3. interfacing c and java..
    By vapanchamukhi in forum C Programming
    Replies: 4
    Last Post: 09-18-2008, 02:10 PM
  4. interfacing with a program
    By Crazed in forum Windows Programming
    Replies: 10
    Last Post: 03-17-2008, 05:29 AM
  5. interfacing assembler with c++
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-24-2001, 12:13 AM