转自网友 sohappyoh
做了个串口波形显示来调试PID,需要的可以看看。
更新了软件到1.0.0.5beta了,加了文件拖放载入功能,和波形比较功能!欢迎下载试用。
C语言下位机:
#pragma pack(push)
#pragma pack(1)
typedef struct{
u8 headbyte1;
u8 headbyte2;
vs32 ch1;
vs32 ch2;
vs32 ch3;
vs32 ch4;
u8 sum;
}scope_t;
#pragma pack(pop)
scope_t scope;
void demo()
{
scope.headbyte1 = 0xA5;
scope.headbyte2 = 0x5A;
scope.ch1 = adv0;
scope.ch2 = adv1;
scope.ch3 = adv2;
scope.ch4 = adv3;
scope.sum = 0;
for(i=0; i<sizeof(scope_t)-1; i++) {
scope.sum += ((u8*)&scope)[i];
}
UartSendDat((u8*)&scope, sizeof(scope_t));
Delay_ms(2);
}