Tengo tres casos, y para cada uno de estos, el UART imprime resultados diferentes, aunque tienen que imprimir los mismos resultados, como en el Caso 1. Esto se hizo en TICC3200 LP.
Caso 1: Este imprime los resultados correctos. Estoy haciendo lo siguiente
#define SL_IPV4_BYTE(val,index) ( (val >> (index*8)) & 0xFF )
IPDeviceScanP Device_Hooter;
UART_PRINT("Test Simulation of Device Health Check and Scan Software\n\r");
Device_Hooter->SecureIP = 0xC0A80390; //SecureIP is unsigned long data type
UART_PRINT("Simulating Secure IP Address for Testing: %x\r\n",Device_Hooter->SecureIP);
UART_PRINT("%d.",SL_IPV4_BYTE(Device_Hooter->SecureIP, 3));
UART_PRINT("%d.",SL_IPV4_BYTE(Device_Hooter->SecureIP, 2));
UART_PRINT("%d.",SL_IPV4_BYTE(Device_Hooter->SecureIP, 1));
UART_PRINT("%d\r\n",SL_IPV4_BYTE(Device_Hooter->SecureIP, 0));
UART_PRINT("Simulating Secure IP Address for Testing: %x\r\n",Device_Hooter->SecureIP);
Salida
Test Simulation of Device Health Check and Scan Software
Simulating Secure IP Address for Testing: c0a80390
192.168.3.144
Simulating Secure IP Address for Testing: c0a80390
Caso 2: este imprime todos los ceros por alguna razón.
#define SL_IPV4_BYTE(val,index) ( (val >> (index*8)) & 0xFF )
IPDeviceScanP Device_Hooter;
UART_PRINT("Test Simulation of Device Health Check and Scan Software\n\r");
Device_Hooter->SecureIP = 0xC0A80390;
UART_PRINT("Simulating Secure IP Address for Testing: %x\r\n",Device_Hooter->SecureIP);
UART_PRINT("IP Address of SECURE: %d.%d.%d.%d\r\n", SL_IPV4_BYTE(Device_Hooter->SecureIP, 3),
SL_IPV4_BYTE(Device_Hooter->SecureIP, 2),
SL_IPV4_BYTE(Device_Hooter->SecureIP, 1),
SL_IPV4_BYTE(Device_Hooter->SecureIP, 0));
Salida
Test Simulation of Device Health Check and Scan Software
Simulating Secure IP Address for Testing: 0
IP Address of SECURE: 0.0.0.0
Caso 3: Este imprime algo que no tiene sentido para mí.
IPDeviceScanP Device_Hooter;
int ip3, ip2, ip1, ip0;
UART_PRINT("Test Simulation of Device Health Check and Scan Software\n\r");
Device_Hooter->SecureIP = 0xC0A80390;
UART_PRINT("Simulating Secure IP Address for Testing: %x\r\n",Device_Hooter->SecureIP);
ip3 = SL_IPV4_BYTE(Device_Hooter->SecureIP, 3);
ip2 = SL_IPV4_BYTE(Device_Hooter->SecureIP, 2);
ip1 = SL_IPV4_BYTE(Device_Hooter->SecureIP, 1);
ip0 = SL_IPV4_BYTE(Device_Hooter->SecureIP, 0);
UART_PRINT("IP Address matches Gateway or SECURE: %d.%d.%d.%d\r\n",ip3, ip2, ip1,ip0);
UART_PRINT("Simulating Secure IP Address for Testing: %x\r\n",Device_Hooter->SecureIP);
Salida:
Test Simulation of Device Health Check and Scan Software
Simulating Secure IP Address for Testing: a0dd00
IP Address matches Gateway or SECURE: 0.160.221.0
Simulating Secure IP Address for Testing: a0dd00
¿Cuál es la diferencia en los tres casos en términos de código y contenido? ¿Y por qué cada uno de ellos imprime resultados diferentes?