mega32M1 and CAN

Jest
 
Avatar
 
Subject:

mega32M1 and CAN

 · 
Posted: 21.02.2015 - 15:25  ·  #1
Hello,

for testing purposes I copied code form AVR CAN128M to my file with M1 uC definition. Trying to compile empty program, just definitions and initialization returns error. Is it CAN128/M1 problem?

Code:
Code
program Detel_CNC;

{$NOSHADOW}
{ $WG}                     {global Warnings off}

Device = mega32m1, VCC=5;
{ $BOOTRST $03800}         {Reset Jump to $03800}

Import SysTick, CAN_AVR;

From System Import Pipes, LongWord;

Define
  ProcClock      = 16000000;       {Hertz}
  SysTick        = 10;             {msec}
  StackSize      = $0064, iData;
  FrameSize      = $0064, iData;
  CAN_AVR        = 16, 16, iData; // RxPipe, TxPipe
  CAN_AVRbaud    = CAN_Baud125;

uses UCAN_AVR;    //Using the Driver

Implementation
{$IDATA}
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
  w             : word;
  b, i          : byte;
  msgRecv       : tCANMessage;
  msgTx         : tCANMessage;
{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
begin
  EnableInts;
  AVR_CAN_Init(14);
  AVR_CAN_Enable;
  AVR_CAN_SetRxMask(1, $01, $FFFF);      // only ID $0001 into MOB 1
  AVR_CAN_SetRxMask(2, $02, $FFFF);      // only ID $0002 into MOB 2
  AVR_CAN_SetRxMask(3, $04, $FFFF);      // only ID $0004 into MOB 3
  AVR_CAN_SetRxMask(4, $08, $FFFF);      // only ID $0004 into MOB 4
  AVR_CAN_SetRxMask(5, $10, $FFFF);      // only ID $0010 into MOB 5
  AVR_CAN_SetRxMask(6, $20, $FFFF);      // only ID $0020 into MOB 6
  AVR_CAN_SetRxMask(7, $40, $FFFF);      // only ID $0040 into MOB 7
  AVR_CAN_SetRxMask(8, $80, $FFFF);      // only ID $0080 into MOB 8
  loop

  endloop;
end Detel_CNC.


Best regards,
Andrej
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 13   36   49 · Page-Gen-Time: 0.02358s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI