READADC to shift register Code

'# shifter1.bas  Rob stave
'# reads the value on input pin 4 and
'# shifts the value out as 8 bits.
'# Intended for 4094

symbol INPUT_PIN = 4
symbol DATA_PIN = 1
symbol CLOCK_PIN = 0
symbol STROBE_PIN = 2
symbol val = b0

begin:
low DATA_PIN
low CLOCK_PIN
low STROBE_PIN

main:

'# read the value on pin 4
    readadc INPUT_PIN, val

'#  val is b0 so just read the bits out
'#  and pulse the clock
    pin1 = bit7
    pulsout CLOCK_PIN, 500
    pin1 = bit6
    pulsout CLOCK_PIN, 500
    pin1 = bit5
    pulsout CLOCK_PIN, 500
    pin1 = bit4
    pulsout CLOCK_PIN, 500
    pin1 = bit3
    pulsout CLOCK_PIN, 500
    pin1 = bit2
    pulsout CLOCK_PIN, 500
    pin1 = bit1
    pulsout CLOCK_PIN, 500
    pin1 = bit0
    pulsout CLOCK_PIN, 500	

'#  pulse the stobe
    pulsout STROBE_PIN, 500

'#  wait a little bit
    pause 100		

    goto main