[問題]平行埠的單一bit資料的存取
請教一下各位
我利用linux 系統存取 parallel port
其中
http://www.bioinspired.com/users/ajg112/electronics/parallelPort.shtml
D0~D7 是一個byte的資料
我想一次只針對一個bit來作寫入的動作,不知道它是否有相對應的函式/api之類的
以下這是網路上看到的code
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
#define base 0x378 /* printer port base address */
#define value 255 /* numeric value to send to printer port */
main(int argc, char **argv)
{
if (ioperm(base,1,1))
fprintf(stderr, "Couldn't get the port at %x\n", base), exit(1);
outb(value, base); //這一段是針一個byte作寫入的動作
}
而我想要作是的一次只寫一個bit
例如
D0 = 1;之類的
另外請問 如果 我要透過parallel取得目標裝置所發出來的信號
那parallel port D0~D7的腳要如何取對方送來的資料?
它是否有輸出輸入方向的設定問題?!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.218.239.206
推
04/07 21:10, , 1F
04/07 21:10, 1F
推
04/07 23:10, , 2F
04/07 23:10, 2F
→
04/07 23:12, , 3F
04/07 23:12, 3F
→
04/08 00:30, , 4F
04/08 00:30, 4F
推
04/08 02:12, , 5F
04/08 02:12, 5F
→
04/08 02:15, , 6F
04/08 02:15, 6F
LinuxDev 近期熱門文章
PTT數位生活區 即時熱門文章