SerOutSLIPD0 -> var or Symbol expected

  • 1
  • 2
  • Page 1 of 2
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 21.06.2020 - 10:48  ·  #1
Ich versuche auf einem Xmega256A3U über den Serport D0 den Befehl
SerOutSLIPD0(@Command, Sizeof(Command));
zu verwenden, bekomme aber einen Compilerfehler.
(var or Symbol expected)


Ich habe folgendes definiert:

Code

Device = xmega256a3U, VCC = 3.3;
Import SysTick, ADC_A, SerportD0, BeepPort, crcstream;

Define
  OSCtype     = int32MHz,
                   PLLmul = 7,
                   prescB = 1,
                   prescC = 1,
                   overdrive;

  SysTick        = 10;             {msec}
  StackSize     = $0840, iData;
  FrameSize    = $0440, iData;

  SerPortD0      = 9600, Stop1, timeout;    {Baud, StopBits|Parity}
  TxBufferD0    = 49, iData;
  RxBufferD0    = 49, iData;



Anmerkung: Auf einem ATMega128 lief das problemlos über Serport1

Was mache ich falsch?
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 21.06.2020 - 13:44  ·  #2
Hallo
wie ist das command definiert ??
rolf
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 21.06.2020 - 17:02  ·  #3
type
COMMANDTYPE = Record
Com : Char;
Adr1, Adr2 : Byte;
Data : word;
CRC : word;
end;

var
Command: Commandtype;

Wie gesagt, auf einem ATMega läuft es problemlos.
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 22.06.2020 - 15:54  ·  #4
Für mich sieht das so aus als würde er die Function an sich nicht als gültig anerkennen.
ich komme da leider nicht weiter, muss eine ältere Software von Atmega auf Xmega umsetzen.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 22.06.2020 - 16:24  ·  #5
Er meckert das @Name an.
Wie weiter oben steht brauche ich ein ganz
Kleines Testprogramm das den Fehler zeigt.
Irgendwelche schnippsel helfen nicht weiter !
rolf
Lschreyer
Schreiberling
Avatar
Gender: n/a
Posts: 526
Registered: 02 / 2007
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 23.06.2020 - 06:18  ·  #6
Wenn es weiter hilft..
Es liegt nicht an den Parametern, der Compiler lehnt den Befehl SeroutSlipD0 (und auch C0, C1, D1 usw.) ab.
Wie gesagt, auf Atmega128 läuft es auf Xmega nicht.


Code

program test;

Device = xmega256a3U, VCC = 3.3;


define_fuses
  Override_Fuses;
  NoteBook   = A;
  Supply     = 3.3, 300;
  COMport    = USB;
  Progmode   = PDI;
  Fusebits5  = [BODACT1, EESAVE, BODLEVEL1, BODLEVEL0];

Import SysTick, SerportD0, BeepPort;

From System Import Float;


Define
  OSCtype        = int32MHz,
                   PLLmul = 4,
                   prescB = 1,
                   prescC = 1;

  SysTick        = 10;             {msec}
  StackSize      = $0840, iData;
  FrameSize      = $0440, iData;

  SerPortD0      = 9600, Stop1, timeout;    {Baud, StopBits|Parity}
  TxBufferD0     = 49, iData;
  RxBufferD0     = 49, iData;

  BeepPort       = PortR, 0;


Implementation

{$IDATA}


type
  COMMANDTYPE    = Record
                     Com            : Char;  //Command
                     Adr1, Adr2     : Byte;  // Adress
                     Data           : word;  // DAta
                     CRC            : word;
                   end;

Var Command: Commandtype;


function SendCommand(FCOM: char; Fadr: byte; Fdata: word): boolean;
var
  Xcrc: word;
  c   : char;
  Command: Commandtype;
begin
  Command.com:=  FCOM;
  Command.adr1:= Fadr;
  Command.adr2:= 50;
  Command.data:= Fdata;

  SerOutSlipD0(@Command, Sizeof(Command));
  return(true);
end;


begin
  Enableints($87);
  loop
     Sendcommand('C', 255, 0);
  endloop;
end Test.
Harry
Moderator
Avatar
Gender:
Location: zwischen Augsburg und Ulm
Age: 59
Posts: 2077
Registered: 03 / 2003
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 23.06.2020 - 15:20  ·  #7
Kannst du mal ein Hardcopy vom PED32 mit dem Fehler posten?

Code

Var
  txptr : Pointer;

txptr:=@Command;
SeroutslipD0(txptr, Sizeof(Command));

mal probiert? Evtl. sogar das Sizeof vorher berechnen.

Ja ich kenne die Fehlermeldung, aber die hatte ich schon aus verschiedensten Gründen.

Harry
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: SerOutSLIPD0 -> var or Symbol expected

 · 
Posted: 23.06.2020 - 19:45  ·  #8
Hallo Louis,

ich empfehle mal wieder das AVRco Manual zu lesen.
Fur den XMega hat sich da einiges getan !!!!!!!!!
Code

program XMega_SLIP;

Device = XMega128A1, VCC=3.3;
{ $BOOTRST $20000}         {Reset Jump to $20000}

Import SysTick, BeepPort, SLIPportC0, SLIPportC1, SLIPportD0, SLIPportD1;

From System Import ;

Define
  // The XMegas don't provide any Oscillator fuses.
  // So the application must setup the desired values
  // possible OSC types: extXTAL, extClock, ext32kHz, int32Khz, int2MHz, int32MHz

  //>> CPU=32MHz, PeripherX4=32MHz, PeripherX2=32MHz
  OSCtype        = int32MHz, PLLmul=4, prescB=1, prescC=1;
  SysTick        = 10;             {msec}
  StackSize      = $0032, iData;
  FrameSize      = $0064, iData;
  
  BeepPort       = PortA, 0;

  SLIPportC0      = 19200;
  SLIPportCtrlC0  = PortA, 0, positive;    // optional RS485 driver control
  SLIPportC1      = 19200;
  SLIPportCtrlC1  = PortA, 1, positive;    // optional RS485 driver control

  SLIPportD0      = 19200, Master;         // onBoard local network
  SLIPportD1      = 19200, Slave;          // onBoard local network

Implementation

{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type

{--------------------------------------------------------------}
{ Const Declarations }
const

{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
  RxBuff         : array[0..31] of byte;
  TxBuff         : array[0..31] of byte;
  TxResultC0     : tSLIPstate;
  RxResultC1     : tSLIPstate;
  bc             : boolean;            // used to switch to broadcast

{--------------------------------------------------------------}
{ functions }

{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
begin
  // fill the Tx buffer with some data
  TxBuff[0]:= $10;
  TxBuff[1]:= $C0;
  TxBuff[2]:= $11;
  TxBuff[3]:= $DC;
  TxBuff[4]:= $12;
  TxBuff[5]:= $DB;
  TxBuff[6]:= $13;
  TxBuff[7]:= $DD;
  TxBuff[8]:= $14;

  SLIPsetTxAddrC0(01);                 // for the address mode
  SLIPsetRxAddrC1(01);

  SLIPsetModeC0([slpAddr, slpHsk, slpChkS]);    // combine several modes
  SLIPsetModeC1([slpAddr, slpHsk, slpChkS]);
  SLIPsetTimeOutC0(10);                         // timeout used for handshake
  SLIPsetTimeOutC1(10);                         // and frame failures

  SLIPsetRxBufferC1(@RxBuff, sizeOf(RxBuff));
  SLIPsetTxBufferC0(@TxBuff, 9);
  
  // enable receive on portC1
  SLIPresumeRxC1;
  EnableInts($87);
  loop
    // here we switch between broadcast and unique address
    if bc then
      SLIPsetTxAddrC0($FF);
    else
      SLIPsetTxAddrC0(01);
    endif;
//    bc:= not(bc);

    repeat
    until SLIPstartTxC0;
    // transmit a frame
    repeat
      TxResultC0:= SLIPgetTxStateC0;
    until TxResultC0 <> SLIPbusy;
    if TxResultC0 <> SLIPready then
      BeepOut(800, 10);
    endif;

    // receive a frame
    repeat
      RxResultC1:= SLIPgetRxStateC1;
    until RxResultC1 <> SLIPbusy;
    // process the received data or the error
    // ....
    // ....
    if RxResultC1 = SLIPready then
      if SLIPwasBC_C1 then
        BeepOut(800, 2);
      else
        BeepClick;
      endif;
    else
      BeepOut(800, 10);
    endif;
    repeat
    until SLIPresumeRxC1;
  endloop;
end XMega_SLIP.



rolf
  • 1
  • 2
  • Page 1 of 2
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: 14 · Cache Hits: 14   140   154 · Page-Gen-Time: 0.023041s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI