Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate.

Similar presentations


Presentation on theme: "Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate."— Presentation transcript:

1 Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate with the world. We can represent a binary value in a couple of manners. It can be a one or zero, and it can also be represented by the presence or absence of voltage.

2 Register A physical location that can hold a certain amount of data Lots of them so each has an address How much data a register can hold is measured in bits or bytes (8 bits = 1 byte)

3 PC Gadget Master II Parallel port has three 8 bit registers which are used with the PC Gadget –Output 888 and 890 –Input 889 With switch in the B position: –12 Output lines, 4 Input lines With switch in the A position: –11 Output lines, 8 Input lines

4 Computer Sensing and Control

5 To get output, we issue a command in Visual Basic called OUT. If we wish to have the value (voltage) issued on a pin, we issue the corresponding binary value with the out command.

6

7 OUT 888, 128

8 Output Commands Out Register Address, Register Contents OUT 888, 128 turns on pin 1 OUT 888, 1 turns on pin 8 OUT 888, 64 + 32turns on pin 2 and 3 To turn off the voltage, we issue??

9 OUT 888, 0

10 PC Gadget: Input

11 Input Commands INP Register Address INP 889 checks the state of the inputs Input returns a binary number where a 1 corresponds to a high state on a pin. How do we know if a pin is high?

12 N = Inp(889) If (N and 64) = 64 then (Do something here!) End if What are we trying to do with the N and 64 = 64??

13 Masking Boolean operators are used to MASK values in decision making operations. We can “filter” an input for a specific value to ensure that we can detect its existence

14 AND Truth Table 1 AND 1 = 1 010 100 000

15 Bitwise AND 01100011 AND 01000000 = 01000000

16 Review Gadgetmaster II has Input register (memory area) and an Output register. Each register has an address: Input is 889. Output has two: 888 and 890. Output has twelve lines on which voltage can be sent. Each line corresponds to a binary number. If we wish to send voltage through a particular line, we use the OUT command, the port number, and the value of the line which on which we wish to have voltage. For example: OUT 888, 128 places voltage or a high state on pin 1. OUT 888, 8 places voltage on pin 5. OUT 888, 96 places voltage on two pins: 2 & 3.

17 If we wish to use the other four pins (9 – 12) we must use a separate address which is 890. These four pins have a special arrangement with pin 9 and eleven switching values so that the four pins have decimal 2, 4, 8, 1. Remember, each pin is addressed by us in decimal but actually corresponds to a binary value on the pin!! Input works a little differently than output but has similarities. The input register is similar to the output in that it has an address which is 889. It is similar to the output register in that each pin has a binary value which corresponds to a high state on the pin. We use the decimal equivalent to address the pin. Review

18 To get the value of a pin on the input register we have to look at all values on the register at the same time. We then examine the number returned to us from the register and it will inform us as to which pin has voltage. We use the INP command to get the value in the input register. For example: intRegVal = INP (889) tells us the value that is in the register. It is placed in a variable called intRegVal which we declare and then examine. There is a jumper which is set to B by default which controls the number of lines which are active at any time. There are eight lines but only four are active with the jumper is this position.


Download ppt "Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate."

Similar presentations


Ads by Google