Array Display on LCD


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Thumbs down Re: Array Display on LCD

    i have another question, how do i had dec values into a single array. My program is having a user press a button and have dec value stored into an array. Everything I try is not working. Here is the code
    Unlock:
    lcdout $FE, 1, "Please enter 5# Code"
    LOOP:
    if pos > 5 then
    goto Compare
    endif
    if portb.7 = 0 then
    pause 300
    lcdout $FE, 1, "Not Valid Number"
    goto unlock
    endif
    if portb.6 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 7
    pos = pos + 1
    x = x + 1
    endif
    if portb.5 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 4
    pos = pos + 1
    x = x + 1
    endif
    if portb.4 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 1
    pos = pos + 1
    x = x + 1
    endif
    if portb.3 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 0
    pos = pos + 1
    x = x + 1
    endif
    if portb.2 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 8
    pos = pos + 1
    x = x + 1
    endif
    if portb.1 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 5
    pos = pos + 1
    x = x + 1
    endif
    if portb.0 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 2
    pos = pos + 1
    x = x + 1
    endif
    if portc.0 = 0 then
    pause 300
    pause 300
    lcdout $FE, 1, "Not Valid Number"
    goto unlock
    endif
    if portc.1 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 9
    pos = pos + 1
    x = x + 1
    endif
    if portc.2 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 6
    pos = pos + 1
    x = x + 1
    endif
    if portc.3 = 0 then
    pause 300
    lcdout $FE, $C0 + pos, "*"
    UserCode[x] = 3
    pos = pos + 1
    x = x + 1
    endif
    goto loop

    Compare:

    PLEASE HELP

  2. #2
    Join Date
    Feb 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: Array Display on LCD

    Try using NCD & then Lookup to simplify your code.

    per the manual:
    4.17.12 NCD returns the priority encoded bit number 1-32 of a value. it is used to find the HIGHEST bit set in a vlaue. it returns 0 if no bit is set.

    b0 = NCD %010000100 'set b0 to 7



    so
    then use
    Code:
    If PortB <> $FF then 
    lookup PortB,[7,4,1,0,8,...],UserCode[x]
    ...
    endif

    hope that helps
    Last edited by ofuzzy1; - 6th March 2011 at 05:28.

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