| ??? 12/31/02 12:32 Read: times |
#35277 - RE: Keil C - How to place Structure on Port |
All the Ports on the 8052's are mapped in memory as well as being hardware addresses, so you can map that structure onto the address of the port P0 is at address 80h for example.
so... if you do :-
struct test
{
char nibble:4
char bit4:1
char bit5:1
char bit6:1
char bit7:1
};
and in your code do :-
struct test *p;
p = (struct test*) 0x80;
p->bit4=1;
This will set bit 4 of port 0. Sorry, my C is a bit rusty, I haven't worked in C since last September, but you get the idea. Chris. |
| Topic | Author | Date |
| Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place ... Erik | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - Andy | 01/01/70 00:00 | |
| RE: Keil C - Andy | 01/01/70 00:00 | |
| RE: Keil C - Peter | 01/01/70 00:00 | |
| RE: Keil C - Peter | 01/01/70 00:00 | |
| RE: Keil C - Michael | 01/01/70 00:00 | |
| RE: Keil C - Peter | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
| RE: Keil C - How to place Structure on Port | 01/01/70 00:00 | |
RE: ANSI Bitfields | 01/01/70 00:00 |



