EmbeddedRelated.com
Forums

IAR Simulator Macro Error - help requested please!

Started by dippitydo2000 August 23, 2006
Hello,
I am using IAR EW V3.30 and am trying to simulate random Port1
interrupts. I am using
a copy of SetupAdvanced.mac, with modifications, from the IDE
tutorial folder.
The simulated interrupt is setup in the IDE for now.

I am getting the following error when setPORT1Bits() executes after
the simulated interrupt triggers:
Tue Aug 22 09:36:54 2006: Error in C:{removed}
\Debug\Exe\SetupSimple.mac at line 120, col 22: Type mismatch.

line 120 is the following line in the code:
if( 0 == __readFile( _Port1FileHandle, &_P1Value ) )

Basically, I cannot read from a file. The file does exist in the
specified directory.
I also tried to write to a file using __fmessage and __writeFile
(for kicks) and got the same error.

Any ideas?
Thanks,
Rose

Here is my macro code:

//==================================================// Macro file to simulate Port1 interrupt
//
//
//
//
//==================================================
__var _Port1FileHandle;
execUserSetup()
{
__message "execUserSetup() called\n";

// Call the simulation setup
SimulationSetup ();
}

SimulationSetup()
{
// Open the text file for ASCII writing
// Put in the appropriate path to the OutputData.txt file
_Port1FileHandle = __openFile( "Debug\\Exe\\InputData.txt", "r" );
if( !_Port1FileHandle )
{
__message "could not open file" ;
}

}
setPORT1Bits()
{
__var _P1Value;

if( 0 == __readFile( _Port1FileHandle, &_P1Value ) )
{
P1IN = _P1Value;
}
else
{
__message "error reading value from file";
}

__message "P1IN = 0x", _P1Value:%X,"\n";
}

execUserReset()
{
__message "execUserReset() called\n";

}

execUserExit()
{
__message "execUserExit() called\n";

// Call the Simulation shutdown
SimulationShutdown();
}

SimulationShutdown()
{

__closeFile( _Port1FileHandle );
}

Beginning Microcontrollers with the MSP430

Upgraded my 430 EW to v3.41 and tried making and running the
tutorial Project 4 which tries to read from a file. Same
error. ?????

--- In m..., "dippitydo2000"
wrote:
>
> Hello,
> I am using IAR EW V3.30 and am trying to simulate random Port1
> interrupts. I am using
> a copy of SetupAdvanced.mac, with modifications, from the IDE
> tutorial folder.
> The simulated interrupt is setup in the IDE for now.
>
> I am getting the following error when setPORT1Bits() executes
after
> the simulated interrupt triggers:
> Tue Aug 22 09:36:54 2006: Error in C:{removed}
> \Debug\Exe\SetupSimple.mac at line 120, col 22: Type mismatch.
>
> line 120 is the following line in the code:
> if( 0 == __readFile( _Port1FileHandle, &_P1Value ) )
>
> Basically, I cannot read from a file. The file does exist in the
> specified directory.
> I also tried to write to a file using __fmessage and __writeFile
> (for kicks) and got the same error.
>
> Any ideas?
> Thanks,
> Rose
>
> Here is my macro code:
>
> //==================================================> // Macro file to simulate Port1 interrupt
> //
> //
> //
> //
> //==================================================>
> __var _Port1FileHandle;
> execUserSetup()
> {
> __message "execUserSetup() called\n";
>
> // Call the simulation setup
> SimulationSetup ();
> }
>
> SimulationSetup()
> {
> // Open the text file for ASCII writing
> // Put in the appropriate path to the OutputData.txt file
> _Port1FileHandle = __openFile
( "Debug\\Exe\\InputData.txt", "r" );
> if( !_Port1FileHandle )
> {
> __message "could not open file" ;
> }
>
> }
> setPORT1Bits()
> {
> __var _P1Value;
>
> if( 0 == __readFile( _Port1FileHandle, &_P1Value ) )
> {
> P1IN = _P1Value;
> }
> else
> {
> __message "error reading value from file";
> }
>
> __message "P1IN = 0x", _P1Value:%X,"\n";
> }
>
> execUserReset()
> {
> __message "execUserReset() called\n";
>
> }
>
> execUserExit()
> {
> __message "execUserExit() called\n";
>
> // Call the Simulation shutdown
> SimulationShutdown();
> }
>
> SimulationShutdown()
> {
>
> __closeFile( _Port1FileHandle );
> }
>