我有一台Cincoze DE-1000工业 PC,它配备了Fintek F81866A芯片组。我必须管理 DIO 引脚才能从物理按钮读取输入并设置开/关 LED。我有 C++ 编程的经验,但不是低级/硬件级的。
在 PC 随附的文档中,有以下 C 代码:
#define AddrPort 0x4E
#define DataPort 0x4F
//<Enter the Extended Function Mode>
WriteByte(AddrPort, 0x87)
WriteByte(AddrPort, 0x87) //Must write twice to entering Extended mode
//<Select Logic Device>
WriteByte(AddrPort, 0x07)
WriteByte(DataPort, 0x06)
//Select logic device 06h
//<Input Mode Selection> //Set GP74 to GP77 input mode
WriteByte(AddrPort, 0x80) //Select configuration register 80h
WriteByte(DataPort, 0x0X)
//Set (bit 4~7) = 0 to select GP 74~77 as Input mode. …Run Code Online (Sandbox Code Playgroud)