ZAXTER.
Click to return home.


http://zaxter.me/siop/©

  It's a long way to go from switch on test board to parallel port, processed, parallel port to test board and have LED turn on. Just having hardware switch which people touch and the LED feedback makes the learning more fun for me and hopefully others.
 Use input pin 15 of lpt0, lpt1 for logic in A & B and pin 17 of lpt2 for X in the following:

        http://zaxter.me/siop/gates.gif

#Write scripts for SI/OP to emulate standard logic gates via ports input(s) and output.


#AND_gate.sh
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_B=`cat /home/siop/port1/pin15`
VALUE_X=2
  if [ $((VALUE_A+VALUE_B)) = $VALUE_X ] ; then
    echo "1" > /home/siop/port2/pin17
  else
    echo "0" > /home/siop/port2/pin17
  fi
sleep .5
done


#NAND_gate.sh
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_B=`cat /home/siop/port1/pin15`
VALUE_X=2
  if [ $((VALUE_A+VALUE_B)) = $VALUE_X ] ; then
    echo "0" > /home/siop/port2/pin17
  else
    echo "1" > /home/siop/port2/pin17
  fi
sleep .5
done


#OR_gate.sh
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_B=`cat /home/siop/port1/pin15`
VALUE_X=0
  if [ $((VALUE_A+VALUE_B)) = $VALUE_X] ; then
    echo "0" > /home/siop/port2/pin17
  else
    echo "1" > /home/siop/port2/pin17
  fi
sleep .5
done


#NOR_gate.sh
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_B=`cat /home/siop/port1/pin15`
VALUE_X=0
  if [ $((VALUE_A+VALUE_B)) = $VALUE_X ] ; then
    echo "1" > /home/siop/port2/pin17
  else
    echo "0" > /home/siop/port2/pin17
  fi
sleep .5
done


#XOR_gate.sh
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_B=`cat /home/siop/port1/pin15`
VALUE_X=1
  if [ $((VALUE_A+VALUE_B)) = $VALUE_X ] ; then
    echo "1" > /home/siop/port2/pin17
  else
    echo "0" > /home/siop/port2/pin17
  fi
sleep .5
done


#Inverter
#!/bin/bash
while true ; do
VALUE_A=`cat /home/siop/port0/pin15`
VALUE_X=0
  if [ $VALUE_A = $VALUE_X ] ; then
    echo "1" > /home/siop/port2/pin17
  else
    echo "0" > /home/siop/port2/pin17
  fi
sleep .5
done