[an error occurred while processing this directive] [an error occurred while processing this directive]
Ответ: Если делать красиво и есть возможность и желание немного подправить, то можно так,
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено trainer 08 апреля 2002 г. 14:27
В ответ на: C++ and IAR отправлено alexsander 08 апреля 2002 г. 10:39

typedef union {
struct {
unsigned long Send_Bytes;
unsigned long Recive_Error;
unsigned char UART_Error;
unsigned long Speed;
};
unsigned char AsBytes[(3*sizeof(long))+sizeof(char)];
} SCOM_struct;
затем :
SCOM_struct stCOMA;
ну и затем чтобы передать побайтово :
for( unsigned char i=0 ; i != sizeof(SCOM_struct) ; i++ ) SendByte(stCOMA.AsBytes[i]); /* функция выдумана */
и не нужны никакие unsigned char *, при этом доступ к членам структуры как и ранее stCOMA.SendBytes и т.д.

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru