I have the following code which is supposed to control the LCD segments for an 7 segment digit. I copied the define statements from an assembly sample file, and I figured this would be okay in C:
#define s1a LCDDATA2,6 //define segments for digit 1
#define s1b LCDDATA2,7
#define s1c LCDDATA8,7
#define s1d LCDDATA11,6
#define s1e LCDDATA8,6
#define s1f LCDDATA5,6
#define s1g LCDDATA5,7
The compiler is fine with that. It complains when I try to do things with it:
void LCDseg_digit1(short unsigned int state)
{
switch(state)
{
case 0:
s1a=1;
s1b=1;
s1c=1;
s1d=1;
s1e=1;
s1f=1;
s1g=0;
break;
default:
s1a=0;
s1b=0;
s1c=0;
s1d=0;
s1e=0;
s1f=0;
s1g=0;
break;
}
}
With this function you input a number between 0 and 9, and it controls the segments accordingly. I cut out the stuff in the middle.
I then get this error spewed at me for every like where I try to set a register:
only lvalues may be assigned to or modified
I tried searching around, but I don't understand why this isn't allowed. Could someone enlighten me?