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

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

Ответ:

Отправлено Гудвин 15 января 2008 г. 08:14
В ответ на: с CANCON все Ок ... CANSTAT(7-5) либо 000, либо 100 ... отправлено ASDT+ 15 января 2008 г. 08:09


////////////////////////////////////////////////////////////////////////
//
// can_set_mode
//
// This function first sets three most significant bits (reqop2:reqop0)
// to the mode given through the argument. The modes can be
//
// mode
//
// 1xx -> Configuration Mode
// This mode allows the user to configure the Control Registers,
// the Acceptance Mask Registers and the Acceptance Filter
// Registers.
//
// 011 -> Listen Only Mode
// This mode allows the PIC microcontroller to listen to the
// bus but not actually write to it.
//
// 010 -> Loop Back Mode
// This mode allows to the transmission of data directly from
// the Transmission Buffers to the Recive Buffers without
// actually driving any data to the bus
//
// 001 -> Dissable Mode
// This mode prefents the PIC microcontroller from transmitting
// and reciving, however the WAKIF interrupt is still active
//
// 000 -> Normal Mode
// This is the normal mode of opperation for the CAN bus. It
// will recive all messages and is the only mode in which
// data can be transmitted.
//
// The reqop bits do not immediatly change the mode of operation, the
// three most significant bits in the CANSTAT register (opmode2:opmode0)
// must change to reflect the actuall change in mode, therefore a while
// statement is used to check if the CANSTAT opmode bits have changed to
// reflect the passed in mode
//
// More information can be found in the PIC18F4580 datasheet section 23.3
////////////////////////////////////////////////////////////////////////
void can_set_mode(CAN_OP_MODE mode) {
CANCON.reqop=mode;
while( (CANSTAT.opmode) != mode );
}



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

Ответы


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

Сообщение:

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

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

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

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