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("
Received data is %c
",data.d);
REG=data.d;
printf("value in REG is %c
",REG);
BitWrPortI(SPD0R,&SPD0RShadow,REG);
value=RdPortI(SPD0R);
printf(“value in SPD0R is %c
“,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();
}