ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
19 апреля
524632 Топик полностью
Nikolay801_ (23.06.2014 15:13, просмотров: 253) ответил Ljutik1 на Люди, помогите с настройками CAN AT90CAN128
Давным давно я ковырялся с атмеловской мегой и там было так  #include "can_bdr.h" #define Can_bit_timing() {CANBT1=CONF_CANBT1;CANBT2=CONF_CANBT2;CANBT3=CONF_CANBT3;} а в "can_bdr.h" вот что /*H************************************************************************** * $RCSfile: can_bdr.h,v $ *---------------------------------------------------------------------------- * Copyright (c) 2003 Atmel. *---------------------------------------------------------------------------- * RELEASE: $Name: avr-can11-lib-mcu-0_0_3 $ * REVISION: $Revision: 1.3 $ * FILE_CVSID: $Id: can_bdr.h,v 1.3 2004/03/29 09:31:24 jberthy Exp $ *---------------------------------------------------------------------------- * PURPOSE: * This file provides a set of pre-define configuration FOSC/CAN_BAURATE. * *****************************************************************************/ #ifndef _CAN_BDR_H_ #define _CAN_BDR_H_ #ifndef FOSC #error You must define FOSC in config.h #elif FOSC == 8000 #if CAN_BAUDRATE == 1000 #define CONF_CANBT1 0x00 #define CONF_CANBT2 0x04 #define CONF_CANBT3 0x13 #elif CAN_BAUDRATE == 500 #define CONF_CANBT1 0x00 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 250 #define CONF_CANBT1 0x02 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 200 #define CONF_CANBT1 0x02 #define CONF_CANBT2 0x0e #define CONF_CANBT3 0x4b #elif CAN_BAUDRATE == 125 #define CONF_CANBT1 0x06 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 100 #define CONF_CANBT1 0x08 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 25 #define CONF_CANBT1 0x26 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #else #error the values for this baudrate is not in the file #endif #elif FOSC == 16000 #if CAN_BAUDRATE == 1000 #define CONF_CANBT1 0x00 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 500 #define CONF_CANBT1 0x02 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 250 #define CONF_CANBT1 0x06 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 200 #define CONF_CANBT1 0x08 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 125 #define CONF_CANBT1 0x0e #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 100 #define CONF_CANBT1 0x12 #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #elif CAN_BAUDRATE == 25 #define CONF_CANBT1 0x4e #define CONF_CANBT2 0x0c #define CONF_CANBT3 0x37 #else #error the values for this baudrate is not in the file #endif #else #error no values are entered for this frequency #endif #endif /* _CAN_BDR_H_ */
Будь ты проклят, Перри-Утконос!