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 Display_hexadecimal_LPT_01 { public partial class Form1 : Form { class ControlPort { [DllImport("inpout32.dll", EntryPoint = "Out32")] public static extern void Output(int adress, int value); [DllImport("inpout32.dll", EntryPoint = "Inp32")] public static extern char Input(int adress); } public Form1() { InitializeComponent(); } byte cnt = 0; byte[] segmentos = { 63,6,91,79,102,109,125,7,127,111,119,124,57,94,121,113 }; string[] monitor = { "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F" }; private void btnMas_Click(object sender, EventArgs e) { if (cnt < 15) cnt++; lblDisplay.Text = monitor[cnt]; ControlPort.Output(0x378, segmentos[cnt]); } private void btnMenos_Click(object sender, EventArgs e) { if (cnt > 0) cnt--; lblDisplay.Text = monitor[cnt]; ControlPort.Output(0x378, segmentos[cnt]); } private void Form1_Load(object sender, EventArgs e) { ControlPort.Output(0x378, segmentos[cnt]); } } }
Descarga del archivo
Descargar archivo