View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9081 Location: Greensville,Ontario
|
|
Posted: Wed Oct 18, 2017 2:28 pm |
|
|
Try looking up 'bit_set()' in the manual. If you press F11 while your project is open, the CCS manual 'magically' comes alive !! I usually keep it open as I can make quick reference to it. I'm lousy at C syntax being an 'assembler guy' for 40 years... |
|
|
jacktaylor
Joined: 02 Sep 2017 Posts: 75
|
Thank you Ttemtronic |
Posted: Thu Oct 19, 2017 10:42 am |
|
|
OK thank you. Actually the synthesis confuses because there are many commands.
So in the instruction
char bitest1 = 0x00;
if (! input (plus)) bit_set (control1,2);
We are setting 1 in bit 2 of the control variable, when ! Input (plus)
As I verify in the expression if (! Input (adj_watch)) && control1.2 == 1) that the bit2 of the variable control, really is in 1?
I know that the expression control1.2 == 1 is wrong.
I then used the expression:
if (! input (adj_watch)) && bit_test (control, 0)
but when compiling the error is generated: "A numeric expression must appear here".
using the expression:
if (! input (adj_watch)) & bit_test (control, 0)
The following error is generated when compiling the error: "Variable not permited here" |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19195
|
|
Posted: Thu Oct 19, 2017 11:47 am |
|
|
There are problems with your brackets.
if (! input (adj_watch)) This is the end of the if statement as posted.....
& bit_test (control, 0 This bit is trying to execute a separate operation as a result of the 'if', with only one value fed into a mathematical operation requiring two values....
Hence the errors.
if ((! input (adj_watch)) && bit_test (control, 0))
Compiles without errors. |
|
|
jacktaylor
Joined: 02 Sep 2017 Posts: 75
|
Thank you Ttemtronic |
Posted: Thu Oct 19, 2017 9:16 pm |
|
|
Again I am very grateful for your help and explanation Ttelmah. Thank you.
|
|
|
|