Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

CanOpen

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
P_Santos

Bascom Member



Joined: 07 Jul 2011
Posts: 114

PostPosted: Mon Feb 13, 2017 5:58 pm    Post subject: CanOpen Reply with quote

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
View user's profile
nicofer

Bascom Member



Joined: 01 May 2013
Posts: 90
Location: GRJ

southafrica.gif
PostPosted: Fri Feb 24, 2017 9:07 am    Post subject: CanOpen Reply with quote

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
View user's profile
P_Santos

Bascom Member



Joined: 07 Jul 2011
Posts: 114

PostPosted: Fri Feb 24, 2017 9:55 am    Post subject: Reply with quote

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
View user's profile
nicofer

Bascom Member



Joined: 01 May 2013
Posts: 90
Location: GRJ

southafrica.gif
PostPosted: Fri Feb 24, 2017 1:10 pm    Post subject: Reply with quote

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
View user's profile
JSEDDY

Bascom Member



Joined: 30 Apr 2008
Posts: 21
Location: Edmonton

canada.gif
PostPosted: Fri Sep 11, 2020 12:29 pm    Post subject: Canopen Reply with quote

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? Embarassed

_________________
The glue has gone dry
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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