TheArduinoGuy

Help with error code please

3 posts in this topic

I am trying to port some code over that was originally written in Code Composer Studio to Energia and I have this function:

void Send_Command_Screen(unsigned char UARTA1_TX_ARRAY[])
{
  unsigned int i;
  unsigned int len;

  len = strlen (UARTA1_TX_ARRAY);

  //Send command
  for(i=0 ; i<len ; i++)
  {

    while(!(UCA1IFG & UCTXIFG));               //Loop until the uart is ready
    UCA1TXBUF =  UARTA1_TX_ARRAY[i];
  }

  //Send three times 0xff to end the command
  for(i=0 ; i<3 ; i++)
  {
    while(!(UCA1IFG & UCTXIFG));             //Loop until the uart is ready
    UCA1TXBUF = 0xff;

  }

}

and it is throwing up this error:

sketch/Screen_Nextion.h: In function 'void Send_Command_Screen(const unsigned char*)':
Screen_Nextion.h:87: error: invalid conversion from 'const unsigned char*' to 'const char*' [-fpermissive]

Line 87 is right after the   len = strlen (UARTA1_TX_ARRAY); line

 

Can anyone please assist with why I am getting this error please? Thanks.

Share this post


Link to post
Share on other sites

Why are you forcing UARTA1_TX_ARRAY to be unsigned? Why not just a char? Then your problem will go away.

Share this post


Link to post
Share on other sites

No, idea. It wasn't my code originally. I'm sure there was a reason for it. I'll try them as a char and see if it still works. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now