/***************************************************** This program was produced by the CodeWizardAVR V2.04.5b Evaluation Automatic Program Generator © Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 24.02.2010 Author : Freeware, for evaluation and non-commercial use only Company : Comments: Chip type : AT90CAN128 Program type : Application AVR Core Clock frequency: 16,000000 MHz Memory model : Small External RAM size : 0 Data Stack size : 1024 *****************************************************/ #include <90can128.h> #include // Alphanumeric LCD Module functions #asm .equ __lcd_port=0x08 ;PORTC #endasm #include /******************************************************************* definitions *******************************************************************/ // Declare your global variables here typedef unsigned char uint8_t; typedef unsigned long int uint32_t; #define NO_MOBS 15 // number of message objects #define NOMOB 0xff // CAN2.0 B, extendef frame(29bit) message //WAS bzw woher nimmt er das? #define ENB1 PD7 //WAS bzw woher nimmt er das? #define ENB2 PD4 //WAS bzw woher nimmt er das? typedef struct { uint32_t id; // message ID uint32_t msk; // ID Mask for message uint8_t length; // length of data DLC uint8_t data[8]; // data vector }CAN_messageType; /******************************************************************* CAN initialization *******************************************************************/ void can_init( void) { uint8_t mob; CANGCON = 0x01; // reset the CAN controller CANGCON = 0x00; // reset the general control register CANGIT = 0x00; // reset the general interrupt register CANSIT2 = 0x00; // reset the status interrupt registers CANSIT1 = 0x00; //Enable CAN interrupts globally, set enable all interrupts except CANtimer overrun interrupt CANGIE = 0xFE; //(1<>8); CANIDT2 = (unsigned char) (msg.id>>16); CANIDT1 = (unsigned char) (msg.id>>24); //put data in mailbox for (i=0; i<8; i++) CANMSG = msg.data [i]; //wait until transmit possible (TXBSY==0) //while (CANGSTA & (1<