having problems with Hantronix 20x4 lcd


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    The compiler will take care for the right LCD timing, no
    need to insert pauses. The compiler can do that for you only if
    you specify the used oscillator. If you don't specify the oscillator
    frequency, PicBasic Pro assumes that you are using a 4MHz oscillator.
    If you are using a 20 MHz oscillator, DEFINE OSC 20 is mandatory.
    If you don't do that, LCDOUT will not work with the right timing.
    LCDOUT is not the only PicBasic command that needs correct timing.
    (See PicBasic Pro manual).

    DEFINE OSC xy tells the compiler the oscillator frequency and
    the compiler will output an HEX file with all the delays calculated
    for that oscillator frequency.

    Make sure your PIC is also using the same oscillator frequency.
    (Your harware is also using the same oscillator frequency).

    To test that, go back to my first post in this thread, and try
    to compile the flashing LED program and flash the PIC with it.
    (Make sure you use DEFINE OSC xy in the code).

    Examples:

    DEFINE OSC 4 'Oscillator speed 4 MHz
    DEFINE OSC 20 'Oscillator speed 20 MHz

    See PicBasic Pro manual for all the possible values of DEFINE OSC.

    There is a list of DEFINEs in the PicBasic Pro manual and some are for
    the LCD configuration. Some of these DEFINEs can help in case you are
    using an exotic LCD controller. (NOT the case for Hantronix).

    * * *

    The addresses you see in the Hantronix spec sheet are the
    display RAM Map addresses. The Hantronix spec sheet is correct, no
    errors in it.


    Best regards,

    Luciano

  2. #2
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    I get the timing issue that you are talking about. What i have done to correct the timing issue I had was to use the on board INTRC that the PIC16F6xx has to offer. Leaving me running the 4MHz is not a problem.

    The timing issue that I do have is that after I run a clear (LCDOUT $FE, 1), I have to pause after that so the LCD can see what I am writing and do it (The screen timing that the specs show is no different than the other screen I was using, but there with the actual screen). The thing that gets me also is that the maping of the LCD is not to what they have. it starts with 00 for line 1 and 40 for line 2 and so forth. I am using the 80 screen setup.

    A reason to why i was having these problems was because I needed a longer time after clearing the screen for the line problem I was having not to be a problem. Another thing to is that the contrast is not between 0 and 5 volts it needs something higher. Checking the voltage between Vdd and contrast it comes to being 7 volts where as the standard screen they recommend .3v and extended was something higher. Any how I got it to work.

    Thank you for your time in explaining how things are to go and other was of trouble shooting.

  3. #3
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    The picture below shows how to connect the 10k potentiometer to
    the LCD module. If you cannot adjust the contrast, your LCD module is broken.

    Best regards,

    Luciano



    http://img8.picsplace.to/img8/3/lcd_pot.jpg

  4. #4
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    i got that part. luciano I get what you are saying. we are just getting crossed with the explanation.


    ok get this. I am having problems with my program. I would like for the pointer that I have in my project (transmitter) to go to line four. I have the pointer start in column 2 on the LCD and go up and down. There are three screens that this pointer shows up on and the first screen it works on. The first screen it starts on the second line second column then goes down to line four. The problem that I am having is that I would like for this to happen on the second page also, go from line one to four then scroll to page three, but I can not get it to go down to line four. I have checked the program (transmitter) numerous amount of time and I can not seem to find what the problem is. Do you have any idea on that.


    Where it starts:

    CHANNELS:
    line = linet
    line = linet1
    screen = screent
    line = $81:val = $8E
    CHANNELSA:
    screen = 2
    lcdout $FE, 1
    pause 10
    lcdout $FE, $93, CS1
    lcdout $FE, $D3, CS2
    lcdout $FE, $83, "Channel 1:"
    lcdout $FE, $C3, "Channel 2:"
    lcdout $FE, $97, "Channel 3:"
    lcdout $FE, $D7, "Channel 4:"
    gosub subval
    gosub value
    gosub pointer
    pause 500
    CHANNELSB:
    goto channels1b

    CHANNELS1B:
    if PortB.7 = 1 or PortB.6 = 1 or PortB.5 = 1 or PortB.4 = 1 then pause 300
    if PortB.7 = 1 or PortB.6 = 1 or PortB.5 = 1 or PortB.4 = 1 then CHANNELS1C
    goto CHANNELS1B
    CHANNELS1C:
    if PortB.6 = 1 and PortB.7 = 1 then pause 300
    if PortB.6 = 1 and PortB.7 = 1 then enter
    if PortB.5 = 1 then meninc
    if PortB.4 = 1 then mendec
    if PortB.7 = 1 then chlinc
    if PortB.6 = 1 then chldec
    goto channels1b




    This is where I think the problem is:

    MENINC:
    if line = $81 and Screen = 2 or screen = 3 then Line2
    if line = $C1 and Screen = 1 or screen = 2 or screen = 3 then line3
    if line = $95 and screen = 1 or screen = 2 then line4
    if line = $D5 and screen = 2 then channels1 ' Scroll to page 3
    goto scren
    MENDEC:
    if line = $D5 and screen = 1 or screen = 2 then line3
    if line = $95 and screen = 1 or screen = 2 or screen = 3 then line2
    if line = $C1 and screen = 2 or screen = 3 then line1
    if line = $81 and screen = 3 then line4s ' Scroll to page 2
    goto scren
    LINE1: line = $81:val = $8E:goto scren
    LINE2: line = $C1:val = $CE:goto scren
    LINE3: line = $95:val = $A2:goto scren
    LINE4: Line = $D5:val = $E2:goto scren
    LINE4S: line = $D5:val = $E2:goto channelsa



    Program continues with the loop:

    SCREN:
    if screen = 1 then menua
    if screen = 2 then channelsa
    if screen = 3 then channels1a


    P.S. the program is posted earlier in the forum
    Last edited by Rhatidbwoy; - 21st December 2005 at 21:45.

  5. #5
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,


    Your code:

    MENINC:
    if line = $81 and Screen = 2 or screen = 3 then Line2
    if line = $C1 and Screen = 1 or screen = 2 or screen = 3 then line3
    if line = $95 and screen = 1 or screen = 2 then line4
    if line = $D5 and screen = 2 then channels1 ' Scroll to page 3
    goto scren


    =============================

    I don't work with PICBasic Pro, I just read this forum for ideas.
    Anyway, I will try to help you. Below is my version of your code.
    (You will have to fix also your code at label MENDEC).

    PicBasic does not disntigush between upper or lower case, but please
    be consistent when you write your code. Example, labels in upper case,
    variable names in lower case.

    Best regards,

    Luciano

    Code:
    MENINC:
     
    IF line = $81 THEN
        If screen = 2 OR screen = 3 THEN LINE2
    ENDIF
    
    
    IF line = $C1 THEN LINE3
    
    
    IF line = $95 THEN
        IF screen = 1 OR screen = 2 THEN LINE4
    ENDIF
    
    
    IF line = $D5 AND screen = 2 THEN CHANNELS1
    
    
    GOTO SCREN
    Last edited by Luciano; - 22nd December 2005 at 12:24.

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Pic18f452 with 20x4 LCD Help
    By djmachine in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th November 2008, 22:43
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD 20X4 connect with DS1820
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th March 2005, 11:04

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