Lcdout multiple variables issue


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2014
    Posts
    16

    Default Lcdout multiple variables issue

    Having a problem with the LCDOUT Command on a PIC18F46K22 at 16MHz with a Vishay 4x20 LCD Display.

    If I use LCDOUT this way:
    Code:
    LINE1 = $80
    LCDOUT $FE, LINE1, "01234567890123456789"
    It will work every time flawlessly.

    But if I use:
    Code:
    LINE1 = $80
    X1 = 10
    X2 = 11
    X3 = 12
    X4 = 13
    X5 = 14
    LCDOUT $FE, LINE1, #X1, " ", #X2, " ", #X3, " ", #X4, " ", #X5
    The display will show
    10 11 12 garbage.....


    If I do this:
    Code:
    LINE1 = $80
    X1 = 10
    X2 = 11
    X3 = 12
    X4 = 13
    X5 = 14
    LCDOUT $FE, LINE1, #X1, " ", #X2, " ", #X3, " "
    LINE1 = LINE1 + 9
    GOSUB DELAY30    '30 msec delay
    LCDOUT $FE, LINE1, #X4, " ", #X5
    then everything is correct
    10 12 13 14 15

    I tried changing these parameters to no avail
    DEFINE LCD_COMMANDUS 1500 ; Set command delay time in us
    DEFINE LCD_DATAUS 44 ; Set data delay time in us

    Any suggestions?
    Last edited by Archangel; - 20th February 2015 at 19:56.

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Lcdout multiple variables issue

    If you are trying to display the variable value as decimal, then try using this.

    [CODE]
    LINE1 = $80
    X1 = 10
    X2 = 11
    X3 = 12
    X4 = 13
    X5 = 14
    LCDOUT $FE, LINE1, Dec X1, " ", Dec X2, " ", Dec X3, " ", Dec X4, " ", Dec X5
    Regards,
    TABSoft

  3. #3
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Lcdout multiple variables issue

    This, from the manual: "If a pound sign (#) precedes an Item, the ASCII representation for each digit is sent to the LCD. LCDOUT (on all devices except 12-bit core)"

  4. #4
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Lcdout multiple variables issue

    I use PBP v3 and the DEC output modifier with no issues.
    Regards,
    TABSoft

  5. #5
    Join Date
    Nov 2014
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Lcdout multiple variables issue

    Thank you all for the replies but
    LCDOUT $FE, LINE1, Dec X1, " ", Dec X2, " ", Dec X3, " ", Dec X4, " ", Dec X5
    also works exactly the same.

    The display will show 10 11 12 garbage.....
    I need to have a slight delay.

    Whether I use #X1 or DEC X1 the output is the same.

    I think I'll try creating a 20 byte array then output the array and see what happens

  6. #6
    Join Date
    Nov 2014
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Re: Lcdout multiple variables issue

    OK here is what I did to solve my issue....

    LCDARRAY VAR BYTE[20]
    LCD VAR BYTE
    LCDHI VAR BYTE
    LCDLO VAR BYTE



    GOSUB CLEARLCDARRAY

    LCD = X1 : GOSUB VALUE2STRING
    LCDARRAY(0) = LCDHI : LCDARRAY(1) = LCDLO

    LCD = X2 : GOSUB VALUE2STRING
    LCDARRAY(3) = LCDHI : LCDARRAY(4) = LCDLO

    LCD = X3 : GOSUB VALUE2STRING
    LCDARRAY(6) = LCDHI : LCDARRAY(7) = LCDLO

    LCD = X4 : GOSUB VALUE2STRING
    LCDARRAY(9) = LCDHI : LCDARRAY(10) = LCDLO

    LCD = X5 : GOSUB VALUE2STRING
    LCDARRAY(12) = LCDHI : LCDARRAY(13) = LCDLO

    LCDOUT $FE, LINE4, STR LCDARRAY{\20}


    'take the value in LCD and convert it to a 2-character string in LCDHI and LCDLO (ONLY FOR 0 - 99)
    VALUE2STRING:
    LCDHI = 0

    WHILE LCD >= 10
    LCDHI = LCDHI + 1
    LCD = LCD - 10
    WEND

    LCDHI = LCDHI + $30
    LCDLO = LCD + $30
    RETURN


    CLEARLCDARRAY:
    FOR LCDCTR = 0 TO 19
    LCDARRAY(LCDCTR) = " "
    NEXT LCDCTR
    RETURN
    Last edited by MarkEngineer; - 23rd February 2015 at 14:52. Reason: correct variables

Similar Threads

  1. DT Multiple Software PWM and 18F2321 issue
    By microuser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2012, 08:23
  2. Reading/writing arrays from eeprom to variables to lcdout
    By DDDvvv in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th August 2010, 18:51
  3. External Eeprom - trying to store multiple variables
    By bluesmoke in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th April 2010, 02:07
  4. Multiple Variables - Pins
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st February 2010, 01:08
  5. LCDOUT variables?
    By RUBiksCUbe in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd September 2005, 01:25

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