使用vb.net帮助激活和停用并行端口引脚 [英] Helping>>>activated and deactivated parallel port pins by using vb.net

查看:54
本文介绍了使用vb.net帮助激活和停用并行端口引脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有vb.net代码来控制并行端口,这是可行的
但是如何同时激活特定的引脚和停用其他引脚????
这是代码

I have vb.net code to controlling parallel port and it is work
but how I can activated specific pin and deactivated other pins in the same time???
this is the codes

Option Strict Off
Option Explicit On
Module InpOut32_Declarations

    'Inp and Out declarations for port I/O using inpout32.dll.
    Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Short) As Short

    Public Declare Function Input Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer, ByVal Value As Integer)
    Public Declare Sub Output Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
End Module

Public Class parallelport

    Private Sub openpin5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles piforward.Click

        Output(&H378, 8) 'to open pin number 5 D3
end sub
Private Sub openpin4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles piforward.Click

        Output(&H378, 16) 'to open pin number 6 D4
end sub
end class

推荐答案

并行端口仅是8位数据,因此打开端口要写入1,关闭端口要写入0.因此,可以通过写入10011001来打开多个端口.
Parallel ports are just 8 bits of data so to turn on a port you write a 1 and to turn one off you write a 0. So you can turn multiple on by writing 10011001 for example.


这篇关于使用vb.net帮助激活和停用并行端口引脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆