可以將變數的某bit指向實體io嗎?
|
||||
---|---|---|---|---|
初級會員
|
我是想把實體io對應到myPort這個變數的bit,程式碼如下:
union { struct { unsigned b0: 1; unsigned b1: 1; unsigned b2: 1; unsigned b3: 1; unsigned b4: 1; unsigned b5: 1; unsigned B6: 1; unsigned B7: 1; } oneBit; unsigned char allBits; } myPort; #define myPort.oneBit.b1 LATDbits.LATF0; #define myPort.oneBit.b2 LATDbits.LATF1; #define myPort.oneBit.b3 LATDbits.LATF2; #define myPort.oneBit.b4 LATDbits.LATF3; #define myPort.oneBit.b5 LATDbits.LATF4; #define myPort.oneBit.b6 LATDbits.LATF5; 很不幸的編譯在上面define的時候會有warning,而且不能使用 不知道有沒有辦法處理?? 我是想說把分散在各PORT的IO能用一個變數來改變各IO值
發表於: 2007/11/16 10:12
|
|||
|