Click here to Skip to main content
16,022,418 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I'm trying to create an interface between a Tank Gauging System and PC. The Tank Gauging has a CANbus via CAT 5. I want to write a VC++ program to read data from the Tanks. I surfed the net for OCX file that supports CAN communication.. Can anyone help me with these files?

I just required to read the data from CAN BUS into my system.
Posted

Yep, I thought that you would have worked with modbus previously... MODBUS is only a software spec that defines the protocol and that works on 232 or 485. So this is another story...

In order to get it working using Beckhoff, for instance you should get a CANOpen card. Once you've got that card, then buy and install TWinCAT, after that you'll be able to configure the card using system manager. You will be able to decide what to do: Using TWinCAT PLC Control to create a PLC program inside your PC or using the ADS to communicate with a VC++ application if you want...

The software based CNC/PLC systems out there work using separated layers:

[Physical layer - Electronic cards] - connect the pc to the physical world.
[Configuration layer - System manager] - configure / set up the electronics.
[PLC layer - TWinCAT PLC Control] - up to 4 software logics (virtual PLCs).
[CNC layer - TWinCAT CNC / NCi / PTP] - up to 256 axis controlled in different ways.
[ADS layer - Windows application interface] - the way you will be able to get information into your windows apps.


In order to get ADS you need to install TWinCAT and it is not free... a PLC license should be enough, or possibly a CONTROL PANEL license (I'm not sure about that).

The problem here is the concept change:

When you worked in MODBUS you did not needed an external help. The physical layer is already installed into the PC and therefore no extre material is needed, only software.

Here you'll need electronics and therefore you'll need the propietary software from the manufacturer to be able to interact with them.

So you'll have your physical world connected to the PC using electronic cards and some software that will act as a master/slave in the CANOpen bus.

Check the links I sent you... I don't think so, but it is possible that inside the first link you could find something cheaper.

Good luck!

PS: CANOpen is not precisely the easiest field bus in the world... as it's name suggests it's really open, and this will give you more than one headache... it is powerful but way too complicated, it is easy to implement in electronic terms... and this is why electronic manufacturers still go there (slower CPU's to get the bus working...) but it lacks of several modern busses capabilities...
 
Share this answer
 
Comments
sheetal.gawde 20-Apr-11 7:55am    
Hey hi,

Thanks for your most important advice.

Actually in Tank Gauging System, they have CAN bus Controller, which accepts the values from can buses and gives data to PC via CAT 5 cable i.e. through COM Port.

From COM Port they are sending one LOG file, which consist of all the values, related to Tank.

So I need to do following things,
Same as that of Log file I have to read values directly from CAN Controller. I have decided to read Log file directly but is bad idea. Problem is it is online systems so it keeps on changing.

I just need more help. Is it possible without CANOpen card & Twin CAT.

Thanks & regards,

Sheetal
Joan M 20-Apr-11 9:15am    
Then it should be much more easier...

You should put the com port in listen mode and start harvesting data...

Probably those systems will have a manual and they will start sending data using a mark for startings and another for endings...

Then you will need only to process this data: parsing and storing it where it should go...

When you are in contact with the physical world you will always face the fact that data is changing meanwhile the world happens. even if you are harvesting data through a PLC program this data will change...

Good luck with that...
sheetal.gawde 21-Apr-11 6:45am    
Hey Thanks Joan.
I am trying those things...

regards,
Sheetal.
Joan M 21-Apr-11 6:48am    
You are welcome!
Sergey Alexandrovich Kryukov 20-Apr-11 15:21pm    
Joan, my 5++++ for both Solutions (and mostly for your patience :-). You certainly own enough knowledge on the topic but your conversation is apparently stalling due to insufficient information from OP. CAN got so many faces due to different controllers and approached so you could not possible answer all at once. Good work so far.
--SA
CAN requires specific hardware...

http://www.factorycomm.com/cancards.html[^]

If you want to use a PC to do the job, then I'd recommend you to go and get a prebuilt solution... something like Beckhoff or BR-Automation. You'll get all the software, libraries and electronic cards needed to do the job.

If you want to go a little more cheap and to implement everything by yourself, then you should think of a card and a small driver and then create all the BUS PROTOCOL by yourself.

"CAN" is the hardware and software specification.
"CAN Open" is a little bit more defined and it is definitley based on "CAN".
"DEVICENET" is a little bit more defined and it is based on "CAN" also...

Anyway the physical media on those field busses is the same...

Ensure that you understand the topology and that you put the resistors at the beginning and at the end of the bus...

A good page to get more information on all those topics: http://www.can-cia.org/[^]

HTH! :thumbsup:
 
Share this answer
 
Comments
Sandeep Mewara 20-Apr-11 4:10am    
My 5!
sheetal.gawde 20-Apr-11 4:25am    
Thanks for your reply.
sheetal.gawde 20-Apr-11 4:51am    
Hi,

I have previously worked with MODBUS protocol and for that I have used MbMasterV7 OCX. But Now same things I have to do with CAN BUS Protocol. Can you briefly explain how to interface between CAN BUS and API.

I go through the sites you have told from that I found ADS-OCX. But they have told that, The ADS-OCX provides methods, events and properties in order to be able to exchange information with other ADS devices via the TwinCAT Router. So can this is useful?

Thanks & regards,
Sheetal.
Joan M 20-Apr-11 5:14am    
New answer... too much text here...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900