Re: 請問C18如何宣告位元變數
|
||||
---|---|---|---|---|
資深會員
|
我已經會用位元變數了,謝謝大大們指導。
發表於: 2007/1/2 14:17
|
|||
|
Re: 請問C18如何宣告位元變數
|
||||
---|---|---|---|---|
版主
|
在你的宣告裡用了 extern 代表這個變數與結構是別的程式已經宣告過了,請確定該變數的原始宣告是否存在。
發表於: 2007/1/2 10:35
|
|||
|
Re: 請問C18如何宣告位元變數
|
||||
---|---|---|---|---|
資深會員
|
請問版主:
我寫了一個結構變數宣告如下: extern volatile unsigned FG1; extern volatile struct { unsigned DIR_C:1; } FG1bits; 這樣宣告編譯的時候沒有問題,但是若在程式中要使用DIR_C這個位元變數時,例如寫這行指令: FG1bits.DIR_C=1; 編譯時就會出現下面這一行錯誤: 239:Error [1205] unknown member 'FG1bits' in '__tag_136' 請問我是哪裡語法不正確嗎? 謝謝。
發表於: 2006/12/29 17:06
|
|||
|
Re: 請問C18如何宣告位元變數
|
||||
---|---|---|---|---|
版主
|
應該用位元結構的方式宣告,使用方式請看 W401 workshop 講義的第四章 STRUCT & UNION 的使用方式
發表於: 2006/12/29 10:17
|
|||
|
請問C18如何宣告位元變數
|
||||
---|---|---|---|---|
資深會員
|
請問版主:
我用 bit Flag; 這樣寫想宣告一個名稱為Flag的位元變數,但是無法編譯,請問應該怎麼宣告才正確? 謝謝。
發表於: 2006/12/29 10:03
|
|||
|