Help with LCD commands with button I/P


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    35

    Default Help with LCD commands with button I/P

    Hi all,

    I am a newbie and I am looking for any pointers on a little problem i have.

    I am trying to get a 2 line LCD display to change its display when it recieves a logic input.
    (I am using a 2 line display and a 16F627)
    I can get it to display anything I want with the LCDOUT command,
    My problem starts when I try to change the displayed words when I recieve an input,

    For test purposes I attached a button to the input,
    The best I could get was the display to flash both commands when the button was pressed.

    Any ideas ?

    Cheers
    Dave...

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Why not just use and if...then statement and use the button to input to toggle between the two display outputs.

  3. #3
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Still having problems....

    Hi,

    Thanks for your reply,

    The program I am trying to get going is to get an lcd display to display the status of a low power ham radio repeater,
    The pic's i/p lines will be connected to the control lines of the radio control circuit.

    I have re-writen the program using the IF, THEN commands and all I get is the setup message and lcd back light,
    The display remains blank no matter what the i/p lines are doing.
    (I/P pins are 10k to Gnd.)

    The program I am trying to get working follows:-
    (please feel free to rip it apart and advise me where I am going wrong)

    Cheers
    Dave...


    TRISA=%00000000 'Set port A as output
    TRISB=%01110111 'Set port B as input except B7 for backlight and B3 for lcd

    Backlight VAR PortB.7 'Set var as port B7

    SW1 VAR PORTB.0
    SW2 VAR PORTB.1
    SW3 VAR PORTB.2
    SW4 VAR PORTB.4
    SW5 VAR PORTB.5
    SW6 VAR PORTB.6

    Pause 500 'stand by for lcd

    lcd_light: 'light up lcd backlight
    low Backlight

    gosub setup
    goto loop

    setup:

    LCDOUT $FE,1 'clear lcd
    lcdout " G7JIQ Micro" 'Display on line 1
    lcdout $FE, $C0 'Display on line 2
    Lcdout " Link Repeater"
    pause 2000
    LCDOUT $FE, $0C 'turn off cursor
    lcdout $FE,1 'clear display
    lcdout $FE,2
    return

    loop:

    if SW1 = 0 then Disp1
    if SW1 = 1 then Disp2
    IF SW4 = 0 THEN Disp3
    if SW4 = 1 THEN Disp4

    goto loop


    Disp1
    lcdout "Standby"
    Disp2
    lcdout "Main"
    Disp3
    lcdout $FE,$C0,"Local off " 'display on line 2
    lcdout $FE,1
    Disp4
    LCDOUT $FE,$C0,"local on"
    lcdout $FE,1


    end

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


    Did you find this post helpful? Yes | No

    Default

    Hi g7jiq,
    looks simple enough, without my trying your code. You want Disp1, disp2, to run only when sent there,
    your code
    Code:
    Disp1
    lcdout "Standby"
    Disp2
    lcdout "Main"
    Disp3
    lcdout $FE,$C0,"Local off " 'display on line 2
    lcdout $FE,1
    Disp4
    LCDOUT $FE,$C0,"local on"
    lcdout $FE,1
    try:
    Code:
    Disp1:
    lcdout "Standby"
    return
    
    Disp2:
    lcdout "Main"
    return
    
    Disp3:
    lcdout $FE,$C0,"Local off " 'display on line 2
    lcdout $FE,1
    return
    
    Disp4:
    LCDOUT $FE,$C0,"local on"
    lcdout $FE,1
    return
    
    end
    without the colons the program sees your subdirectories as just the next line of code, the returns send it back to the line after the one which calls it.
    JS
    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


    Did you find this post helpful? Yes | No

    Default

    I may be wrong but would you not require a gosub in order to use a return? I believe a simple goto would me more appropriate in this case.

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


    Did you find this post helpful? Yes | No

    Default

    and there's another danger... DISP3, DISP4,, the second LCD will clear the whole LCd display.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by CocaColaKid View Post
    I may be wrong but would you not require a gosub in order to use a return? I believe a simple goto would me more appropriate in this case.
    YEP!
    Shows how close I looked at the code after seeing what I did see! Must have gotten excited.
    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.

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