You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.4 KiB
31 lines
1.4 KiB
//第一步:打开controlcan文件夹中的Makefile文件,修改文件中的相应的路径:g++ -o hello_cpp main.cpp /home/ttc/Desktop/controlcan/libcontrolcan.so -lpthread
|
|
(按实际路径修改)
|
|
|
|
//以下命令是查看USB设备信息,插上USB即可查找到ID 04d8:0053 Microchip Technology, Inc. 设备,无需安装USB驱动。USB驱动已集成在二次开发库中。
|
|
ttc@ubuntu:~$ lsusb
|
|
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
|
Bus 002 Device 004: ID 04d8:0053 Microchip Technology, Inc.
|
|
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
|
|
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
|
|
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
|
|
ttc@ubuntu:~$
|
|
//以上命令是查看USB设备信息,插上USB即可查找到ID 04d8:0053 Microchip Technology, Inc. 设备,无需安装USB驱动。USB驱动已集成在二次开发库中。
|
|
|
|
//将controlcan文件夹放在桌面。把CAN1与CAN2对接,运行后,可以看到程序内置的发送数据,被另一个通道接收。
|
|
|
|
|
|
ttc@ubuntu:~$ cd Desktop/controlcan/
|
|
ttc@ubuntu:~/Desktop/controlcan$ rm hello_cpp
|
|
ttc@ubuntu:~/Desktop/controlcan$ make clean && make
|
|
ttc@ubuntu:~/Desktop/controlcan$ sudo ./hello_cpp
|
|
|
|
运行结果
|
|
|
|
[sudo] password for ttc:
|
|
>>this is hello !
|
|
>>open deivce success!
|
|
>>Get VCI_ReadBoardInfo success!
|
|
>>Serial_Num:XXXXXXXXXXX
|
|
>>hw_Type:CAN-Linux
|
|
|
|
|