将一个二值化图片以二进制形式打开存入二维数组,先要将二维数组通过串口发送到51单片机,如何用MSComm控件向串口发送二维数组?
Private Sub Command1_Click()
Open "C:\Users\lenovo\Desktop\Pic1.BMP" For Binary Access Read As #1
Picture1.ScaleMode = 3
m = Picture1.ScaleWidth
n = Picture1.ScaleHeight
L = LOF(1)
ReDim a(1 To n, 1 To m) As Byte
Get #1, 1, a()
Close #1
'测试
For j = 1 To n
For i = 1 To m
Debug.Print Hex$(a(j, i)) & Space(3);
Next i
Debug.Print
Next j
End Sub
这是用 Debug.Print显示,如何用MSComm发送?
|