- This topic has 1 reply, 2 voices, and was last updated 11 years, 7 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › Usage of sbit with structure members
Hi all,
go trough the following program,
struct node{
bit open;
bit close;
}door[2];
sbit door[0].open = P1^0;
sbit door[0].close = P1^1;
sbit door[1].open = P1^2;
sbit door[2].close = P1^3;
when I compile / build this program, error is thrown stating that C141: Invalid usage of sbit. Can any one verify and suggest me, how to assign SFR bit to structure members or arrays.
Yes, it is invalid usage.
sbit door[0].open = P1^0;
In the above line you can use struct node instead of sbit, like
struct node door[0].open = P1^0;