Reading Input using Visual C#

This is a group to discuss all details on home automation, home security technology and related technologies.

Reading Input using Visual C#

Postby r0t1prata on Mon Oct 30, 2006 1:32 am

Hi i'm currently doing a project which requires me to use C# to read parallel port inputs, any idea how? thanks =)

also which circuit should i use to read input? i only need to read one input atm.
r0t1prata
 
Posts: 6
Joined: Mon Oct 30, 2006 1:30 am

Reading Input using Visual C#

Postby Tomi Engdahl on Mon Oct 30, 2006 11:22 am

I have not used C# for parallel port controlling myself.
But according this article you can do parallel port controlling from C# program with help of inpout32.dll library (a geneal purpose DLL that gives direct I/O port controlling to many languages lacking it on Windows system).

I/O Ports Uncensored - 1 - Controlling LEDs (Light Emiting Diodes) with Parallel Port
http://www.codeproject.com/csharp/csppleds.asp

Code: Select all
using System;
using System.Runtime.InteropServices;

public class PortAccess
{
    [DllImport("inpout32.dll", EntryPoint="Out32")]
    public static extern void Output(int adress, int value);
}


For ex: for full signaling to pins we have to call the Output method of PortAccess like:
PortAccess.Output(888, 255);


This inpout32.dll library also has Inp32 function defined in it. It is for reading I/O ports. Doing the right quite similar function definition as it is done for the output routine, you should get it useable on your C# program quite easily. when you have that routine, then just use the information at this document:

Parallel port interfacing made easy
http://www.epanorama.net/circuits/parallel_output.html
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby r0t1prata on Tue Oct 31, 2006 1:51 am

i did that already, problem is when i measured the voltage.
I had a button which sends data output +5v to input pin. when i clicked on the button the voltage was measured at +5v, but when i clicked on the input, which should be receiving +5v, the meter showed a low voltage.

Also i have this 12V beacon, any circuit recommendations that i can use to just power up the beacon through the PC? and how to add the beacon into the circuit. thanks
r0t1prata
 
Posts: 6
Joined: Mon Oct 30, 2006 1:30 am

Parallel port input and output

Postby Tomi Engdahl on Tue Oct 31, 2006 7:33 pm

i did that already, problem is when i measured the voltage.


Can you guv emore details on the setup you used ?

Also i have this 12V beacon, any circuit recommendations that i can use to just power up the beacon through the PC? and how to add the beacon into the circuit. thanks


The question is exactly what kind of beacon ?

Typically the way to power on and off external circuti through PC control, the most flexible and usually safest method is to use relay for controlling. Use a circuit that controld a relay through parallel port. Select a relay that has suitable voltage and current ratings for the load to control, whatever the voltage and current you need to control. Same idea applies to 12V DC controlling and 110V/230V AC power controlling.
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby r0t1prata on Tue Nov 07, 2006 2:04 am

this is the description of the beacon...
BEACON, RED 12V/24V 2W; Colour, lens:Red; IP rating:65; Power consumption:2W; Voltage, supply DC max:24V; Voltage, supply DC min:12V

my relay is 10A DC12V..also to add...i found the two pins which measuered a resistance of 400 ohms..how do i know which pin connects to Vcc?

I also need help on using a sensor
SENSOR, COMP PIR STND 5M BLK; RoHS Compliant:YES; Colour:Black; Current, output:100µA; Sensing range:5m 100° Horizontal, 82° Vertical; Temperature, operating max:60°C; Temperature, operating min:-20°C; Voltage, supply ma

the pdf file which has the wiring diagram, but i don't understand(sorry for being such a noob >.<)
http://www.farnell.com/datasheets/36210.pdf
r0t1prata
 
Posts: 6
Joined: Mon Oct 30, 2006 1:30 am


Return to Home Automation

Who is online

Users browsing this forum: No registered users and 1 guest

cron