English 中文(简体)
Java和CANopen
原标题:
  • 时间:2009-01-08 07:37:10
  •  标签:

Background

我需要在笔记本电脑上创建一个Java程序来接收/发送CANopen消息。

选择RJ45作为网络的物理介质。我是CANopen和Java通信编程的新手。

如果我表现得不熟练,请原谅。事实是,我已经阅读了很多,但我仍然不知道如何入门。

Questions

  1. Other than connecting a PC to the CANbus network, what else does the CAN-PC adapter do?
  2. Is it possible to connect the laptop to the CANbus network without the CAN-PC adapter?
  3. If a CAN-PC adapter is required, what sort of adapter should I use? PCMCIA, parallel, serial, usb, etc.?
  4. How do I get started in writing the java program to listen/write CANopen messages?
  5. What libraries should I use?
  6. Do I need to create my own drivers?
  7. Should my program handle heart-beat monitoring, error detection, etc.? Or are these taken care of by the CAN-PC adapter?
  8. How do I retrieve specific information from a CANbus node?
  9. How is the EDS file and object dictionary created? Does every node require them?
    1. How do I simulate a CAN network to test my Java program without buying CAN hardware?
问题回答

这是很多问题。我从未在Java中进行与CAN相关的编程,但让我们看看我可能回答的问题:

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

主要取决于嵌入在您的适配器中的CAN控制器。但基本上它只处理像总线仲裁、错误处理、重传和消息缓冲之类的低级别的东西。

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

不。

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

在笔记本电脑上?我会选择一个USB接口。我有Kvaser s接口的良好经验。

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

取决于您适配器所使用的API。API 很可能是基于C的,因此我建议至少从一些简单的C测试程序开始。CAN接口供应商可能会有一些很好的示例。

我应该使用哪些库?

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.

我需要自己创建驱动程序吗?

一般情况下不行。这取决于您的操作系统和CAN接口型号。选择一个带有您操作系统驱动程序的CAN接口。

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

CANopen堆栈需要在CANopen级别上处理该问题。低级CAN总线错误处理由您的接口处理。

8) How do I retrieve specific information from a CANbus node?

我不知道你在这里指的是什么。根据你需要的信息,可能是PDO或SDO。

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

你通常不需要创建EDS文件,但出于文档目的可能会有用。对象字典是以软件实现的。如果要制作符合标准的内容,则OD的某些部分是强制性的。

10) How do I simulate a CAN network to test my java program without buying CAN hardware?

我不会...一个有意义的公交模拟器可能比仅购买CAN适配器更昂贵.请注意,许多CAN适配器包含双接口,因此您可以使用仅适配器和一对终端电阻器在真实的CAN总线上进行通信测试.





相关问题
热门标签