Home  >  Support  >  Support Forum  >  I get this error while executing the following code.
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

I get this error while executing the following code.

0 votes
Can anyone please check this issue.line 28 : ERROR PARALLEL 1.C : SPD0RShadow is out of scope/ not declared.



#class auto
#define DINBUFSIZE 31
#define DOUTBUFSIZE 31
#define Esc 27
#define D_BAUDRATE 600L
#use "slave_port.lib"
#memmap xmem

.
#define MSSG_TMOUT 0000UL
// will discontinue collecting data 0 seconds after
// receiving any character or when maxSize are read.

// This timeout period determines when to give up waiting for any data to
// arrive and must be implemented within the user's program, as it is below.
#define IDLE_TMOUT 9000UL
// will timeout after 9`` seconds if no data is read.

/**
* Using serXread(), the program can accept binary data, not just text.
* This structure represents a 16-bit integer followed by twenty 32-bit
* floating point values. Of course, them floats better be IEEE-754
* format values!
*/



typedef struct
{
short d;
float f[20];
} DATA;
// serDread and serDwrite read and write bytes of any data type


void main()
{

char value;
char REG;
int i,n,maxSize;
unsigned long t;
DATA data;
char s[32];
// For status messages.

n = 0;
maxSize = sizeof(DATA); // 82 bytes
serDopen(600);
t = MS_TIMER;
//Initializing the port as slave port by assigning below value in SPCR
WrPortI(SPCR,&SPCRShadow,0x088);
while ((n != 1) || ((char)data.d != Esc)) {
// until 'Esc'
// 82 bytes max, up to 3 sec between chars before timing out

if ((n = serDread(&data, maxSize, MSSG_TMOUT)) > 0)
{

printf("\n Received data is %c \n",data.d);
REG=data.d;
printf("value in REG is %c\n",REG);
BitWrPortI(SPD0R,&SPD0RShadow,REG);
value=RdPortI(SPD0R);
printf("value in SPD0R is %c\n",value);
serDwrite(&data,n);
t = MS_TIMER;
// start anew for next message
}
else
{
if (MS_TIMER - t > IDLE_TMOUT)
{
serDputs(" Timed out! ");
t = MS_TIMER;
// start anew for next message
}
}
}
serDputs(" Done");
while (serDwrFree() != DOUTBUFSIZE) ;
// Complete tx before closing
serDclose();

}
asked Jul 2 in Rabbit Software by AISWARYA RAJ New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
Hello,

This error is telling you that SPD0RShadow has not been defined anywhere. There is no shadow register defined for the SPD0R register. Use NULL instead for that parameter.
answered Jul 7 by trooper2 Veteran of the Digi Community (320 points)
Contact a Digi expert and get started today! CONTACT US
...