ZLG USBCAN-4E-U User Manual page 22

Industrial high performance can interface card
Table of Contents

Advertisement

Guangzhou ZHIYUAN Electronics Co., Ltd.
The device driver will call the VCI_ResetCAN automatically to exit the CAN bus
connection only when the last device handle is closed.
11. How to use the interrupt mode to operate communication card?
The USBCAN-4E-U interface card does not provide an interface for direct operation
interruption because the interruption has been processed by driver. Most of the
reasons for operation interruption in an application are that the program does not
know when data arriving at the device,thus need a message receiving trigger to read
data from the buffer. The general method to solve this problem is to use multiple
threads (or multiple tasks). That is, start a new thread and call the VCI_Receive
function to query the receiving buffer in the thread. The blocking mechanism has
been implemented in the VCI_Receive. If there is no data in the buffer, the thread will
be suspended. At this time, it will not take up the CPU time, and the application can
still handle other transactions.
12. How to use VCI_Transmit function?
The driver of the USBCAN-4E-U interface card provides about 128 frames of
transmitting buffer FIFO. Each time the call of VCI_Transmit can transmit up to about
128 frames of data. The transmission speed of the transmitting device is determined
by the hardware and software performance of the current computer. Generally, the
transmission speed is about 2000 fps (the standard data frame is 11Bytes, 1Mbps). If
the transmission speed is too fast, it will cause data overflow of the remote receiving
device without response. Users can add delay in the application programming
appropriately to reduce the transmission speed.
Each frame has a time-out limit in the transmission process. The timeout period is
about 2 seconds when the single frame is sent. When transmitting multiple frames at
a time, the timeout period for the last frame transmission is 2 seconds and for the
remaining frames are 1 second. The sending timeout is usually due to CAN bus busy
and the lower priority of the current node, but not a function call or communication
error. Users can program to achieve re-transmission (usually, the timeout event rarely
occurs in the low-speed network). Therefore, ensure that the CAN bus occupancy
should not exceed 60-70% of the bus capacity in system design.
13. How to use the VCI_Receive function better?
The device driver provides the software receiving buffer with 100000 frames, which
provides sufficient response time for application programmers. When the software
receiving buffer data overflows, the device driver will call VCI_ResetCAN to reset the
CAN bus and set the CAN status data overflow interrupt flag. Note that both the
software buffer overflow and the CAN controller hardware buffer overflow use this
flag.
The receive function provides the Wait parameter for multi-thread programming,
encapsulated inside is a blocking function. The meaning of the Wait parameter is
similar to the dwMilliseconds parameter of Win32 WaitForSingleObject (refer to the
description of Win32API). It specifies a timeout return time for VCI_Receive in
User Manual
Date: 2017/03/09
USBCAN-4E-U User Manual
Industrial high performance CAN interface card
©2017 Guangzhou ZHIYUAN Electronics
17
V1.00

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents