Program port paralel


















So, you need to know basic bitwise operations. To make a particular bit in a byte high without affecting other bits, write a byte with corresponding bit 1 and all other bits 0; OR it with original byte. Similarly, to make particular bit low, write a byte with corresponding bit 0 and all other bits 1; AND it with original byte. In Turbo C, there are following functions used for accessing the port:. If you include DOS.

H header, these functions will be considured as macro, otherwise as functions. So, we can use this function to read status and control registers together. So this can be used to write data and control together. Let us start with inputting first. Here is an example program, copy it and run in Turbo C or Borland C without anything connected to parallel port. Then you should see data available in status register and pin numbers 10, 11, 12, 13 and 15 of the parallel port.

Pin 11 active low is 0 and all other pins are 1 means it is OK. Now, take a D male with cables connected to each pins. Short all the pins from 18 to 25, call it as ground.

Now you can run above program and see the change by shorting pins 10, 11, 12, 13 and 15 to ground. I prefer using switches between each input pins and ground. Be careful, do not try to ground the output pins. To find out the availability of ports in a computer programmatically, we will use the memory location where the address of port is stored. If you run the the following code in Turbo C or Borland C, You will get the addresses of available ports.

To check the output, we will use LED's. I have driven LED's directly from the port. But it is preferred to connect a buffer to prevent excessive draw of current from the port. With that, if you run the program given below, you should see the LED blinking with app. I will stop this part here itself. Next part of this article is now ready. Click here to Read part 2. Part 3 is having the example using LCD module.

There we are going to learn connecting LCD module to parallel port. Read part 3. Parallel port basics: In computers, ports are used mainly for two reasons: Device control and communication. Displays contents of status register of parallel port. When you want to light up an LED, there is a special way to connect them to a data register.

So, you need some tools to connect. As a tutorial, I will explain how to connect only 1 LED. Here you have to connect a ground pin to any pin starting from the 18th to 25th. All are ground pins, so there is no difference. The output pin or positive of the LED should be connected to a pin in the data register. When you write a value which enables that particular data register pin, then the LED will light up.

Never connect devices that consume more voltage than LEDs, as this would burn your parallel port or entire motherboard. So, use them at your own risk! I recommend that you refer to the method written below if you're going through more advanced methods. If you want to switch electric appliances on and off, then you will obviously have to use relays or high voltage Triacs. I recommend using relays and connecting them through the method I have illustrated below. If you're not satisfied with lighting up LEDs and you're hungry to go further, then use this method to connect all your advanced or more complex devices to the Parallel Port.

Also remember that you can replace these LEDs with any devices such as relays or Solenoids that support up to mA and they will run smoothly. The surveillance system that I have written is very small and can only be used at home or for personal use. However, you can make it more advanced if you know how more complex security systems work. Here, the application has a timer and it always checks for status register changes.

If something changes, then the application's status will be changed and a sound will be played accordingly. This can be used to check whether your room's door is closed. What you have to do is place a push to turn on the switch on the edge of the door and you have to place it in a manner which activates when the door is opened.

If you're not using a push to turn on the switch, then just place two layers of thin metal that can be bent and place them on the door. However, those two layers of metal should be able to make a short circuit when the door is closed.

One piece of metal layering should be soldered to a screen wire circuit wire and that should be connected to the ground pin. The other layer of metal piece should be connected to a status pin of the parallel port. Status pins are 10, 11,12,13, I have learned to program hardware ports since the year As far as I can remember, most of the time I used to get resources from Google. However, keep in mind that creativity cannot be searched from the web. It should be in your mind When transistor is off no current flows into the relay, so it switches off.

The diode provides an outlet for the energy stored in the coil, preventing the relay from backfeeding the circuit in an undesired manner. The transistor in the circuit can be used for controlling output loads to maximum of around mA depends somewhat on components and operation voltage used. The external power supply can be in 5V to 24V range. When you use a relay that takes less than this mA of current and works at the power supply you use, you should be OK. The output load that you can control with the circuit with a relay only depends on the relay output contact ratings maximum current and maximum voltage.

The circuit ban be used also directly to control small loads less than mA current. Just put the load you want to control in place of the relay coil. You can select almost any general purpose power transistor for this circuit which matches your current and voltage controlling needs. Depending your amplification facter inherint to the transitor Q2 you might not hough be able to use the full current capability of the output device T2 before there will be excessive losses heating in that transistor.

This circuit is basically very simple modification of the original optoisolator circuit with one transistor. The difference in this circuit is that here T2 controls the load current and Q1 acts as a current amplifier for T2 base control current. Optoisolator, R1, R2, Q1, D1 work exactly in the same way as in one transistor circuit described eariler in this documents.

R3 acts like an extra resistor which guarantees that T2 does not conduct when there is no signal fed to the optoisolator small possible current leaking on optosiolator output does not make T1 and T2 to conduct. Mains power controlling with parallel port It is possible to control mains voltage through parallel port with a suitable circuit.

When controlling mains voltage, you need to be varycarefyl and know what you do to do it safely. Mains voltage can kill if you get in touch with it, and bad mains controlling circuit can burn down your house.

First idea for controlling mains power is to use one of the circuit above to control a relay that then controls the mains power. This suits for many applications as long as the relay is rated for the mains power switching applications and for the current rating of your applications.

A properly designed circuit should have in addition to the relay plus parallel port interface circuit also a peoprly sized fuse that will cut the power going through the relay in case of short circuit or overload at the equipment being controlled. The fuse here is used to protect the relay against overload.

A relay will work on applications where the device is turned on and off quire rarely. If you are switchign the device on and off often, the normal relay will siffer of limited mechanical and electrical age, and in some applications also on noise caused by sparks that are formed when relay contacts open and close. Those sparks can cause radio frequncy noise. Another component suitable for mains voltage controlling is a solid state relay.

The circuit show below describes how to control a solid state relay from PC parallel port. The solid state relay controls the mains voltage. The relay for this application should be sone rated for the mains voltage you used and the current your controlled equipment marked with L on the picture takes. The solid state relays designed for mains operation provide the needed isolation between the control input and mains side.

The solid state relay should be used according the manufacturer application notes and your local electrical equipment codes. You should keep the mains side and low voltage side isolated in all cases even on equipment damage case. You should also put a properly rated fuse in series with the solid state relay so protect the relay against overload. A proper size fuse will not protect the solid state relay against overheating of the load tries to take too much current through the relay.

The fuse might not ne able to protect the relay agains short circuit damages if you short-circuit the load, you generally loose the solid state relay and the fuse.

Many solid state relays can be controlled directly to parallel port without extra components. You need to select a solid state relay that is voltage controlled and the control voltage range can take the voltage that printer port outputs 5V or somewhat less. For reliable operation you should select a relay that can operate at down to 3V input voltages and does not take too much control current a SSR that takes only few milliampreres is preferred because current output capacity of parallel port is usually limited to that.

To gurarantee that the operation is reliable with the direct connection, be sure to measure that the control vontage entering the SSR is within the specified operating range when the relay is controlled to parallel port you can measure this without mains power applied to the rest of circuit, safer o measure in this way. Controlling a solid state relay with lower than specified control voltage can lead unreliable operation of solid state relay, and can even cause some solid state relays fail when heavily loaded!

It is also possible to build the mains voltage controlling part from discrete components. Here are two example cirucuits: Those are just as an example. I do not recommend you to build those circuits.

Nowadays the solid state relays are available at reasonable prices, and with them it is easier to build safe controlling circuits. One very important thing to note on mains controlling circuits is that they should be built very carefully and right. Mains voltage can kill if you come in touch with it. A baddly constructed circuit can overheat and cause fire. Any mains controlling circuit should be built in such way that there is an overcurrent protection component that protects the circuit against overloads usually a fuse in the power input.

The circuit must be built into a safe and mechanically stable case. An insulating plastic case electronics case made from plastic that does not burn easily is one option. Another option is to built the circuit into a gounded metal case. The exact practices how to build safe mains powered circuits is outside the scope of this article.

You should know those details before attempting to built any ciruit that connects directly to mains power. Compact 8 channel output driver You can build a circuit with many outputs by conbiming many individual transistor based circuits. If you want to hve a compact construction with up to 8 outputs, I would recommend you to consider using ULN IC that is manufactured by Allegro and several other manufacturers.

Featuring continuous load current ratings to mA for each of the drivers, the ULNA high-current Darlington array is ideally suited for interfacing between low-level logic circuitry and multiple peripheral power loads. Typical loads include relays, solenoids, stepping motors, magnetic print hammers, multiplexed LED and incandescent displays, and heaters. The drivers need no power supply; the VDD "common" pin is the common cathode of the eight integrated protection diodes.

The output 'device' can be as simple as a LED, a small motor, or a relay. The inputs on the left side of the IC are directly suitable to be connected to PC parallel port output lines.

The outputs are open collector output output gets grounded through transistor when corresponding input line goes to high state , so they are well suitable for controlling various loads powered through external power supply. The maximum controllable voltage is 50V and maximum current per channel is mA. Outputs may be paralleled for higher load current capability. The "common" line is connected to a suitable overvoltage protection circuitry to prevent damage to the IC due to "back emf" when loads such as motors and relays switch on and off.

This "common" line can be for example connected to the power supply line that supplies power to the relays. You can also use for example 30V zener connected to this line as protetion component limits relay power supply to maximum less than 30V.

Or you can connect a 12V zener rfom common to the relay power supply plus limits spikes to power supply voltage plus 12V, do not use higher than 30V power supply. Here is an example of control circuit that drives eight LEDs using ULN IC: This circuit can be also used to drive other kinds of loads, for example relays, small light bulbs etc.

Just replace the LED plus resistor combination with the load you want as long as the load is within the capabilities of the ULN output drive capacity.

You can use for example 15V zener diode for this ciruit. This is sold as a kit with full details on the documentation. This page gives you control software for download. Stepper Motor Controller Connection Diagrams Relay control - The question of how to connect and control a relay from the parallel port came up. Here's how you can do it, even if you don't know a lot about electronics! Simplified Output Interface - is a simple and inexpensive output control interface for the Centronics printer port.

The digital state of each of the eight lines from the printer port is used to control the IC's internal "drivers" which in turn control the LEDs. Power for the LEDs is provided by the external battery. The digital state of each of the eight lines from the printer port is used to control the IC's internal "drivers" which in turn control the Relays and LEDs.

A Single-Channel Control Line is a very simple relay controlling board that controls to parallel port. The aim was to develop a circuit simple enough to be manufactured 'from the ground up' on the first day of the weekend and then spend the second day developing software to run it. This circuit is based on one transistor controlling a relay. There are examples for a solid state relay and normal relay controlling.

Also parallel port reading is covered. I have personally tested Kemo M Software comes with some source code examples. Kemo B - 8-Channel-relay board for switching different appliances, lamps or motors by means of a computer program.

The relay points can be loaded up to 3A 25V each at maximum. Operating voltage of the relay board: 12V DC 0. Kemo M - 4-Channel computer switch for switching up to 4 different appliances, lamps or motors by means of a computer program.

Consumers with operating voltages of This module handles only 4 first outputs. Kemo M - Relay module for switching up to 8 different appliances, lamps or motors according to a computer program software is enclosed. There is control software downloadable for DOS and Windows. However, when switching occurs too frequently or too quickly the life time of the contact points is shortened considerably.

This can be solved perfectly by replacing the relays with a triac. Using optocouplers, the entire interface network remains electrically isolated from the voltage that has to be switched. Ready made control software Here is a colelction of links to ready made parallel port control software. There is a wide varietyof different software available for different operating systems and different use. Pick up one that suits best for your uses. In addition to different DMX interface drivers, this software comes also with simple parallel port driver called Parallelport.

This Parallelport driver maps 12 first control channels to parallel port output pins 8 first come to data lines as the circuits in this document uses, rest go to parallel port control output lines. You just define each pin you want to control to be "Generic Dimmer" and use the light controlling interface sliders to control parallel port pins freely: putting the control slider below center point keeps corresponding output low logic 0 , and above center point sets the output high logic 1.

DMXcontrol software works on Windows systems. This software supports Sound-to-Light functions "light organ-effects" when connected with audio-program Winamp www. You need to install the Driverlinx PortIO link provided on software download page to make parallel port to work.

This software supports controlling of the parallel port output pins according your control program can be written with C, Python or several IEC control languages. This is worth to check if you are thinking of industrial automation applications. This software comes with source code.

This software runs on Linux system. It gives a visual display of the three software registers used by the Standard Parallel Port. Each individual bit can be turned on or off by a simple click of the mouse. Using control outputs In addition to the data pins the parallel port has four other output pins. Those outputs give TTL level signals, but are constructed electrically differently and controlled with a different control register.

The control outputs are generally constructed as open collector output with internal pull-up resistor. This kind of output can control TTL inputs fine, and might be able to run an optocoupler or solid state relay in sink mode depends on the device. More details on the parallel port register summary later in this document.

Note: There can be somewhat different implementations on some PCs. Reading the input pins in parallel port input pins PC parallel port has 5 input pins. Those inputs can accept TTL level signals You can connect a TTL level output signal to it directly remeber to attach the signal source ground to parallel port ground.

When the switch is activated, the pin goes to logic state 0. You can wire simple switches to this input with the following circuitry. If you want to use all five inputs, build five circuits to different pins. TTL inputs in the parallel port tend somewhat to float high, so you might get by without the pullup resistors, but you are pushing it might not work reliably. This circuit used 3 kohm pull-up resistors and extra "safety" resistors between the parallel port and rest of the circuit.

You can modify those circuit ideas for other applications as well. You can for example replace the switch in the circuit with a relay output contact or optocoupler output side. In this way you can get signals nicely to the PC and keep the PC isolated from your control circuitry. The following circuits can be used isolate external when connecting to parallel port. Wire the output side of the optocoupler on the right side to the parallel port input circuit in place of the switch in the circuit above.

If you wish the control from both switch and external signal, you can wire he optocoupler output in parallel with the switch in the circuit. Please note to put the optocoupler out - wire to the side that connects to the circuit ground if you wire optocoupler the wrong way they wil not work. MacX YouTube Downloader. Microsoft Office YTD Video Downloader. Adobe Photoshop CC. VirtualDJ Avast Free Security. WhatsApp Messenger. Talking Tom Cat.

Clash of Clans. Subway Surfers. TubeMate 3. Google Play.



0コメント

  • 1000 / 1000