{"id":11998,"date":"2024-07-29T14:32:15","date_gmt":"2024-07-29T06:32:15","guid":{"rendered":"https:\/\/www.tosunai.com\/?p=11998"},"modified":"2024-07-29T15:10:35","modified_gmt":"2024-07-29T07:10:35","slug":"vb6-0-realize-can-signal-transceiver-demo","status":"publish","type":"post","link":"https:\/\/www.tosunai.com\/vb6-0-realize-can-signal-transceiver-demo\/","title":{"rendered":"\u5e72\u8d27\u5206\u4eab | \u57fa\u4e8eVB6.0 \u5b9e\u73b0 CAN\u4fe1\u53f7\u6536\u53d1 Demo"},"content":{"rendered":"\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\u672c\u6587\u4e3b\u8981\u8bb2\u7684\u662f\uff0c\u57fa\u4e8eTSMaster \u5b9e\u73b0 TOSUN \u7cfb\u5217 CAN\/CANFD\uff0cLIN \u8bbe\u5907\u7684\u64cd\u4f5c\u3002\u4e3b\u8981\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u5728 TSMaster \u8f6f\u4ef6\u91cc\u5982\u4f55\u5b9e\u73b0 CAN \u4fe1\u53f7\u6536\u53d1 Demo\u5de5\u7a0b\u3002\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u672c\u6587\u5173\u952e\u5b57\uff1aCAN\u62a5\u6587\u3001VB6.0\u3001libTSCAN<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t

\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\u672c\u6587\u76ee\u5f55<\/h6>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t
\n\t\t\t
\n\t\t\t\t<\/path><\/svg>\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

01\u3001\u5173\u4e8eDemo\u5de5\u7a0b\n\n<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u7b80\u8981\u63cf\u8ff0\uff1a<\/strong><\/p>

VB6.0\u7f16\u7a0b\u8bed\u8a00\u8c03\u7528libTSCAN\u63a5\u53e3\u5b9e\u73b0\u786c\u4ef6\u626b\u63cf\u3001\u8fde\u63a5\u3001CAN\u62a5\u6587\u5355\u5e27\u53d1\u9001\u3001\u5468\u671f\u53d1\u9001\u3001\u62a5\u6587\u63a5\u6536\uff0c\u62a5\u6587\u8fc7\u6ee4\u3002<\/p>

\u00a0<\/p>

\u5178\u578b\u5e94\u7528\u9700\u6c42:<\/strong><\/p>

\u5bf9\u4e8e\u73b0\u5728\u8fd8\u5728\u7ef4\u62a4\u548c\u5f00\u53d1\u7684VB\u9879\u76ee\u5de5\u7a0b\u9700\u8981\u8c03\u7528TSCAN\u786c\u4ef6\u5b9e\u73b0\u62a5\u6587\u6536\u53d1\u7b49\u4e1a\u52a1\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t

\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

02\u3001\u6280\u672f\u80cc\u666f<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\u5728 VB6.0 \u4e2d\u4f7f\u7528 Declare \u8bed\u53e5\u58f0\u660elibTSCAN.dll\u4e2d\u7684\u51fd\u6570\uff0c\u8fd9\u4e9b\u58f0\u660e\u4f7f\u5f97 VB6.0 \u80fd\u591f\u4e0e\u5e95\u5c42\u7684 API \u8fdb\u884c\u4ea4\u4e92\u3002\u5982\uff1aPrivate Declare Function tscan_connect Lib “libTSCAN.dll” (ByVal ADeviceSerial As String, ByRef AHandle As Long) As Long\u3002\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

03\u3001Demo\u5de5\u7a0b\u5b9e\u73b0<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

1.\u6dfb\u52a0\u5e93\u6587\u4ef6<\/h3>

\u8981\u5b9e\u73b0\u5bf9 TOSUN \u7cfb\u5217 CAN\/CANFD\uff0cLIN \u8bbe\u5907\u7684\u64cd\u4f5c\uff0c\u9700\u8981\u57fa\u4e8e libTSCAN.dll \uff0clibTSH.dll\uff0cbinlog.dll \u4ee5\u53ca liblog.dll\u52a8\u6001\u94fe\u63a5\u5e93\u6587\u4ef6\u3002\u5b83\u4eec\u4e4b\u95f4\u4f9d\u8d56\u5173\u7cfb\u5982\u4e0b\u56fe1\u6240\u793a\u3002<\/p>

\u00a0<\/p>

libTSCAN.dll \uff0clibTSH.dll\uff0cbinlog.dll \u4ee5\u53ca liblog.dll\u52a8\u6001\u94fe\u63a5\u5e93\u6587\u4ef6\u6587\u4ef6\u4f4d\u7f6e\u53ef\u4ee5\u5728TSMaster\u5b89\u88c5\u76ee\u5f55\u4e0b\u83b7\u53d6\u3002C:\\Program Files (x86)\\TOSUN\\TSMaster\\Data\\SDK\\examples\\Python\\Linux\\lib\\libTOSUN\\windows\\x86<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u57fa\u4e8eVB6.0\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\u65b0\u5efa\u597dVB\u5de5\u7a0b\u540e\u5c06\u4ee5\u4e0a\u4f9d\u8d56\u6587\u4ef6\u6dfb\u52a0\u5230VB\u5de5\u7a0b\u76ee\u5f55\u4e0b,\u6dfb\u52a0\u597d\u540e\u5de5\u7a0b\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\u5982\u4e0b\u56fe2\u6240\u793a\u3002\n\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u57fa\u4e8eVB6.0\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2.\u58f0\u660elibTSCAN.dll\u4e2d\u7684\u51fd\u6570<\/h3>

\u4f7f\u7528Declare \u8bed\u53e5\u58f0\u660elibTSCAN.dll\u4e2d\u7684\u51fd\u6570\u3002<\/p>

\u00a0<\/p>


\u8bed\u6cd5\u5982\u4e0b\uff1a<\/strong><\/p>

Private Declare [Function|Sub] \u5916\u90e8\u51fd\u6570\u540d Lib “\u5e93\u6587\u4ef6\u540d” [Alias “\u522b\u540d”] ([\u53c2\u6570\u5217\u8868])<\/strong><\/p>

Private<\/strong>\uff1a\u53ef\u9009\uff0c\u8868\u793a\u8be5\u58f0\u660e\u5728\u5f53\u524d\u6a21\u5757\u5185\u53ef\u89c1\u3002\u5982\u679c\u9700\u8981\u5728\u591a\u4e2a\u6a21\u5757\u4e2d\u4f7f\u7528\uff0c\u53ef\u4ee5\u4f7f\u7528Public\u3002<\/p>

Declare<\/strong>\uff1a\u5173\u952e\u5b57\uff0c\u7528\u4e8e\u58f0\u660e\u5916\u90e8\u51fd\u6570\u3002<\/p>

Function<\/strong>\u6216Sub<\/strong>\uff1a\u6839\u636e\u5916\u90e8\u51fd\u6570\u662f\u8fd4\u56de\u503c\uff08Function\uff09\u8fd8\u662f\u4e0d\u8fd4\u56de\u503c\uff08Sub\uff09\u6765\u9009\u62e9\u3002<\/p>

\u5916\u90e8\u51fd\u6570\u540d\uff1a\u4f60\u5728VB6.0\u4ee3\u7801\u4e2d\u4f7f\u7528\u7684\u51fd\u6570\u540d\u79f0\u3002<\/p>

Lib<\/strong>\uff1a\u6307\u5b9a\u5305\u542b\u51fd\u6570\u5b9a\u4e49\u7684DLL\u5e93\u6587\u4ef6\u7684\u540d\u79f0\u3002<\/p>

\u5e93\u6587\u4ef6\u540d\uff1aDLL\u5e93\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u4e0d\u5305\u62ec\u6269\u5c55\u540d\uff08.lib\u6216.dll\uff09\u3002<\/p>

Alias<\/strong>\uff1a\u53ef\u9009\uff0c\u5982\u679cDLL\u4e2d\u7684\u51fd\u6570\u540d\u79f0\u4e0eVB6.0\u4e2d\u7684\u540d\u79f0\u51b2\u7a81\u6216\u4e0d\u7b26\u5408VB6.0\u7684\u547d\u540d\u89c4\u5219\uff0c\u53ef\u4ee5\u4f7f\u7528\u522b\u540d\u3002<\/p>

\u00a0<\/p>

\u53c2\u6570\u5217\u8868<\/strong>\uff1a\u51fd\u6570\u7684\u53c2\u6570\uff0c\u5305\u62ec\u53c2\u6570\u7684\u540d\u79f0\u3001\u7c7b\u578b\u548c\u4f20\u9012\u65b9\u5f0f\uff08ByVal\u6216ByRef\uff09\u3002<\/p>

\u00a0<\/p>

‘\u52a0\u8f7dlibTSCAN\u51fd\u6570\u5e93\uff0c\u5fc5\u987b\u5728\u8c03\u7528\u5176\u4ed6API\u4e4b\u524d\u6267\u884c<\/em><\/p>

Private Declare\u00a0Sub initialize_lib_tscan_verbose\u00a0Lib “libTSCAN.dll” (ByVal AEnableFIFO As Boolean, ByVal AEnableErrorFrame As Boolean, ByVal AUseHWTime As Boolean, ByVal ATSType As Long)<\/em><\/p>

\u00a0<\/p>

‘\u91ca\u653elibTSCAN\u51fd\u6570\u5e93\uff0c\u5fc5\u987b\u5728\u5b8c\u6210\u4f7f\u7528\u9000\u51fa\u7a0b\u5e8f\u4e4b\u524d\u8c03\u7528<\/em><\/p>

Private Declare Sub finalize_lib_tscan\u00a0Lib “libTSCAN.dll” ()<\/em><\/p>

\u00a0<\/p>

‘\u67e5\u8be2\u8bbe\u5907\u7684\u5236\u9020\u5546\uff0c\u4ea7\u54c1\u540d\u79f0\uff0c\u5e8f\u5217\u53f7\uff0c\u5305\u542b\u591a\u5c11\u4e2aCAN\u901a\u9053\uff0c\u662f\u5426\u652f\u6301FDCAN\uff0c\u591a\u5c11\u4e2aLIN\u901a\u9053\uff0cFlexray\u901a\u9053\u4ee5\u53ca\u4ee5\u592a\u7f51\u901a\u9053<\/em><\/p>

Private Declare Function tscan_get_device_info_detail\u00a0Lib “libTSCAN.dll” (ByVal ADeviceIndex As Long, ByRef AManufacturer As Long, ByRef AProduct As Long, ByRef ASerial As Long, ByRef ADeviceType As Long, ByRef ADeviceName As Long, ByRef ACANChannelCount As Long, ByRef AIsCANFD As Boolean, ByRef ALINChannelCount As Long, ByRef AFRChannelCount As Long, ByRef AEthernetChannelCount As Long) As Long<\/em><\/p>

\u00a0<\/p>

‘\u8fde\u63a5\u8bbe\u5907<\/em><\/p>

Private Declare Function tscan_connect\u00a0Lib “libTSCAN.dll” (ByVal ADeviceSerial As String, ByRef AHandle As Long) As Long<\/em><\/p>


‘\u65ad\u5f00\u8bbe\u5907<\/em><\/p>

Private Declare Function tscan_disconnect_by_handle\u00a0Lib “libTSCAN.dll” (ByVal AHandle As Long) As Long<\/em><\/p>

\u00a0<\/p>

‘\u67e5\u8be2\u5f53\u524d\u5728\u7ebf\u7684TSCAN\u8bbe\u5907\u6570\u91cf<\/em><\/p>

Private Declare Function tscan_scan_devices\u00a0Lib “libTSCAN.dll” (ByRef ADeviceCount As Long) As Long<\/em><\/p>


‘\u914d\u7f6e\u666e\u901aCAN\u786c\u4ef6\u901a\u9053<\/em><\/p>

Private Declare Function tscan_config_can_by_baudrate\u00a0Lib “libTSCAN.dll” (ByVal AHandle As Long, ByVal AChnIdx As Long, ByVal ARateKbps As Double, ByVal A120OhmConnected As Long) As Long<\/em><\/p>

\u00a0<\/p>

‘\u914d\u7f6eFDCAN\u786c\u4ef6\u901a\u9053\uff1bAControllerType[0\uff1a\u666e\u901aCAN 1\uff1aISO-FD 2\uff1aNoISO-FD] AControllerMode[0:Normal 1: ACKOff 2: Retricted 3: Internal Loop 4: External Loop]<\/em><\/p>

Private Declare Function tscan_config_canfd_by_baudrate\u00a0Lib “libTSCAN.dll” (ByVal AHandle As Long, ByVal AChnIdx As Long, ByVal AArbRateKbps As Double, ByVal ADataRateKbps As Double, ByVal AControllerType As Long, ByVal AControllerMode As Long, ByVal A120OhmConnected As Long) As Long<\/em><\/p>

\u00a0<\/p>

‘\u53d1\u9001CAN\/CANFD\u62a5\u6587<\/em><\/p>

Private Declare Function tscan_transmit_can_sync\u00a0Lib “libTSCAN.dll” (ByVal ADeviceHandle As Long, ByRef ACAN As TLIBCAN, ByVal ATimeoutMS As Long) As Long<\/em><\/p>

\u00a0<\/p>

Private Declare Function tscan_transmit_can_async\u00a0Lib “libTSCAN.dll” (ByVal ADeviceHandle As Long, ByRef ACAN As TLIBCAN) As Long<\/em><\/p>

\u00a0<\/p>


‘\u5468\u671f\u53d1\u9001CAN\/CANFD\u62a5\u6587<\/em><\/p>

‘\u6dfb\u52a0CAN\u5468\u671f\u53d1\u9001\u62a5\u6587<\/em><\/p>

Private Declare Function tscan_add_cyclic_msg_can\u00a0Lib “libTSCAN.dll” (ByVal ADeviceHandle As Long, ByRef ACAN As TLIBCAN, ByVal APeriodMS As Single) As Long<\/em><\/p>

‘\u5220\u9664CAN\u5468\u671f\u53d1\u9001\u62a5\u6587<\/em><\/p>

Private Declare Function tscan_delete_cyclic_msg_can Lib “libTSCAN.dll” (ByVal ADeviceHandle As Long, ByRef ACAN As TLIBCAN) As Long<\/em><\/p>


\u6ce8\uff1a\u5982\u9700\u5b8c\u6574\u7684VB6.0\u793a\u4f8b\u5de5\u7a0b\u6e90\u4ee3\u7801\uff0c\u53ef\u4ee5\u968f\u65f6\u8054\u7cfb\u540c\u661f\u5e94\u7528\u652f\u6301\u83b7\u53d6\u3002<\/span><\/p>

\u00a0<\/p>

\u00a0<\/p>

3.CAN \/CANFD\u6570\u636e\u7ed3\u6784\u5b9a\u4e49<\/h3>

CAN\u4e0eCAN FD\u6570\u636e\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u57fa\u4e8eVB6.0\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

4.\u8c03\u7528\u63a5\u53e3\u8bf4\u660e<\/h3>

Demo\u5185\u90e8\u5206\u4f7f\u7528\u5230\u7684\u63a5\u53e3\u8bf4\u660e\uff1a<\/strong><\/p>

\u00a0<\/p>

initialize_lib_tscan_verbose<\/strong><\/p>

\u4f5c\u7528\uff1a\u521d\u59cb\u5316 tscan \u5e93\u6a21\u5757\u3002\u5fc5\u987b\u8c03\u7528\u6b64\u51fd\u6570\u521d\u59cb\u5316 CAN \u6a21\u5757\u8fc7\u540e\uff0c\u624d\u80fd\u591f\u8c03\u7528\u5176\u4ed6 API \u51fd\u6570\u3002\u8be5\u51fd\u6570\u548c finalize_lib_tscan \u662f\u6210\u5bf9\u4f7f\u7528\u7684\u3002<\/p>

\u00a0<\/p>


\u8f93\u5165\u53c2\u6570\uff1a<\/p>

AEnableFIFO[IN]\uff1a\u662f\u5426\u5f00\u542f FIFO \u673a\u5236\uff0c\u5efa\u8bae\u8bbe\u7f6e\u4e3a True\uff0c\u5426\u5219\u7528\u6237\u65e0\u6cd5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u901a\u8fc7 tsfifo_receive_xx \u51fd\u6570\u8bfb\u53d6\u62a5\u6587\uff1b\u00a0<\/p>

AEnableErrorFrame[IN]\uff1a\u662f\u5426\u63a5\u6536\u9519\u8bef\u5e27\u3002\u5982\u679c\u8bbe\u7f6e\u4e3a False\uff0c\u5219\u9a71\u52a8\u76f4 \u63a5\u628a \u9519\u8bef\u5e27\u629b\u5f03\u6389\uff1b<\/p>

AUseHWTime[IN]\uff1a\u662f\u5426\u4f7f\u7528\u8bbe\u5907\u8fde\u63a5\u65f6\u95f4\uff1b<\/p>

ATSType[IN] :\u8bbe\u7f6e\u4e3aFalse \u5373\u53ef\uff1b<\/p>

\u8fd4\u56de\u503c\uff1a\u65e0<\/p>

\u00a0<\/p>


finalize_lib_tscan<\/strong><\/p>

\u4f5c\u7528\uff1a\u5728\u9000\u51fa\u7a0b\u5e8f\u4e4b\u524d\uff0c\u91ca\u653e CAN \u6a21\u5757\uff0c\u548c\u521b\u5efa\u51fd\u6570initialize_lib_tscan \u51fd\u6570\u914d\u5bf9\u4f7f\u7528\u3002<\/p>

\u8f93\u5165\u53c2\u6570\uff1a\u65e0<\/p>

\u8fd4\u56de\u503c\uff1a\u65e0<\/p>

\u00a0<\/p>


tscan_get_device_info_detail<\/strong><\/p>

\u4f5c\u7528\uff1a\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceIndex[IN]\uff1a\u8bbe\u5907\u7d22\u5f15\u503c\uff1b<\/p>

AManufacturer [OUT]\uff1a\u5236\u9020\u5546\uff1b<\/p>

AProduct[OUT] \uff1a\u4ea7\u54c1\u540d\u79f0\uff1b<\/p>

ASerial[OUT] \uff1a\u00a0\u5e8f\u5217\u53f7\uff1b<\/p>

ADeviceType[OUT] \uff1a\u8bbe\u5907\u7c7b\u578b\uff1b<\/p>

ADeviceName[OUT] \uff1a\u8bbe\u5907\u540d\u79f0\uff1b<\/p>

ACANChannelCount[OUT] \uff1aCAN\u901a\u9053\u6570\u91cf\uff1b<\/p>

AIsCANFD[OUT] \uff1a\u662f\u5426\u652f\u6301CANFD\uff1b<\/p>

ALINChannelCount[OUT] \uff1aLIN\u901a\u9053\u6570\u91cf\uff1b<\/p>

AFRChannelCount[OUT] \uff1aFR\u901a\u9053\u6570\u91cf\uff1b<\/p>

AEthernetChannelCount[OUT] \uff1a\u4ee5\u592a\u7f51\u901a\u9053\u6570\u91cf\uff1b<\/p>

\u00a0<\/p>


tscan_connect<\/strong><\/p>

\u4f5c\u7528\uff1a\u8fde\u63a5\u8bbe\u5907\uff0c\u5e76\u83b7\u53d6\u8be5\u8bbe\u5907\u7684\u552f\u4e00\u53e5\u67c4<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceSerial\uff1a\u83b7\u53d6\u6307\u5b9a\u5e8f\u5217\u53f7\u7684\u8bbe\u5907,\u8be5\u53c2\u6570\u4e3a\u7a7a\u5b57\u7b26\u5219\u8868\u793a\u83b7\u53d6\u4efb\u610f\u5904\u4e8e\u8fde\u63a5\u72b6\u6001\u7684\u8bbe\u5907\uff1b<\/p>

AHandle\uff1a\u8bbe\u5907\u53e5\u67c4\uff0c\u540e\u7eed\u64cd\u4f5c\u786c\u4ef6\u90fd\u9700\u8981\u6839\u636e\u8be5\u552f\u4e00\u8bbe\u5907\u53e5\u67c4\u8fdb\u884c\u64cd\u4f5c\uff1b<\/p>

\u00a0<\/p>


tscan_scan_devices<\/strong><\/p>

\u4f5c\u7528\uff1a\u626b\u63cf\u5728\u7ebf\u8bbe\u5907\u6570\u91cf<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceCount[OUT]\uff1a\u8fd4\u56de\u5728\u7ebf\u8bbe\u5907\u6570\u91cf\uff1b<\/p>

\u00a0<\/p>


tscan_config_can_by_baudrate<\/strong><\/p>

\u4f5c\u7528\uff1a\u914d\u7f6eCAN\u603b\u7ebf\u6ce2\u7279\u7387<\/p>

AHandle:\u8bbe\u5907\u53e5\u67c4\uff1b<\/p>

AChnIdx:\u5e94\u7528\u7a0b\u5e8f\u901a\u9053\u7f16\u53f7\uff1b<\/p>

ARateKbps:\u6ce2\u7279\u7387\uff1b<\/p>

A120OhmConnected\uff1a\u662f\u5426\u4f7f\u80fd\u5185\u90e8\u7ec8\u7aef\u7535\u963b\uff1b<\/p>

\u00a0<\/p>

tscan_transmit_can_sync<\/strong><\/p>

\u4f5c\u7528\uff1a\u53d1\u9001 CAN \u62a5\u6587\uff0c\u5e76\u68c0\u6d4b\u5230\u53d1\u9001\u6210\u529f\u540e\uff0c\u624d\u9000\u51fa\u6b64\u51fd\u6570\u3002\u6b64\u51fd\u6570\u8fd4\u56de\u6210\u529f\uff0c\u4ee3\u8868 CAN \u62a5\u6587\u4e00\u5b9a\u5df2\u7ecf\u6210\u529f\u53d1\u9001\u5230\u4e86 CAN \u603b\u7ebf\u4e0a\u9762\u3002<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceHandle\uff1a\u8bbe\u5907\u53e5\u67c4\uff1b<\/p>

ACAN\uff1a\u62a5\u6587\u6570\u636e\uff1b<\/p>

ATimeoutMS\uff1a\u540c\u6b65\u7b49\u5f85\u8d85\u65f6\u65f6\u95f4\uff1b<\/p>

\u00a0<\/p>


tscan_transmit_can_async<\/strong><\/p>

\u4f5c\u7528\uff1a\u4ee5\u5f02\u6b65\u7684\u65b9\u5f0f\u53d1\u9001CAN\u62a5\u6587<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ACAN\uff1aCAN \u6570\u636e\u5305\u3002TLIBCAN \u6570\u636e\u7ec4\u6210\u8bf7\u67e5CAN\u3001CANFD\u6570\u636e\u7ec4\u6210\u7ae0\u8282\u3002<\/p>

\u00a0<\/p>


tscan_add_cyclic_msg_can<\/strong><\/p>

\u4f5c\u7528\uff1a\u589e\u52a0\u5468\u671f\u53d1\u9001\u7684\u62a5\u6587<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceHandle:\u64cd\u4f5c\u8bbe\u5907\u53e5\u67c4<\/p>

ACAN\uff1aCAN\u6570\u636e\u5305\uff1b<\/p>

APeriodMS:\u5468\u671f\u503c\uff1b<\/p>

\u00a0<\/p>


tscan_delete_cyclic_msg_can<\/strong><\/p>

\u4f5c\u7528\uff1a\u5220\u9664\u5468\u671f\u6027\u53d1\u9001 CAN \u62a5\u6587<\/p>

ACAN\uff1a\u9700\u8981\u88ab\u5220\u9664\u7684\u662f\u3001\u5468\u671f\u62a5\u6587\uff1b<\/p>

\u00a0<\/p>

tsfifo_receive_can_msgs<\/strong><\/p>

\u4f5c\u7528\uff1a\u8bfb\u53d6\u786c\u4ef6\u7f13\u5b58\u4e2d\u7684\u62a5\u6587\u6570\u636e\u5305\u3002<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceHandle\uff1a\u8bbe\u5907\u53e5\u67c4\uff1b<\/p>

ACANBuffers:\u6570\u636e Buffer\uff0c\u7528\u4e8e\u5b58\u50a8\u8bfb\u53d6\u5230\u7684\u62a5\u6587\uff0c\u8be5 Buffer \u9700\u8981\u51fd\u6570\u8c03\u7528\u65b9\u521b\u5efa\uff1b<\/p>

ACANBufferSize:\u6d88\u606f Buffer \u7684\u5927\u5c0f\uff1b<\/p>

AChn:\u76ee\u6807\u901a\u9053\uff1a\u5bf9\u4e8e\u591a\u901a\u9053\u8bbe\u5907\uff0c\u672c\u51fd\u6570\u9009\u62e9\u8bfb\u53d6\u54ea\u4e00\u4e2a\u901a\u9053\u7684\u6570\u636e\uff0c\u8be5\u53c2\u6570\u53ef\u4ee5\u4e3a\u7a7a\uff0c\u9ed8\u8ba4\u4e3a\u901a\u9053 1\uff1b<\/p>

ARxTx:==0:\u4ec5\u4ec5\u63a5\u6536 Rx \u62a5\u6587\uff1b>0: Tx Rx \u62a5\u6587\u90fd\u8bfb\u53d6\u56de\u6765\uff0c\u8be5\u53c2\u6570\u53ef\u4ee5\u4e3a\u7a7a\uff0c\u9ed8\u8ba4\u4e3a\u53ea\u63a5\u6536 Rx \u62a5\u6587\uff1b<\/p>

\u00a0<\/p>


tsfifo_add_can_canfd_pass_filter<\/strong><\/p>

\u4f5c\u7528\uff1a\u7528\u6237\u5982\u679c\u53ea\u60f3\u63a5\u6536\u7279\u5b9a ID \u62a5\u6587\u7684\u65f6\u5019\uff0c\u9700\u8981\u8c03\u7528\u6b64\u51fd\u6570<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceHandle\uff1a\u8bbe\u5907\u53e5\u67c4\uff1b<\/p>

AChnIdx\uff1a\u901a\u9053\u7d22\u5f15\uff1b<\/p>

AIdentifier\uff1a\u62a5\u6587\u6807\u8bc6\u7b26\uff1b<\/p>

AIsStd\uff1a\u662f\u5426\u6807\u51c6\u5e27\uff1b<\/p>

\u00a0<\/p>

tsfifo_delete_can_canfd_pass_filter<\/strong><\/p>

\u4f5c\u7528\uff1a\u53d6\u6d88\u62a5\u6587\u8fc7\u6ee4<\/p>

\u8f93\u5165\u53c2\u6570\uff1a<\/p>

ADeviceHandle\uff1a\u8bbe\u5907\u53e5\u67c4\uff1b<\/p>

AChnIdx\uff1a\u901a\u9053\u7d22\u5f15\uff1b<\/p>

AIdentifier\uff1a\u62a5\u6587\u6807\u8bc6\u7b26\uff1b<\/p>

AIsStd\uff1a\u662f\u5426\u6807\u51c6\u5e27\uff1b<\/p>

\u00a0<\/p>

\u00a0<\/h3>

5.VB6.0 Demo\u5b9e\u73b0\u6548\u679c<\/h3>

1\uff09\u70b9\u51fb[\u626b\u63cf\u8bbe\u5907],\u83b7\u53d6\u5728\u7ebf\u8bbe\u5907\u6570\u91cf\u6253\u5370\u4e8e\u53f3\u8fb9\u63a7\u4ef6\u4e2d\u3002<\/p>

2\uff09\u70b9\u51fb[\u67e5\u8be2\u8bbe\u5907\u4fe1\u606f],\u83b7\u53d6\u8bbe\u5907\u5177\u4f53\u4fe1\u606f\u6253\u5370\u4e8e\u53f3\u8fb9\u63a7\u4ef6\u4e2d\u3002<\/p>

3\uff09\u70b9\u51fb[\u8fde\u63a5]\u5b8c\u6210\u786c\u4ef6\u8fde\u63a5\uff0c\u6253\u5370\u8fde\u63a5\u6210\u529f\u65e5\u5fd7\u53ca\u5f53\u524d\u8bbe\u5907\u53e5\u67c4\u4e8e\u53f3\u8fb9\u63a7\u4ef6\u4e2d\u3002<\/p>

4\uff09\u70b9\u51fb[\u914d\u7f6e\u786c\u4ef6\u901a\u9053]\uff0c\u5b8c\u6210\u901a\u9053\u53ca\u6ce2\u7279\u7387\u8bbe\u7f6e\u3002<\/p>

5.\uff09\u70b9\u51fb[\u901a\u9053\u4e00\u53d1\u9001\u666e\u901a\u62a5\u6587]\u5355\u5e27\u53d1\u90010x7B\u3002<\/p>

6\uff09\u70b9\u51fb[\u4ece\u901a\u90532\u63a5\u6536CAN\u62a5\u6587]\uff0c\u8bfb\u53d6FIFO\u4e2d\u7684\u62a5\u6587\u6570\u636e\u663e\u793a\u5728\u4e0b\u65b9ListBox\u4e2d\u3002<\/p>

7\uff09\u70b9\u51fb[\u53d1\u9001\u5468\u671f\u62a5\u6587] ,\u62a5\u65870x29A \u6309\u716750ms\u5468\u671f\u53d1\u9001\u3002<\/p>

8\uff09\u70b9\u51fb[\u505c\u6b62\u5468\u671f\u53d1\u9001] ,\u62a5\u65870x29A\u505c\u6b62\u5468\u671f\u53d1\u9001\u3002<\/p>

9\uff09\u70b9\u51fb[\u4ece\u901a\u90532\u63a5\u6536CAN\u62a5\u6587],\u8bfb\u53d6FIFO\u4e2d\u7684\u62a5\u6587\u6570\u636e\u663e\u793a\u5b50\u554a\u4e0b\u65b9ListBox\u4e2d\u3002\u5982\u56fe3\u6240\u793a\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u57fa\u4e8eVB6.0\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

04\u3001\u7591\u96be\u89e3\u7b54\uff08QA\uff09<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

Q\uff1a\u8fde\u63a5\u4e4b\u540e\uff0c\u8bbe\u5907\u4e00\u76f4\u5728\u63a5\u6536\u6d88\u606f\uff0c\u6b64\u65f6\u6211\u5f00\u542f\u8fc7\u6ee4\u4e4b\u540e\uff0c\u518d\u53bb\u53d1\u9001\u62a5\u6587\uff0c\u63a5\u6536\u62a5\u6587\u7684\u65f6\u5019\uff0c\u662f\u4e0d\u662f\u8981\u628a\u4e4b\u524d\u5b58\u7684\u6570\u636e\u53d6\u51fa\u6765\uff0c\u76f4\u5230\u8bfb\u53d6\u5230\u8fc7\u6ee4\u7684ID\uff1f<\/p>

A\uff1a\u5bf9\u7684\u3002\u6dfb\u52a0\u8fc7\u6ee4\u540e\u4e3b\u52a8\u628a\u65e7\u7684\u7f13\u5b58\u7ed9\u6e05\u9664\u6389\u3002\u6e05\u9664\u7f13\u5b58\u51fd\u6570\uff1atsfifo_clear_can_receive_buffers\u3002<\/p>

\u00a0<\/p>

Q\uff1a\u51fd\u6570\u7684\u8fd4\u56de\u503c\u4ee3\u8868\u4ec0\u4e48\u610f\u601d\uff1f<\/p>

A\uff1a\u51fd\u6570\u8fd4\u56de\u503c\u4e3a0\u65f6\u4ee3\u8868\u51fd\u6570\u6267\u884c\u6210\u529f\uff0c\u5176\u4ed6\u503c\u4ee3\u8868\u51fd\u6570\u6267\u884c\u5931\u8d25\u3002\u5177\u4f53\u5931\u8d25\u539f\u56e0\u63cf\u8ff0\u53ef\u4ee5\u6839\u636eTSMaster\u5185\u7cfb\u7edf\u5185\u7f6e\u5e38\u6570\u8fdb\u884c\u67e5\u8868\u3002\u5982\u8fd4\u56de\u503c\u4e3a3\u4ee3\u8868\u201c\u8bbe\u5907\u672a\u627e\u5230\u201d\uff0c\u8fd9\u65f6\u5019\u5c31\u8981\u68c0\u67e5\u5f53\u524dTSCAN\u8bbe\u5907\u662f\u5426\u8fde\u63a5\u6b63\u5e38\u4e86\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u57fa\u4e8eVB6.0\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"

\u672c\u6587\u4e3b\u8981\u8bb2\u7684\u662f\uff0c\u57fa\u4e8eTSMaster \u5b9e\u73b0 TOSUN \u7cfb\u5217 CAN\/CANFD\uff0cLIN \u8bbe\u5907\u7684\u64cd\u4f5c\u3002\u4e3b\u8981\u7ed9\u5927 […]<\/p>\n","protected":false},"author":11,"featured_media":12001,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[90],"tags":[62,65,131,136],"class_list":{"0":"post-11998","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-software-tutorial","8":"tag-can","9":"tag-tsmaster","11":"tag-136","12":"entry","13":"has-media","14":"owp-thumbs-layout-horizontal","15":"owp-btn-normal","16":"owp-tabs-layout-horizontal","17":"has-no-thumbnails","18":"has-product-nav"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/posts\/11998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/comments?post=11998"}],"version-history":[{"count":0,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/posts\/11998\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/media\/12001"}],"wp:attachment":[{"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/media?parent=11998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/categories?post=11998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tosunai.com\/wp-json\/wp\/v2\/tags?post=11998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}