ArmandoCircuitos
Inicio
Electronica
Programacion
Resultado
Codigo
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Contador_LPT_01 { public partial class Form1 : Form { class ControlPort { [DllImport("inpout32.dll", EntryPoint = "Out32")] public static extern void Output(int adress, int value); } public Form1() { InitializeComponent(); } byte cnt = 0; private void btnMas_Click(object sender, EventArgs e) { if (cnt < 9) { cnt++; ControlPort.Output(0x378, cnt); } lblContador.Text = cnt.ToString(); } private void btnMenos_Click(object sender, EventArgs e) { if (cnt > 0) { cnt--; ControlPort.Output(0x378, cnt); } lblContador.Text = cnt.ToString(); } private void Form1_Load(object sender, EventArgs e) { ControlPort.Output(0x378, 0); } } }
Descarga del archivo
Descargar archivo