|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace ParallelPort
{
public partial class HipotParPort : Form
{
public static int nAddress = 888; //Default is LPT1. If you want to use LPT2 choose 632
public static Int32 onValue = 1; //decimal 1 -> only D0 is high.
public static Int32 offValue = 0; //decimal 0 -> all data pins of the ParallelPort is low.
public static int nDelay = 1000; // put some time between ON/OFF states in case of burning...
public class PortAccess
{
//http://logix4u.net/Legacy_Ports/Parallel_Port/Inpout32.dll_for_Windows_98/2000/NT/XP.html
//Check the upper url to learn how the inpout32.dll works
//Note that inpout32.dll must be put to the C:\Windows\System32 folder.
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int nAddress, int nDecimalValue);
} //public class PortAccess
public static void HipotParPort1(Boolean bBulbOn)
{
Application.DoEvents();
if (bBulbOn)
PortAccess.Output(nAddress, onValue);
else
PortAccess.Output(nAddress, offValue);
Thread.Sleep(nDelay);
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// HipotParPort
//
this.ClientSize = new System.Drawing.Size(104, 47);
this.Name = "HipotParPort";
this.ResumeLayout(false);
} //public static void HipotParPort1(Boolean bBulbOn)
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.