java can通信,Java和CANopen的

Background

I am required to create a Java program on a laptop to receive/send CANopen messages.

RJ45 is chosen to be the network's physical medium. I am new to CANopen and Java communications programming.

Pardon me if I appear to be uninitiated. The truth is, I have been reading up a lot, but I still do not know how to get started.

Questions

Other than connecting a PC to the CANbus network, what else does the CAN-PC adapter do?

Is it possible to connect the laptop to the CANbus network without the CAN-PC adapter?

If a CAN-PC adapter is required, what sort of adapter should I use? PCMCIA, parallel, serial, usb, etc.?

How do I get started in writing the java program to listen/write CANopen messages?

What libraries should I use?

Do I need to create my own drivers?

Should my program handle heart-beat monitoring, error detection, etc.? Or are these taken care of by the CAN-PC adapter?

How do I retrieve specific information from a CANbus node?

How is the EDS file and object dictionary created? Does every node require them?

How do I simulate a CAN network to test my Java program without buying CAN hardware?

解决方案

That's a lot of questions. I have never done any CAN related programming in Java, but let's see which questions I might answer anyway:

1) Other than connecting a PC to the

CANbus network, what else does the

CAN-PC adapter do?

It depends mainly on which CAN controller that is embedded in your adapter. But basically it just handles the low-level stuff like bus-arbitration, error-handling, retransmissions and message buffering.

2) Is it possible to connect the

laptop to the CANbus network without

the CAN-PC adapter?

No.

3) If a CAN-PC adapter is required,

what sort of adapter should I use?

PCMCIA, parallel, serial, usb, etc?

On a laptop? I would choose a USB interface. I have good experience with Kvaser's interfaces.

4) How do I get started in writing the

java program to listen/write CANopen

messages?

Depends on the API for your adapter. The API will most probably be C-based, so I would at least start out with some simple C test programs. The CAN-interface supplier probably have some good examples.

5) What libraries should I use?

Probably the one supplied with your CAN-interface, at least for the basic CAN part. For the CANopen part, there are some commercial CANopen stacks available and perhaps even some free. I doubt there are any written in Java.

You could also implement the necessary parts of the CANopen stack yourself if you are only doing simple communication.

6) Do I need to create my own drivers?

Generally no. Depends on your operating system and CAN-interface model. Select a CAN interface with drivers for your operating system.

7) Should my program handle heart-beat

monitoring / error detection / etc? Or

are these taken care of by the CAN-PC

adapter?

The CANopen stack should handle that on the CANopen level. The low level CAN bus error handling is taken care of by your interface.

8) How do I retrieve specific

information from a CANbus node?

I don't know what you mean here. PDOs or SDOs depending on what kind of information you want.

9) How is the EDS file and object

dictionary created? Does every node

require them?

You don't genereally need to create an EDS file, but might be useful for documentation purposes. The object-dictionary is implemented in software. Some parts of the OD are mandatory if making something standards-compliant.

10) How do I simulate a CAN network to

test my java program without buying

CAN hardware?

I wouldn't... A meaningful bus simulator would probably be more expensive to develop than to just bu a CAN adapter. Note that many CAN adapters contain dual interfaces, so you may do communication tests on a real CAN bus with little more hardware than just the adapter and a couple of termination resistors.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值