View previous topic :: View next topic |
Author |
Message |
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Mon Feb 13, 2017 5:58 pm Post subject: CanOpen |
|
|
Hello,
Has anyone done any projects with CanOpen?
Regards
P_Santos
(BASCOM-AVR version : 2.0.7.8 , Latest : 2.0.7.8 ) |
|
Back to top |
|
|
nicofer
Joined: 01 May 2013 Posts: 90 Location: GRJ
|
Posted: Fri Feb 24, 2017 9:07 am Post subject: CanOpen |
|
|
Hi
Yes , use a AT90CANxx , Bascom makes it super easy to interface with CANopen .
We use it with Festo and Schneider plc as digital i / o and a to d input / output .
CanOpen is not a big deal - it looks very complicated but once the node is active - it is just pumping out data - in the case of a sensor anyway , you do not even need to activate the node from the master - it can "auto start " after power on and start to send or receive packets from the master .
You will need to create an xxx. EDS file to load in your PLC pgm ( Codesys in my case ) , but use an existing file from a similar product and change the required fields to suit your need .
Make sure you have a lot of coffee ...
Here is the part of code that send the data to the host .
If Intcycletmr = 0 Or Encoderchange = 1 Then
Config Canmob = 9 , Bitlen = 11 , Idtag = Txpo01docid , Msgobject = Disabled , Msglen = 2 , Clearmob = No
Bok = Cansend(9 , Angle , 2)
Intcycletmr = 100
End If
End If
In this case , I update the value once per sec if no change detected , but send new data as fast as I can when there is a change - with an inhibit time to prevent one node flooding the bus .
Cheers |
|
Back to top |
|
|
P_Santos
Joined: 07 Jul 2011 Posts: 114
|
Posted: Fri Feb 24, 2017 9:55 am Post subject: |
|
|
Hello nicofer,
Thank you. In my case i want change from RS485 to CanOpen
I have a Master and 33 Slaves. The Master send sequential 17 bytes to the slaves, init the circular scan with slave ID1
The slave that have the right ID replay back data if it have new events to inform the Master, if not, it not respond and
the Master send another 17 bytes to the next Slave ID, and so on..
I read that with CanOpen it only possible to send and receive max 8 bytes at time, it that true, do you know?
Best regards
P_Santos |
|
Back to top |
|
|
nicofer
Joined: 01 May 2013 Posts: 90 Location: GRJ
|
Posted: Fri Feb 24, 2017 1:10 pm Post subject: |
|
|
Hi
The idea behind any bus system - serial or mod or profi ... is to keep the data time on the bus to the minimum .
So - the question is , what is the 17 bytes for - maybe you do not need to send all 17 bytes in the canopen format , but even if you have to , you can send it
as multiple data packets or SDO 's . They are always 8 bytes in length but can carry only 4 " user data " bytes - so if you need to send more than 4 it just take a bit longer but still possible .
Is the node id in your RS485 part of the 17 bytes , in CAN the node id is not part of the 8 bytes but is part of the complete data packet sent . you just get the data bytes in the MOB registers in the AVR or in the PLC depending how it was set up .
I am by no means a CAN open expert , so correct me if I am wrong or inaccurate.
Cheers |
|
Back to top |
|
|
JSEDDY
Joined: 30 Apr 2008 Posts: 21 Location: Edmonton
|
Posted: Fri Sep 11, 2020 12:29 pm Post subject: Canopen |
|
|
I inherited a system to update and have to add a sensor board to a series of down-hole boards. The fly in the ointment is a little bus master board with a built in Canopen stack in it. The documentation is very sparse but there is some source code in C. The Canopen stack is from Github and runs on an RTOS.....I'm not working with a PLC.
Getting the master to receive my data seems to be my problem. Using Cansend is a marvel of simplicity. It's almost like using "print". I can get data to appear on the bus, no problem. I get the ACK signal back from the master. I have no idea how to prepare the bus master. How might I prepare an xxx.EDS file and get it into the bus master? _________________ The glue has gone dry |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|