Hallo,
ich habe versucht den MIRF Treiber zu implementieren, aber ohne erfolg. Selbst das Demo läßt sich nicht Copilieren. Wo liegt der Fehler ? (interner assebler error 4087)
ich habe versucht den MIRF Treiber zu implementieren, aber ohne erfolg. Selbst das Demo läßt sich nicht Copilieren. Wo liegt der Fehler ? (interner assebler error 4087)
Code
program Test;
{$NOSHADOW}
{ $W+ Warnings} {Warnings off}
Device = Mega128, VCC = 5;
Define_Fuses
Override_Fuses;
// NoteBook = C;
COMport = USB;
// Supply = 5.0, 200;
FuseBits0 = [SUT0, BODEN];
FuseBits1 = [CKOPT, JTAGEN, SPIEN, OCDEN];
FuseBits2 = [];
ProgMode = JTAG;
Import SysTick, MIRF24port, BeepPort, SysLEDblink;
From System Import ;
From SysLEDblink Import FlashOnce;
Define
ProcClock = 16000000; {Hertz}
SysTick = 10; {msec}
StackSize = $0040, iData;
FrameSize = $0040, iData;
BeepPort = PortG, 4;
SysLEDblink = mSec40;
SysLEDblink0 = PortC, 7, low;
// MIRF24port = SPI_Soft, PortA, 2, 3, 4, 1, 0, 5;
// SCK, MOSI, MISO, SS, CE, IRQ
MIRF24port = SPI, PortA, 0, 1, 2; // standard SPI port
// SS, CE, IRQ
// MIRF24port = MSPI_2, PortA, 0, 1, 2; // MSPI_0..MSPI_3
// SS, CE, IRQ
uses uMIRF24;
Implementation
{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type
const
LED1 : byte = 0;
{$IDATA}
var
txBuff : array[0..31] of byte;
txString[@txBuff] : string[30];
rxBuff : array[0..31] of byte;
rxCnt : byte;
rxString[@rxBuff] : string[30];
idx : byte;
begin
PORTC:= PORTC or $80; // LED off
DDRC:= DDRC or $81; // enable LED pin
EnableInts;
mrfSetChan(mrfChan9, false);
mrfSetPower(mrfdBm0);
mrfSetLocalAddr(0);
mrfSetRetryMax(10);
mrfSetRetryTimeOut(4); // 5x 250usec -> 1.25msec
mrfSetRFspeed(mrfRF2000);
if mrfInit then
BeepStepLH;
idx:= 0;
loop
txString:= 'Hello MIRF24 Broadcast';
PortC.0:= true;
if mrfTxPacket(2, @txBuff, 24, true) then
PortC.0:= false;
SysLEDflashOnce(LED1);
mDelay(100); // wait for the slave beep!
else
BeepSiren(1, 1);
mDelay(1000);
endif;
PortC.0:= false;
txString:= 'Hello MIRF24 Data ' +ByteToStr(idx);
PortC.0:= true;
if mrfTxPacket(2, @txBuff, 30, false) then
PortC.0:= false;
SysLEDflashOnce(LED1);
mDelay(100); // wait for the slave beep!
else
BeepSiren(1, 1);
mDelay(1000);
endif;
PortC.0:= false;
inc(idx);
endloop;
else
BeepSiren(1, 2);
endif;
end.
{$NOSHADOW}
{ $W+ Warnings} {Warnings off}
Device = Mega128, VCC = 5;
Define_Fuses
Override_Fuses;
// NoteBook = C;
COMport = USB;
// Supply = 5.0, 200;
FuseBits0 = [SUT0, BODEN];
FuseBits1 = [CKOPT, JTAGEN, SPIEN, OCDEN];
FuseBits2 = [];
ProgMode = JTAG;
Import SysTick, MIRF24port, BeepPort, SysLEDblink;
From System Import ;
From SysLEDblink Import FlashOnce;
Define
ProcClock = 16000000; {Hertz}
SysTick = 10; {msec}
StackSize = $0040, iData;
FrameSize = $0040, iData;
BeepPort = PortG, 4;
SysLEDblink = mSec40;
SysLEDblink0 = PortC, 7, low;
// MIRF24port = SPI_Soft, PortA, 2, 3, 4, 1, 0, 5;
// SCK, MOSI, MISO, SS, CE, IRQ
MIRF24port = SPI, PortA, 0, 1, 2; // standard SPI port
// SS, CE, IRQ
// MIRF24port = MSPI_2, PortA, 0, 1, 2; // MSPI_0..MSPI_3
// SS, CE, IRQ
uses uMIRF24;
Implementation
{$IDATA}
{--------------------------------------------------------------}
{ Type Declarations }
type
const
LED1 : byte = 0;
{$IDATA}
var
txBuff : array[0..31] of byte;
txString[@txBuff] : string[30];
rxBuff : array[0..31] of byte;
rxCnt : byte;
rxString[@rxBuff] : string[30];
idx : byte;
begin
PORTC:= PORTC or $80; // LED off
DDRC:= DDRC or $81; // enable LED pin
EnableInts;
mrfSetChan(mrfChan9, false);
mrfSetPower(mrfdBm0);
mrfSetLocalAddr(0);
mrfSetRetryMax(10);
mrfSetRetryTimeOut(4); // 5x 250usec -> 1.25msec
mrfSetRFspeed(mrfRF2000);
if mrfInit then
BeepStepLH;
idx:= 0;
loop
txString:= 'Hello MIRF24 Broadcast';
PortC.0:= true;
if mrfTxPacket(2, @txBuff, 24, true) then
PortC.0:= false;
SysLEDflashOnce(LED1);
mDelay(100); // wait for the slave beep!
else
BeepSiren(1, 1);
mDelay(1000);
endif;
PortC.0:= false;
txString:= 'Hello MIRF24 Data ' +ByteToStr(idx);
PortC.0:= true;
if mrfTxPacket(2, @txBuff, 30, false) then
PortC.0:= false;
SysLEDflashOnce(LED1);
mDelay(100); // wait for the slave beep!
else
BeepSiren(1, 1);
mDelay(1000);
endif;
PortC.0:= false;
inc(idx);
endloop;
else
BeepSiren(1, 2);
endif;
end.