Pic16f616 with lcd 16x2 problem


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2012
    Posts
    6

    Unhappy Pic16f616 with lcd 16x2 problem

    Hello, I have LCD connected to PIC16F616
    This is code LCD configuration

    DEFINE OSC 4
    Include "MODEDEFS.BAS"

    DEFINE LCD_DREG PORTC
    DEFINE LCD_DBIT 2
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    RW pin in LCD to GND

    and
    TRISA = %00111111
    TRISC = %00000000
    ANSEL = %00000011

    I write in LCD and not working, wrong characters in LCD and ISIS simulation no working with my simple hello world code..

    idea?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,569


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    Hi,
    Not sure it's the only problem but the first thing I see is:
    Code:
    DEFINE LCD_DREG PORTC 
    DEFINE LCD_DBIT 2   ' <----This can only be 0 or 4 - you can't "start" on an aribtrary pin - ONLY 0 or 4.
    /Henrik.

  3. #3
    Join Date
    Nov 2012
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    in others language is possible?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,569


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    Hi,
    Sure, I can write it in Swedish if you want:

    Jag är inte säker på att det här är det enda problemet men det första jag ser är:
    Code:
    DEFINE LCD_DREG PORTC 
    DEFINE LCD_DBIT 2   ' <----Det här kan bara vara 0 eller 4 - det går inte att "börja" på valfri pinne - ENDAST 0 eller 4.

  5. #5
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    Have you looked at DT's LCD_any_pin solution still using Picbasic pro. IF the question is if it is possible in other compilers then I think it might be possible..

    Or you write your own LCD function and then you can use any pin for this.

    Too bad the forum dont allow for chinese characters .. or we could add some more languages as well

  6. #6
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    Swedish? Anyone can do Swedish. Can you write it in Klingon? Now that would be a feat!

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,569


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    Sure, I can write it in Klingon, here you go:
    bIpIv'a',
    wej qarbej qay' neH 'ach wa'DIch 'oH vIlegh:
    Code:
    DEFINE LCD_DREG PORTC 
    DEFINE LCD_DBIT 2   '<---laH neH 'oH 0 4 pagh-pagh "start SoH" aribtrary 'emDaq-neH 0 4 pagh.
    Obviously I have NO idea if that's correct though, I speak Klingon like I speak C - not at all... :-)
    Here's the translator I used.

    Anyway, I think we've had enough fun for now. Darrels Routine will most likely be the answer if the OP wants to stick with PBP.

    /Henrik.

  8. #8
    Join Date
    Nov 2012
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Pic16f616 with lcd 16x2 problem

    sorry by my message, I wanted to say something else, programming language.
    yes, the problem is DEFINE DBIT 2, I change pins and all correct in ISIS.

    but I need pin C2-5 for data 4 bits of LCD
    I tested this code

    http://www.picbasic.co.uk/forum/showthread.php?t=7038

    and I work with pin C2-5 for LCD data
    RS in pin C0 and E in pin C1

    all correct, ISIS work with my code and LCD_AnyPin.pbp solution.
    But I tested my code in real PIC and not work, I modified configurations bits in MPLAB and nothing.
    I think that must be some PIC configuration byte that is not properly configured, any help?

    I all have this:
    TRISA = %00111111 <-- all A pins are input
    TRISC = %00000000 <-- only used for LCD 16x2
    ANSEL = %00000011 <-- I need bit 0 and 1 for A/D
    WPUA = 0
    IOCA = 0

Similar Threads

  1. Interfacing 16x2 LCD to PIC18F2520
    By spotlite in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st January 2012, 09:29
  2. swap lcd 16x2 with 20x2
    By kzeoprf in forum General
    Replies: 4
    Last Post: - 2nd September 2011, 17:25
  3. PIC16F616 HWPM Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th April 2009, 10:20
  4. Problem with servo and PIC16F616
    By Forkosh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th November 2007, 22:22
  5. PIC16F616 Comparator problem
    By JimA in forum General
    Replies: 0
    Last Post: - 15th October 2007, 15:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts