assigning a variable to port

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

assigning a variable to port

1,723件の閲覧回数
mojalefa1
Contributor I
how do you assign a switch to port, because I wrote the following code line
bit switch = P1^3   which is supposed to assign a variable switch to bit 3 of port1 but it gives me an error message on this line when I try to compile
ラベル(1)
0 件の賞賛
返信
1 返信

457件の閲覧回数
CrasyCat
Specialist III
Hello
 
- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
  To retrieve that info:
    - Start CodeWarrior
    - Select Help -> About Freescale CodeWarrior
    - Click on "Install Products"
    - CodeWarrior version used is displayed on top in the Installed Products dialog.
In any case ANSI standard does not define P1^3 as valid notation to access bit number 3 in a variable / register).
 
Please refer to your favorite ANSI C programming manual and look at how bitfields are managed. 
 
CrasyCat
0 件の賞賛
返信