2006-11-21
PCI680U:2-port CAN Uni-PCI Comm. Card w/ Isolation
具体可访问:http://www.advantech.com/products/Model_Detail.asp?model_id=1-1TW6P3
PCI CAN 卡特性:
Bus interface: PCI bus spec. 2.2 compliant
Two independent CAN network operation (V2.0 A,B)
Communication controller: SJA1000
CAN transceiver:82C250
16MHz CAN controller frequency
Speed ( bps ): Up to 1Mbps programmable transfer rate
Connector: Dual DB-9 male connectors (for PCI-1680UP, it's DB25(F), and include a DB25 to Two standard DB9(M) cable)
Operating Temperature: 0 ~ 60℃
Storage Temperature: -25 ~ 85℃
Operating Humidity: 5 ~ 95% Relative Humidity, non-condensing
ISA CAN 卡:PCL-841
Operates two separate CAN networks at the same time
High speed transmission up to 1 Mbps
16 MHz CAN controller frequency
Takes a 4 KB address space, 40 base address adjustable in steps from C800H up to EF00H
Optical isolation protection of 1000 VDC ensures system reliability
Wide IRQ selection for each port includes: IRQ3, 4, 5, 6, 7, 9, 10, 11, 12, 15
LED indicates Transmit/Receive status on each port
Direct memory mapping enables speedy access to the CAN controllers
C library and examples included
带PCI和ISA总线接口的人机界面特性:
IPPC9150/9120: 开孔尺寸 371×272mm
具体可访问:http://www.hmitech.com/product/ippc/index.asp?i=12
欢迎访问纵横科技 WWW.HMITECH.COM
评论2
楼主 2006/11/20 22:21:17
'研华提供底层CAN动态库 adscan.dll ,我们可以通过动态库接口, 进行CAN通讯。
'测试环境: IPPC9150 + PCI1680U + WINDOWS 2000
'测试前准备工作:
'1、安装PCI 1680驱动和DEV Manager软件,
'2、将CAN卡插入IPPC9150,开机后,系统自动搜索板卡,并识别。
'3、将P1和P2用电缆连接,可以进行本代码测试!
'4、9针端口定义:2-CAN L 3 GND屏蔽 7 CAN H
'测试PCI1680CAN卡和DEVICE NET 设备连接,通讯OK! 现将代码分析如下:
' 测试于北航自动化院
Option Explicit
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
Const BUFFER_SIZE = 10000
Dim Port As Integer
Dim DeviceNum As Long
Dim HostID As Integer
Dim Baudrate As Integer
Dim BTR0 As Integer
Dim BTR1 As Integer
Dim AcpCode As Integer
Dim AcpMask As Integer
Dim OutCtrlCode As Integer
Dim IntMask As Integer
Dim nProtocolType As Integer
Dim DeviceName As String
Dim ErrCode As Long
Dim isPortOpen As Boolean
Dim bReady As Long
Dim g_pMsgData As Long
Dim g_pIndex As Long
Dim g_MsgData(0 To BUFFER_SIZE - 1) As CAN_MSG_T
Dim g_BufferIndex As Long
Dim PrevIndex As Long
Private Sub CmdClearList_Click()
' 通过按钮将接收到的数据清空
MsgList.Clear
End Sub
Private Sub CmdClearCount_Click()
'清空数据桢的计数
TxtCount.Text = 0
End Sub
'定时器的周期为60ms,对缓冲区的内容进行读取
Private Sub DisplayTimer1_Timer()
Dim i As Long
Dim s As String
' 如果CAN缓冲区的序列好发生改变,则进行判断,看是否读缓冲区的内容
If g_BufferIndex <> PrevIndex Then
PrevIndex = g_BufferIndex
Form1.TxtBufferIndex.Text = g_BufferIndex
'当缓冲区满后,清空缓冲区
If g_BufferIndex = 0 Then '如果实时的在list控件中显示接收的内容,可以将这个判断注释掉
s = "Receive Data Finished!"
MsgList.AddItem s
For i = 0 To BUFFER_SIZE - 1
If i Mod 100 = 99 Or i = 0 Then
s = "(" & i + 1 & ") RECV: ID = " & g_MsgData(i).ID & _
", Length = " & g_MsgData(i).dlen & ", " & _
Hex(g_MsgData(i).Data(0)) & "H " & _
Hex(g_MsgData(i).Data(1)) & "H " & _
Hex(g_MsgData(i).Data(2)) & "H " & _
Hex(g_MsgData(i).Data(3)) & "H " & _
Hex(g_MsgData(i).Data(4)) & "H " & _
Hex(g_MsgData(i).Data(5)) & "H " & _
Hex(g_MsgData(i).Data(6)) & "H " & _
Hex(g_MsgData(i).Data(7)) & "H "
MsgList.AddItem s '显示局部的信息
TxtCount.Text = i + 1
End If
Next
End If
End If
End Sub
'在工程启动的时候,对CAN卡进行初始化设置,包括 波特率 CAN协议设置等
Private Sub Form_Load()
'
BTR0 = &H3 '波特率可以通过编程设定,在这里为125kps
BTR1 = &H1C
AcpCode = 0
AcpMask = 255
IntMask = 0
OutCtrlCode = 250
nProtocolType = CANBUS_PROTOCOL_20A
g_pIndex = 0
g_pMsgData = 0
g_BufferIndex = 0
isPortOpen = False
DeviceName = " "
ErrCode = CANSelectDevice(Form1.hWnd, 0, DeviceNum, DeviceName)
'---------------------------
' 打开CAN口
'---------------------------
ErrCode = CANPortOpen(DeviceNum, Port, HostID, Baudrate)
If ErrCode <> 0 Then
MsgBox "CAN port open error!", vbOKOnly, "Error"
Exit Sub
End If
isPortOpen = True 'Port opened!
TxtDevNo.Text = CStr(DeviceNum)
TxtPort.Text = Port
TxtDeviceName.Text = DeviceName
'---------------------------
' 设置CAN协议
'---------------------------
ErrCode = CANSetProtocolType(Port, nProtocolType)
If ErrCode <> 0 Then
MsgBox "CAN set protocol type error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN设备重新启动
'---------------------------
ErrCode = CANHwReset(Port)
If ErrCode <> 0 Then
MsgBox "CAN port HW reset error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN设备初始化
'---------------------------
IntMask = 0
'BTR0 = &H3
'BTR1 = &H1C
ErrCode = CANInit(Port, BTR0, BTR1, IntMask)
If ErrCode <> 0 Then
MsgBox "CAN init error!", vbOKOnly, "RECV"
Exit Sub
End If
'---------------------------
' CAN口设置输出控制寄存器
'---------------------------
ErrCode = CANSetOutCtrl(Port, OutCtrlCode)
If ErrCode <> 0 Then
MsgBox "CAN set out control code error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN口设置接收码和屏蔽码
'---------------------------
ErrCode = CANSetAcp(Port, AcpCode, AcpMask)
If ErrCode <> 0 Then
MsgBox "CAN set ACP code error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN口波特率设置
'---------------------------
ErrCode = CANSetBaud(Port, BTR0, BTR1)
If ErrCode <> 0 Then
MsgBox "CAN set BaudRate error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN口设置为Normal方式
'---------------------------
ErrCode = CANSetNormal(Port)
If ErrCode <> 0 Then
MsgBox "CAN set normal mode error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN口接收初始化
'---------------------------
CANEnableRxInt Port
g_pMsgData = GlobalLock(CANGetAddress(g_MsgData(0)))
If g_pMsgData = 0 Then
MsgBox "Not enough memory for message buffer!", vbOKOnly, "Error"
Exit Sub
End If
g_pIndex = CANGetAddress(g_BufferIndex)
If g_pIndex = 0 Then
MsgBox "Not enough memory for index!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' 设置CAN缓冲区大小
'---------------------------
CANSetBufferPtr Port, g_pMsgData, BUFFER_SIZE, bReady
If bReady = 0 Then
MsgBox "CAN set buffer ptr error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' 设置CAN计数参数启动计数
'---------------------------
CANSetCountPtr Port, g_pIndex, bReady
If bReady = 0 Then
MsgBox "CAN set counter ptr error!", vbOKOnly, "Error"
Exit Sub
End If
'---------------------------
' CAN事件启动
'---------------------------
CANEnableEvent Port, 1
DisplayTimer1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim dwExitCode As Long
Dim bRet As Long
DisplayTimer1.Enabled = False
'关闭CAN口
If isPortOpen = False Then
Exit Sub
End If
ErrCode = CANPortClose(Port)
If ErrCode <> 0 Then
MsgBox "CAN port close error!", vbOKOnly, "Error"
Exit Sub
End If
isPortOpen = False
If g_pMsgData <> 0 Then
GlobalUnlock (g_pMsgData)
End If
End Sub
楼主 2006/11/21 9:08:45
CAN UNO-2050 & FPM工业监视器
CAN方案分析:
1、系统精简,监视器可以选配;
2、抗震性好,适用于车载;
2、驱动程序支持:提供WINCE平台下CAN驱动程序。
CAN 控制器UNO-2052 特点:
UNO-2052 带2个CAN总线LAN、USB、RS-232、8DI/O、2AI端口的GX1-300 UNO
1、隔离的CAN 2.0B双接口 , CAN控制器: SJA-1000 CAN收发器:82C250
2、抗震好,适合车载;
3、带数字量I/O和热电偶输入;
4、Windows ce 或其他通用平台。
详细:
http://www.hmitech.com/product/epc/index.asp?i=15
监视器可配:6.4 到19寸的液晶显示,同时,可以选配电阻式触摸屏!
选型请查:
http://www.hmitech.com/product/index.asp?i=5