CPU Speaker Monitor Printer Touch pad Scanner Key Board Mouse Microphone
Input Output Input Output Input All these devices can be divided in to two categories Process
Motor ? ? Light Bulbs or LEDs Water Censer Light Censer (LDR) Micro Switch Temperature Censer (Thermister) ?
Parallel Port ( Printer Port) USB (Universal Serial Bus) RS232 (Serial Port) GPIB (Genaral Purpose Interface Bus) Speaker Microphone Line In Various types of connecters (communication ports) available in rear side of CPU
* 0= * 1= * 6= 60 1 * 4 = 4 = 164 Decimal Binary We use Ten Symbols * 1 = 8 4 * 1= 4 2 * 0 = 0 1 * 1= 1 = 13 We use Two Symbols 0 1 or Off On or Low Hi or 0V 5V
Output Data 1 Data 0 Data 2 Data 4 Data 5 Data 3 Data 6 Data 7 ACK Busy Paper Empty Select StrobeInput Initialize Printer Auto Feed Error Select Input Pins 18 – 25 Ground Output Input 8 Data Outputs (378 H) 4 Other Outputs (379 H) 5 Data Inputs (37a H)
V VCC 470 ohm LED Printer Port Example in Qbasic Out &H378,1 (for LED off) Out &H378,0 (for LED on) Example in Qbasic Out &H378,1 (for LED off) Out &H378,0 (for LED on)
LED 470 ohm 5 V D0 D1 D7 D2 Printer Port
Number Output Data bit pattern D7 D6 D5 D4 D3 D2 D1 D … = 0V (Low state) 1 = 5V (High state)
IN+ IN- Comparator ¼ LM339 R4 3.3kohm 12V VCC R2 100kohm R3 10kohm From Printer Port R5 R1 10kohm 3.3kohm D400 1N4007 D1 X Y K2 RELAY V AC L N 230V AC Motor
Printer Port Switch we can use Qbasic function inp() X = Inp( &H379) Print X we can use Qbasic function inp() X = Inp( &H379) Print X 10 25
100 k Preset IN+ IN- Comparator 10kohm 12V To Printer Port Input 100kohm kohm ¼ LM339 LDR 1 M Preset