Hi Nomad,
I think what's happening is that you are displaying the ASCII character for the value contained in each element of the array.
Try:
lcdout $FE, $C0 + pos, DEC3 Mastercode[x]
or:
lcdout $FE, $C0 + pos, HEX2 Mastercode[x]
Best Regards,
Paul
Hi Nomad,
I think what's happening is that you are displaying the ASCII character for the value contained in each element of the array.
Try:
lcdout $FE, $C0 + pos, DEC3 Mastercode[x]
or:
lcdout $FE, $C0 + pos, HEX2 Mastercode[x]
Best Regards,
Paul
The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.
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
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 06:28.
Bookmarks