Code: Select all
typedef struct {
prescaler : 2;
timeronoff : 1;
postscaler : 4;} mybitfield;
// Declare a bit field TimerControl:
mybitfield TimerControl;
void main() {
TimerControl.prescaler = 0;
TimerControl.timeronoff = 1;
TimerControl.postscaler = 3;
T2CON = TimerControl;
}
The error message encounter:
Cannot assign[TimerControl] to [T2CON]
The above code i get it from the help file in mikroC(struct)
Please kindly advise what went wrong with the above code.