加密過程如下:
**次打開串口
[00000000] IOCTL_SERIAL_SET_BAUD_RATE Baud Rate: 9600 (此處設置波特率)
[00000000] IOCTL_SERIAL_SET_LINE_CONTROL StopBits: 1, Parity: Even, DataBits: 7(通訊格式)
[00000001] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000001] IRP_MJ_WRITE Length: 0005, Data: 37 32 35 30 46(此處CMD的置位指令37H,32 35 30 46及是要置位的地址‘250F’操作位元件的)
[00000001] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000001] IRP_MJ_WRITE Length: 0002, Data: 31 37 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000008] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000008] IRP_MJ_WRITE Length: 0005, Data: 37 32 35 30 46(此處CMD的置位指令37H,32 35 30 46及是要置位的地址‘250F’
[00000008] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000008] IRP_MJ_WRITE Length: 0002, Data: 31 37 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000015] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000015] IRP_MJ_WRITE Length: 0011, Data: 31 38 30 30 30 30 32 30 30 30 30 (此處的CMD功能碼31H,就是寫入數據,38 30 30 30就是寫入數據的首地址‘8000’30 32就是寫入的操作位數這里是2位 那就是一個雙字,30 30 30 30就是這個雙字的數據為'0'
[00000015] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000016] IRP_MJ_WRITE Length: 0002, Data: 31 45 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000022] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000022] IRP_MJ_WRITE Length: 0011, Data: 31 38 30 30 30 30 32 30 30 30 30 (此處的CMD功能碼31H,就是寫入數據,38 30 30 30就是寫入數據的首地址‘8000’30 32就是寫入的操作位數這里是2位 那就是一個雙字,30 30 30 30就是這個雙字的數據為'0'
[00000023] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000023] IRP_MJ_WRITE Length: 0002, Data: 31 45 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000030] IRP_MJ_CLOSE Port Closed 關閉串口
第二次打開串口
[00000000] IOCTL_SERIAL_SET_BAUD_RATE Baud Rate: 9600
[00000000] IOCTL_SERIAL_SET_LINE_CONTROL StopBits: 1, Parity: Even, DataBits: 7
[00000000] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000000] IRP_MJ_WRITE Length: 0005, Data: 38 32 35 30 46 (此處CMD的復位指令38H,32 35 30 46及是要復位的地址‘250F’操作位元件的,這里把剛剛置位的205F的地址復位了)
[00000001] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000001] IRP_MJ_WRITE Length: 0002, Data: 31 38 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000007] IRP_MJ_WRITE Length: 0001, Data: 02 ( "STX"通訊起始符02H)
[00000007] IRP_MJ_WRITE Length: 0005, Data: 38 32 35 30 46 (此處CMD的復位指令38H,32 35 30 46及是要復位的地址‘250F’操作位元件的,這里把剛剛置位的250F的地址復位了)
[00000008] IRP_MJ_WRITE Length: 0001, Data: 03 (此處是終,及到這里結束的意思代碼‘03H’)
[00000008] IRP_MJ_WRITE Length: 0002, Data: 31 38 (校驗和,從37H到此處的03H的和,如果有溢出,取*后兩位)
[00000010] IRP_MJ_CLOSE Port Closed
|