关于VB接受DSP数据的问题
我用VB做了一个上位机,用来接收DSP程序,原来做 的是6路显示,现在被要求做成12路显示的,我原来程序如下:
Dim inbuffer As Variant
Dim inbuf() As Byte
inbuffer = MSComm1.Input
inbuf() = inbuffer
DataVolt1 = inbuf(0)
DataVolt2 = inbuf(1)
DataVolt3 = inbuf(2)
DataVolt4 = inbuf(3)
DataVolt5 = inbuf(4)
DataVolt6 = inbuf(5)
DataVolt7 = inbuf(6)
DataVolt8 = inbuf(7)
DataVolt9 = inbuf(8)
DataVolt10 = inbuf(9)
DataVolt11 = inbuf(10)
DataVolt12 = inbuf(11)
voltagenum1 = DataVolt1 * 16 * 16 + DataVolt2
voltagenum2 = DataVolt3 * 16 * 16 + DataVolt4
voltagenum3 = DataVolt5 * 16 * 16 + DataVolt6
voltagenum4 = DataVolt7 * 16 * 16 + DataVolt8
voltagenum5 = DataVolt9 * 16 * 16 + DataVolt10
voltagenum6 = DataVolt11 * 16 * 16 + DataVolt12
我上面的程序是我原来显示6路的程序,DSP一次发送12个数据过来,我通过上面程序的计算显示6路数据~现在DSP要发2次12个数据,前12个是前6路的,后面是后6路的,请问我怎么改呢?比如DSP要是发个标志位,比如1代表前6路的数据,2代表后6路的数据,需要怎么改?我是半路出家,好多都不懂,请大神们给点具体程序指导一下!谢谢了!·
[解决办法]
搞懂通信协议,什么都明白了