negative value Conversion.

Dear all,

I have two angle Desired and actual. which are negative . I am using qmodbus software to read below data from modbus slave. If value of desired i put it has + value master read data properly in +ve value. if value assigned is -ve . then it reading as in image. If that value selecting word -43 is read. How to convert it to readable format. Instead of printing 65543 how to make it print either in +ve value or in -ve value

In below code i checked if no is negative multiply by -1 else display as it is. But for -ve value displaying zero.
If it hexadecimal , I could subtract FF from value i got then add 1 to get actual no. SInce it is decimal no i dint how to do it.

#include "glob.h"
#include "rtc.h"
#include "config.h"
#include"timecalc.h"

#define ID   1

static int local_day=10;
static int local_month=4;
static int local_year=2014;
static int local_s=2;
static int local_h=13;
static int local_m=14;



int Wind_Speed=30;
int Wind_Kmph=67;
float desired_angle=-45.0;
float actual_angle=-43.0;

Modbus slave(ID, 0, 0);
boolean led;
int8_t state = 0;
unsigned long tempus;
// data array for modbus network sharing
uint16_t au16data[14];


void setup() {

  // start communication
  slave.begin( 9600 );
  rtcSetup();

  tempus = millis() + 100;
  digitalWrite(13, HIGH );
}


void loop() {
  // poll messages
  // blink led pin on each valid message
  state = slave.poll( au16data, 14);
  if (state > 4) {
    tempus = millis() + 50;
    digitalWrite(13, HIGH);
  }
  if (millis() > tempus) digitalWrite(13, LOW ); 
  calcTime();
  convertUTCtoLocal();

  au16data[0]=local_year;
  au16data[1]=local_month;
  au16data[2]=local_day;
  au16data[3]=wkDay;
  au16data[4]=local_h;
  au16data[5]=local_m;
  au16data[6]=local_s;
  au16data[7]=Wind_Speed;
  au16data[8]=Wind_Kmph;
if(desired_angle<0)
{

  au16data[9]=(int)desired_angle*-1;
  au16data[10]=(int)actual_angle*-1;
}else
{
 au16data[9]=(int)desired_angle;
  au16data[10]=(int)actual_angle;
}

  au16data[11] = slave.getInCnt();
  au16data[12] = slave.getOutCnt();
  au16data[13] = slave.getErrCnt();
}

au16data is unsigned - how can it hold a negative value?

Instead of working with negative angles, why not work with positive values? Remember, angles are in a circle, so -1° is the same as 359°, -2° is 358°, etc.

Why not simply cast your unsigned value to a signed value when you want to print it, or not use an unsigned datatype in the first place?

Intially i tried like this as majenko said, But i found angle for constant value remain same, If i connect the anlog sensor then stop @ particular position . the value being continuously changing .

  if(tracker_des_angle<0 ||tracker_actual_pos<0 )
  {
 desired_deg=360-tracker_des_angle;
actual_deg=360-tracker_actual_pos; 
  au16data[9]=desired_deg;
  au16data[10]=actual_deg;  
  }else
  {
    
  au16data[9]=tracker_des_angle;
  au16data[10]=tracker_actual_pos;
  
  }

i found angle for constant value remain same,

Isn't that what constants are supposed to do?

I have kept angle constant for testing purpose.If it work on constant value it should also work on variable value