Urgently ask for advice

xiaoxiao2021-03-06  119

I used VB6 to make a interface with a device for serial communication. The device used the 80C196kc microcontroller. Now the problem is that the single chip can receive my command, but I can't receive its data, why? ? ? Here is my sender private submmand1_click (index as integer) mscomm2.outbuffercount = 0mscomm2.inbuffercount = 0

Dim send_node (8) as byteif mscomm2.portopen dammmm2.portopen = falsedim d () AS BYTEDIM CRC () AS BYTE

For ind = 0 to 3if form2.option1 (ind) = true kiln mscomm2.commport = ind 1END IFNEXT IND

Mscomm2.rthreshold = 1mscomm2.portopen = true

SELECT CASE INDEX CASE 0 Redim D (5) AS BYTE Redim CRC (1) AS BYTE D (0) = 0 d (1) = 6 D (2) = 0 d (3) = 0 d (4) = (HEX ((Text3 (7) .text)) OR & HFF00) / 256 D (5) = HEX ((Text3 (7) .text) OR & HFF CRC = CRC16 (D)

Send_node (0) = 0 Send_Node (1) = 0 Send_Node (2) = 6 Send_Node (3) = 0 Send_Node (4) = 0 Send_Node (5) = (HEX ((TEXT3 (7) .text)) or & HFF00) / 256 send_node (6) = HEX ((Text3 (7) .text)) OR & HFF Send_Node (7) = CRC (1) Send_Node (8) = CRC (0)

Mscomm2.output = send_node case 2 redim d (5) as byte redim crc (1) as byte d (0) = VAL (Text3 (7) .text) d (1) = 3 D (2) = 0 d (3 ) = 0 d (4) = 0 d (5) = 36 CRC = CRC16 (D)

Send_node (0) = 0 Send_Node (1) = Val (Text3 (7) .text) Send_Node (2) = 3 Send_Node (3) = 0 Send_Node (4) = 0 Send_Node (5) = 0 Send_Node (6) = 36 Send_node (7) = CRC (1) Send_Node (8) = CRC (0)

Mscomm2.output = send_node end selecnd submscomm2 other parameters I set it in the properties window, and I will pick up the 2, 3 feet of the serial port. When you spontaneously your own, everything is normal. Thank you

转载请注明原文地址:https://www.9cbs.com/read-99196.html

New Post(0)