Телесистемы
 Разработка, производство и продажа радиоэлектронной аппаратуры
На главную   | Карта сайта | Пишите нам | В избранное
Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс.
e-mail:jobsmp@pochta.ru

Телесистемы | Электроника | Конференция «Микроконтроллеры и их применение»

;) Классика жанра. Эт ещё смотря в чём компилить. Например, для того же HI-TECH-C (for PIC)...(+)

Отправлено Макаров 01 июня 2008 г. 15:23
В ответ на: Гы, а я уж возомнил что разбираюсь в Си :-). А он блин неизчерпаем>> отправлено <font color=gray>VasilyS</font> 01 июня 2008 г. 14:22

... в применении 8-битников, конечно :)

5.4.7 Structures and Unions

PICC supports struct and union types of any size from one byte upwards. Structures and unions only
differ in the memory offset applied for each member. The members of structures and unions may not be
objects of type bit, but bit fields are fully supported.

Supported Data Types and Variables
HI-TECH PICC compiler 145

Structures and unions may be passed freely as function arguments and return values. Pointers to structures and unions are fully supported.

5.4.7.1 Bit Fields in Structures

PICC fully supports bit fields in structures.
Bit fields are always allocated within 8-bit words. The first bit defined will be the least significant bit of
the word in which it will be stored. When a bit field is declared, it is allocated within the current 8-bit
unit if it will fit, otherwise a new 8-bit byte is allocated within the structure. Bit fields can never cross
the boundary between 8-bit allocation units. For example, the declaration:

struct {
unsigned lo : 1;
unsigned dummy : 6;
unsigned hi : 1;
} foo;

will produce a structure occupying 1 byte. If foo was ultimately linked at address 10H, the field lo will
be bit 0 of address 10H, hi will be bit 7 of address 10H. The least significant bit of dummy will be bit 1
of address 10H and the most significant bit of dummy will be bit 6 of address 10h.

Unnamed bit fields may be declared to pad out unused space between active bits in control registers. For
example, if dummy is never used the structure above could have been declared as:

struct {
unsigned lo : 1;
unsigned : 6;
unsigned hi : 1;
} foo;

If a bit field is declared in a structure that is assigned an absolute address, no storage will be allocated
for the structure. Absolute structures would be used when mapping a structure over a register to allow a
portable method of accessing individual bits within the register.


Составить ответ | Вернуться на конференцию

Ответы


Отправка ответа
Имя*: 
Пароль: 
E-mail: 
Тема*:

Сообщение:

Ссылка на URL: 
URL изображения: 

если вы незарегистрированный на форуме пользователь, то
для успешного добавления сообщения заполните поле, как указано ниже:
вычтите два из трёх, получится:

Перейти к списку ответов | Конференция | Раздел "Электроника" | Главная страница | Карта сайта

Rambler's Top100 Рейтинг@Mail.ru
 
Web telesys.ru