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 Dado_digital_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 = 1; private void button1_MouseDown(object sender, MouseEventArgs e) { timer1.Enabled = true; } private void button1_MouseUp(object sender, MouseEventArgs e) { timer1.Enabled = false; } private void timer1_Tick(object sender, EventArgs e) { if (cnt >= 6) cnt = 1; else cnt++; lblNumero.Text = cnt.ToString(); ControlPort.Output(0x378, cnt); } private void Form1_Load(object sender, EventArgs e) { ControlPort.Output(0x378, 1); } } }
Descarga del archivo
Descargar archivo