Search code examples
cmsp430iar

although i declare 2 variables and pass 2 variables i get too few arguments in function call error


I am beginner with c. I declare 2 variables and pass 2 variables. So, I didn't understand, why this error occurs. Also when i remove "0b" from error line code is working

Regards. Here is my main code and function

Message:Error[Pe165]: too few arguments in function call

void transmit(unsigned long data_word, unsigned char number_of_bits); 
//i added this before i call the function
int main(void) {
  WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

  init();

  while (1) {
    if ((P2IN & BTN1) == 0) //when button pressed 
    {
      unsigned int j;
      for (j = 0; j < 2; j++) {
        transmit(0b010000100100011, 15); // ERROR OCCURS IN HERE
        delay_ms(40);
      }
      while ((P2IN & BTN1) == 0);
    }
  }
}
// sending out bits, one by one, LSB first, maximum 16 bits (1 word)
void transmit(unsigned long data_word, unsigned char number_of_bits) 
{
  unsigned char i;
  unsigned int mask;
  for (i = 0; i < number_of_bits; i++) {
    mask = (1 << i);
    if ((data_word & mask) == 0) // bit '0'
    {
      transmitBit0();
    } else // bit '1'
    {
      transmitBit1();
    }
  }
}

Solution

  • C doesn't have binary literals. 0b... is not valid C. Some compilers support it as an extension but others do not.

    Use hexadecimal notation.