Posts

Showing posts with the label os

PC Robot starter OS

Image
Robot os. The infinite loop. While true%     ' set or reset values     ' input sensor values     ' Other jobs     ' Do what is needed based on input values. wend Part I. Set or reset values. Part II Get sensor values. Using basic, the command to read from ports in qbasic is INP. The address you need to read from is the address of the parallel port (usually 378h) + 1; so the usual address is 379h. As i mentioned before, the pins used for input are 10-13 and 15. Reading the different pins is little harder than writing to the ports, as you have to mask out the pins your not interested in. When you read the port, the first 3 bits returned are not used. For example, the qbasic code below would read pin 12 (out of paper). When this port is high, "Out of paper / pin 12 toggled" will be displayed:   data = inp(&h379) IF (data and 32) = 32 then print "Out of paper / pin 12 high" The table be...