0
\$\begingroup\$

Error:

../Src/main.c(107): error: #253: expected a ","

code part:

uint8_t maskPWR_MGMT_2[2] = {0x6c, 0b00000111};//6c
\$\endgroup\$
8
  • 2
    \$\begingroup\$ Don't want to be rude, but this is electronics forum. Also your problem is before this line, there's nothing wrong with this line. Please post the entire code so we can help you properly. \$\endgroup\$
    – andrew
    May 7, 2021 at 11:28
  • 1
    \$\begingroup\$ The 0b prefix might not be supported by this particular compiler or it is configured to disable support for it. They are usually non-standard extensions and became standard around C++14. \$\endgroup\$
    – Justme
    May 7, 2021 at 11:37
  • \$\begingroup\$ @Justme this is embedded C... \$\endgroup\$
    – andrew
    May 7, 2021 at 11:40
  • \$\begingroup\$ @Justme you are right. i just removed 0b ,and error gone ,Thanks ../Src/main.c(97): warning: #177-D: variable "maskPWR_MGMT_1" was declared but never referenced uint8_t maskPWR_MGMT_2[2] = {0x6b, 00000001}; //6b \$\endgroup\$
    – Vivek pkd
    May 7, 2021 at 11:44
  • 2
    \$\begingroup\$ @ScottSeidman Yes gcc would, but Keil comes with armcc. \$\endgroup\$
    – Justme
    May 13, 2021 at 9:02

1 Answer 1

6
\$\begingroup\$

Compiler does not seem to support 0b prefix for entering numbers in binary. You need to convert it to something else, like hex or decimal.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.