Help with LCD commands with button I/P


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Oops, your right Steve, I never even noticed that, lol.

  2. #2
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Trying again....

    Hi again

    I have had a play with the code, and have placed the colons in as stated,
    I still get no display,

    One thing I did find is if I place the Disp1: to Disp4: section into the main loop I get a very
    fast flashing faint display,
    It does change tho when the i/p pin is toggled.

    So I may be getting a little closer.

    Any ideas.....?

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    add a PAUSE 100-250 before you Goto Loop
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g7jiq View Post
    Hi again

    I have had a play with the code, and have placed the colons in as stated,
    I still get no display,

    One thing I did find is if I place the Disp1: to Disp4: section into the main loop I get a very
    fast flashing faint display,
    It does change tho when the i/p pin is toggled.

    So I may be getting a little closer.

    Any ideas.....?
    I will attempt to redeem myself, again without actually wiring up a pic to default LCD settings,
    Code:
    TRISA=%00000000 'Set port A as output
    TRISB=%01110111 'Set port B as input except B7 for backlight and B3 for lcd
    
    
    
    SW1 VAR PORTB.0
    SW2 VAR PORTB.1
    SW3 VAR PORTB.2
    
    SW4 VAR PORTB.4
    SW5 VAR PORTB.5
    SW6 VAR PORTB.6
    Backlight VAR PortB.7 'Set var as port B7
    
    
    
    low Backlight         'light up lcd backlight
    
    Pause 1000            'stand by for lcd
    
    
    
    setup:
    
    LCDOUT $FE,1,   " G7JIQ Micro"   'clear lcd & Display on line 1
    lcdout $FE, $C0," Link Repeater" 'Display on line 2
    pause 2000
    LCDOUT $FE, $0C 'turn off cursor
    lcdout $FE,1    'clear display
    lcdout $FE,2    'Return Home
    
    
    loop:
    
    if SW1 = 0 then Disp1  ' if true, disp1
    if SW1 = 1 then Disp2  ' if true, disp2
    IF SW4 = 0 THEN Disp3  ' if true, disp3
    if SW4 = 1 THEN Disp4  ' if true, disp4
    
    goto loop
    
    
    Disp1:
    lcdout "Standby"
    pause 1000     ' gives time to see display
    
    goto loop      ' prevents you from having to use gosubs in the loop
                   ' however it returns to the beginning of the loop
                   ' whereas a gosub would go to the next line in the loop
    
    Disp2:
    lcdout "Main"
    pause 1000     ' gives time to see display
    
    goto loop      ' prevents you from having to use gosubs in the loop
                   ' however it returns to the beginning of the loop
                   ' whereas a gosub would go to the next line in the loop
    
    Disp3:
    lcdout $FE,$C0,"Local off " 'display on line 2
    pause 1000     ' gives time to see display
    lcdout $FE,1   ' Erases display
    
    goto loop      ' prevents you from having to use gosubs in the loop
                   ' however it returns to the beginning of the loop
                   ' whereas a gosub would go to the next line in the loop
    Disp4:
    LCDOUT $FE,$C0,"local on"
    pause 1000     ' gives time to see display
    lcdout $FE,1   ' clears display
    
    goto loop      ' prevents you from having to use gosubs in the loop
                   ' however it returns to the beginning of the loop
                   ' whereas a gosub would go to the next line in the loop
    
    
    end
    There are no config fuses set here as I do not know which compiler you are using of which PIC, so you must add them or manually set the config fuses in your programmer. If you supply the information and also the Oscillator speed and if you are using xtal, resonator or internal oscillator, everyone is sure to help.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Reply

    Hi,

    Sorry should have given the hardware spec first,
    The pic is a 16F627, the clock crystal is 4mhz and I am using Microcode picbasic pro built in compiler.

    I have tried your updated code (many thanks) and at last I get somthing on the display,
    But its displays "Standby"Standby"Standby"Standby" etc.. across the display incrementing each word once a second, across the topline and then the bottom line intil its full.

    If I toggle the sw1 i/p It changes to "Main"Main"Main" etc.. across both lines of the display until full.

    SW4 does nothing .

    Whats going wrong....

    I didn't think it would be so hard to do, I can do it with LED's but an LCD has me beat.
    (but i am one not to be beaten)

    Any suggestions......

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yes.. read the comment right to LCDOUT $FE,1

    everytime you do a LCDOUT, it will write to the current cursor position.. unless you specify it. So what the following will do?

    Code:
    LCDOUT $FE,1,"Hello "
    LCDOUT "world!"
    Last edited by mister_e; - 8th January 2008 at 21:15.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve,


    I now have one line with one word, which changes when I toggle the i/p. (great just the job)
    Do you know why I get no change when i toggle the other i/p.
    Line 2 stays blank.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes i know... look how your program flow...

    it goes to Disp1 or Disp2.. then it return to Loop... knowing that SW1 can't something else than 0 or 1.. it will never execute the IF SW4 = lines.

    I would suggest to use GOSUB and RETURN for a quick fix.. and be careful with LCDOUT $FE,1 line in DISP3 & DISP4 routines...

    Still possible to use another method...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  3. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  4. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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