Quote Originally Posted by malwww View Post
please help i want to shiftout numbers from 0 to 9 .i used data eeprom it works good but it pause at 0 , now i want to use lookup or somthi9ng without saving data in eeprom .i want to shift out numbers to the leds using ic 74hc 164.it works when i use this (data @ 0,252,96,218,242,102,182,190,224,254,246) but i want to use lookup or other way not to save in the eeprom please
this my code but doesnt work it sends unknown digit .


define _HS_OSC & _LVP_OFF & _WDT_OFF & _CP_OFF
define _BODEN_OFF & _MCLRE_ON & _PWRTE_ON
DEFINE SHIFT_PAUSEUS 1000

DEFINE OSC 4

Include "modedefs.bas"

B2 var word
B1 var word

SDO VAR PortB.0
SCLK var PortB.1

TRISB = 0
porta = %00111
SCLK = 8
main:

for b1 = 1 to 10

b1 = b1+1
b2 = b1
pause 1000
SHiftOUT SDO,SCLK,0,[b2]

pause 1000

next b1

goto main


lookup2 b1,[252,96,218,242,102,182,190,224,254,246],b2 'these numbers i want to shiftout them to the leds from 0 through 9
end
Looks as if you almost got it, move your lookup routine up in your code to somewhere before the shiftout statement.
Code:
Include "modedefs.bas"

B2 var byte
B1 var byte

SDO VAR PortB.0
SCLK var PortB.1
portB = 0          'set port latches low prior to tris
TRISB = 0          'set all portB as outputs
porta = %0000111   'set this way because ???
'SCLK = 8

b1 = 0
b2 = 0
main:
for b1 = 0 to 9 + 1
lookup2 b1,[252,96,218,242,102,182,190,224,254,246],b2 'these numbers i want to shoutout them to the leds from 0 tro 9



SHiftOUT SDO,SCLK,0,[b2]

pause 1000

next b1

goto main
I changed your vars to byte as the were all less than 0 to 255
I cleared the vars before the main loop