Hi Merlin,
ich bekomme einen Compilererror bei einem kleinen Programm, wenn ich im Programm das ungenutzte DACarray ausklammere ?
I get a compiler error with a small program if I exclude the unused DACarray in the program?
golf
program Tiny412_1;
{$NOSHADOW}
{ $WG} {global Warnings off}
Device = Tiny412, VCC=3.3;
{
Define_Fuses
// Override_Fuses;
NoteBook = A;
COMport = USB;
LockBits0 = [];
FuseBits0 = [];
FuseBits1 = [];
FuseBits2 = [];
}
Import Serport; //, I2Cport; //, ; // SysTick,
From System Import LongWord;
Define
//OSCType = OSC16M; // Interner 16MHz-Takt
OSCType = OSC20M; // Interner 20MHz-Takt
//OSCType = OSCULP32K; // Interner Ultra-Low-Power 32K-Takt
//OSCType = XOSC32K; // Externer 32K-Takt
//OSCType = EXTCLK, nnnnnnnnn; //Externer Taktgeber mit angegebener Frequenz
//SysTick = 10; {msec}
StackSize = $0010, iData;
FrameSize = $0020, iData;
SerPort = 115200, Stop1; // an PC oder an GPS-Normal Platine, je nach bestückten Widerständen
TxBuffer = 64, iData;
RxBuffer = 16, iData;
Implementation
// const
{$EEPROM}
var
structconst
Version: string[3] = '1.0';
{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type
{--------------------------------------------------------------}
{ Const Declarations }
const
CRC_Polynom: longword = $00016F63;
DACArray: array [0..1] of word = ( (2173),(2295) ); // ohne Array Compilerfehler !
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
ch: char;
w:word;
b2:byte;
bool:boolean;
SSCL1[@PortA,3] : bit; //
SSDA1[@PortA,6] : bit; // benutzt beim bitbang für Änderung der I2C-adresse des MCP4728 und für den NCD2400_I
SI2C1ack[@PinA,7] : bit; //
SoftI2C1_Ack:boolean;
{
NCD2400Iwert :word;
NCD2400Qwert :word;
NCD2400wert :word;
}
{--------------------------------------------------------------}
{ functions }
//-------------------------------------------------------------------------------------------------------------------------------------------
{
procedure SoftI2C1start;
begin
SSCL1:= true; udelay_1(5); //SSCL1[@PortC,0]: bit;
SSDA1:= false; udelay_1(5); //SSDA1[@PortC,1]: bit;
end;
//---------------------------------------------------------------------------------------------------------------
procedure SoftI2C1writebyte(data: byte);
var
bitz: byte;
begin
bitz:=7; // 8 relevante Bits werden gesendet
repeat
SSCL1:= false; udelay_1(3); //
SSDA1:= bit(data,(bitz)); udelay_1(5);
SSCL1:= true; udelay_1(5);
dec (bitz);
until bitz=255;
// (ACK Phase)
SSCL1:= false; udelay_1(3); //
SSDA1:= true; udelay_1(5);
SSCL1:= true; udelay_1(5); //
SoftI2C1_Ack:= SI2C1ack; //SI2C1ack[@PinC,1]: bit;
SSCL1:= false; udelay_1(5); //
end;
//--------------------------------------------------------------------------------------------------------
procedure SoftI2C1stop;
begin
SSDA1:= false; udelay_1(5); //SoftI2CStop()
SSCL1:= true; udelay_1(3); //SoftI2CStop()
SSDA1:= true; udelay_1(5); //SoftI2CStop()
end;
//---------------------------------------------------------------------------------------------------------------------
procedure NCD2400IsetWert; // über eigene Softi2C 1. $C0, 2. config1= $0xxxxxxbit8, 3. config2 = bits 7..0 write volatile register
begin
SoftI2C1start;
SoftI2C1writebyte($C0); //(I2CAdrNCD2400_I); // $C0 shr 1 = $60 , $60 gilt nur beim avrco-treiber !!!!!!!!
SoftI2C1writebyte(hi(NCD2400Iwert)); // nur bit 0 ist dabei genutzt , max wert ist 511
SoftI2C1writebyte(lo(NCD2400Iwert)); //
SoftI2C1stop;
end;
}
{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
begin
DDRA:= %11011000; //
EnableInts;
SSCL1:= true;
SSDA1:= true;
loop
endloop;
end Tiny412_1.
ich bekomme einen Compilererror bei einem kleinen Programm, wenn ich im Programm das ungenutzte DACarray ausklammere ?
I get a compiler error with a small program if I exclude the unused DACarray in the program?
golf
program Tiny412_1;
{$NOSHADOW}
{ $WG} {global Warnings off}
Device = Tiny412, VCC=3.3;
{
Define_Fuses
// Override_Fuses;
NoteBook = A;
COMport = USB;
LockBits0 = [];
FuseBits0 = [];
FuseBits1 = [];
FuseBits2 = [];
}
Import Serport; //, I2Cport; //, ; // SysTick,
From System Import LongWord;
Define
//OSCType = OSC16M; // Interner 16MHz-Takt
OSCType = OSC20M; // Interner 20MHz-Takt
//OSCType = OSCULP32K; // Interner Ultra-Low-Power 32K-Takt
//OSCType = XOSC32K; // Externer 32K-Takt
//OSCType = EXTCLK, nnnnnnnnn; //Externer Taktgeber mit angegebener Frequenz
//SysTick = 10; {msec}
StackSize = $0010, iData;
FrameSize = $0020, iData;
SerPort = 115200, Stop1; // an PC oder an GPS-Normal Platine, je nach bestückten Widerständen
TxBuffer = 64, iData;
RxBuffer = 16, iData;
Implementation
// const
{$EEPROM}
var
structconst
Version: string[3] = '1.0';
{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type
{--------------------------------------------------------------}
{ Const Declarations }
const
CRC_Polynom: longword = $00016F63;
DACArray: array [0..1] of word = ( (2173),(2295) ); // ohne Array Compilerfehler !
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
ch: char;
w:word;
b2:byte;
bool:boolean;
SSCL1[@PortA,3] : bit; //
SSDA1[@PortA,6] : bit; // benutzt beim bitbang für Änderung der I2C-adresse des MCP4728 und für den NCD2400_I
SI2C1ack[@PinA,7] : bit; //
SoftI2C1_Ack:boolean;
{
NCD2400Iwert :word;
NCD2400Qwert :word;
NCD2400wert :word;
}
{--------------------------------------------------------------}
{ functions }
//-------------------------------------------------------------------------------------------------------------------------------------------
{
procedure SoftI2C1start;
begin
SSCL1:= true; udelay_1(5); //SSCL1[@PortC,0]: bit;
SSDA1:= false; udelay_1(5); //SSDA1[@PortC,1]: bit;
end;
//---------------------------------------------------------------------------------------------------------------
procedure SoftI2C1writebyte(data: byte);
var
bitz: byte;
begin
bitz:=7; // 8 relevante Bits werden gesendet
repeat
SSCL1:= false; udelay_1(3); //
SSDA1:= bit(data,(bitz)); udelay_1(5);
SSCL1:= true; udelay_1(5);
dec (bitz);
until bitz=255;
// (ACK Phase)
SSCL1:= false; udelay_1(3); //
SSDA1:= true; udelay_1(5);
SSCL1:= true; udelay_1(5); //
SoftI2C1_Ack:= SI2C1ack; //SI2C1ack[@PinC,1]: bit;
SSCL1:= false; udelay_1(5); //
end;
//--------------------------------------------------------------------------------------------------------
procedure SoftI2C1stop;
begin
SSDA1:= false; udelay_1(5); //SoftI2CStop()
SSCL1:= true; udelay_1(3); //SoftI2CStop()
SSDA1:= true; udelay_1(5); //SoftI2CStop()
end;
//---------------------------------------------------------------------------------------------------------------------
procedure NCD2400IsetWert; // über eigene Softi2C 1. $C0, 2. config1= $0xxxxxxbit8, 3. config2 = bits 7..0 write volatile register
begin
SoftI2C1start;
SoftI2C1writebyte($C0); //(I2CAdrNCD2400_I); // $C0 shr 1 = $60 , $60 gilt nur beim avrco-treiber !!!!!!!!
SoftI2C1writebyte(hi(NCD2400Iwert)); // nur bit 0 ist dabei genutzt , max wert ist 511
SoftI2C1writebyte(lo(NCD2400Iwert)); //
SoftI2C1stop;
end;
}
{--------------------------------------------------------------}
{ Main Program }
{$IDATA}
begin
DDRA:= %11011000; //
EnableInts;
SSCL1:= true;
SSDA1:= true;
loop
endloop;
end Tiny412_1.