我正在使用#nav-design { text-align: center; }
#nav-design a { color: black; text-decoration: none; }
#nav-design a:hover {background-color: #00a6a6; color: #fff; }
.navbar {
background: white;
border: white;
}
.navbar-nav.navbar-center {
position: absolute;
left: 50%;
transform: translatex(-50%);
}
.nav-header {
max-width: 100%;
overflow-x: hidden;
}
.icon-bar {
background-color: black;
}
.navbar ul li a {
color: black;
text-align: center;
}
.logo img {
height: 50px;
transition: 5s;
}
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
编写应用程序。
我无法打印libmodbus 3.1.2
函数的完整输出。另外我在输出中得到了一些垃圾值。请提出建议。
modbus
o / p
printf("================Sending Sample delay command==============\n");
i32_read_ret = modbus_read_registers(ctx, 164, 1, sample_delay);
printf("\nSample delay result:%d\n", i32_read_ret);
printf("\n Sample delay : \n");
for (i = 0; i < 40; i++) //printing only the received characters
{
printf(" : %.2x \t", (int)( * (unsigned char * )( & sample_delay[i])));
}
printf("\n\n\n");
tcflush(fd, TCIOFLUSH);
printf("================Sending measurement command==============\n");
i32_read_ret = modbus_write_registers(ctx, 1, 5, measurement);
printf("\nMeasurement result : %d \n", i32_read_ret);
for (i = 0; i < 40; i++) {
printf(": %.2x \t", (int)( * (unsigned char * )( & measurement[i])));
}
printf("\n");
tcflush(fd, TCIOFLUSH);
printf("================Sending actual measurement command==============\n");
i32_read_ret = modbus_read_registers(ctx, 83, 10, actual_measurement);
printf("\nRead Return actual_measurement 3:%d\n\n\n", i32_read_ret);
for (i = 0; i < 40; i++) //printing only the received characters
{
printf(" : %.2x \t", (int)( * (unsigned char * )( & actual_measurement[i])));
}
printf("\n");
printf("%s\n", actual_measurement);
tcflush(fd, TCIOFLUSH);
答案 0 :(得分:0)
for(i=0;i<i32_read_ret;i++)
{
printf("%X",sample_delay[i]);
}