' 8243.BAS DEMONSTRATES USE OF 8243 I/O PORT EXPANDER TO EXPAND ' STAMPS I/O CAPABILITY. THE 8243 HOOK UP FOLLOWS: ' ' ' 8243- Pin11 Pin10 Pin9 Pin8 Pin7 Pin6 ' P20 P21 P22 P23 PROG CS ' ' STAMP- I/O-0 I/O-1 I/O-2 I/O-3 I/O-4 I/O-5 ' ' Pin6 CAN BE HELD LOW BY TYING IT TO GROUND. symbol nib = b0 'command and address symbol data = b1 'data to send symbol cs = pin5 'Chip Select symbol prog = pin4 'Program pin symbol pt4 = 0 'addresses of ports symbol pt5 = 1 symbol pt6 = 2 symbol pt7 = 3 symbol rd = 0 'read op code symbol wr = 4 'write opcode dirs = %11111111 init: cs = 1 ' chip not selected prog = 1 ' initial program state nib = 0 data = 0 sel: cs = 0 ' select nib = pt4 + wr ' load nib with address of port 4 and write command main: data = 15 ' send all ones(1111) gosub send ' goto send pause 500 ' pause data = 0 ' send all zeros(0000) gosub send pause 500 goto main send: pins = pins & %11110000 'clear output lines pins = nib | pins ' load command and address prog = 0 ' strobe it onto 8243 pins = pins & %11110000 ' clear output lines pins = pins | data ' load data prog = 1 ' strobe it onto 8243 return 'return