Hello,

I'm trying to do a task to pass from Hex to Decimal (from uint 32 to uint8)
I have uint32 (ABCD) and I want 4 uint8 with 'A',  another 'B', another 'C'
and another 'D'.
The task I created is the following but it doesn't work, Could anyone help
me please?

//----------------------------task mascara
//TAREA mascar entero 32 a entero8
  task void mascara(){
  t1 =  call Localizar.get();
  tiempo2 = t1;
  tiempo1A = tiempo1 & 0xFF000000; /* pasamos a hexadecimal*/
  tiempo1A = tiempo1A / 0xFFFFFF;
  tiempo1 = tiempo2;
  tiempo1B = tiempo1 & 0xFF0000;
  tiempo1B = tiempo1B / 0xFF00;

  tiempo1 = tiempo2;

  tiempo1C = tiempo1 & 0xFF00;
  tiempo1C = tiempo1C / 0xFF;
  tiempo1 = tiempo2;
  tiempo1D = tiempo1 & 0xFF;

  }

//----------------------------in the task RadioSendTask I call task mascara
task void RadioSendTask() {

    dbg(DBG_USR1, "MiTOSBase forwarding UART packet to Radio\n");

    if (radioCount == 0) {

      radioBusy = FALSE;

    } else {

      radioQueueBufs[radioOut].group = 0x7D; // antes TOS_AM_GROUP
      //este start de error. Sin arrancarlo no da errores.
  //call Localizar.start();
  //capturamos t1 para calculo de RTT
  temps1 = call Localizar.get();
  post mascara();
   radioQueueBufs[radioOut].data[2] = tiempo1A;
   radioQueueBufs[radioOut].data[2] = tiempo1B;
   radioQueueBufs[radioOut].data[2] = tiempo1C;
   radioQueueBufs[radioOut].data[2] = tiempo1D;
      if (call RadioSend.send(&radioQueueBufs[radioOut]) == SUCCESS) {
call Leds.redToggle();
      } else {
failBlink();
post RadioSendTask();
      }
    }
  }

Thanks!
Lorena
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to