What is the reason ...
 
Notifications
Clear all

What is the reason for this code?

2 Posts
1 Users
0 Reactions
7,274 Views
(@CRobbins832)
Posts: 7
Active Member Guest
Topic starter
 

I am currently working on 2 smart motors daisy chained with rs-232 communication. I found this code at the beginning of their programs. From my understanding the motors with this type of communication automatically address themselves on start-up, unless the CAN address is already stored in the memory. I am just trying to understand the reasoning behind coding it this way.

Motor #2

ADDR=2
CADDR=2
CANCTL(2,1)
ECHO
EIGN(W,0)

Motor #1

ADDR=1
CADDR=1
CANCTL(2,1)
ECHO
EIGN(W,0)

Thanks for your help.

 
Posted : 12/12/2013 4:12 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

The CADDR and CANCTL commands are written directly to EEPROM, so they are not needed in the program, but are sometimes put there for clarity.

ADDR=2 'SET RS232 AND RS485 ADDRESS
CADDR=2 'SET COMBITRONIC, CANOPEN, DEVICENET, OR PROFIBUS ADDRESS
CANCTL(2,1) 'IGNORE THE ABSENCE OF 24VDC ON CAN PORT
ECHO 'ECHO COMMAND SENT BACK TO HOST
EIGN(W,0) 'SET ALL 5VDC I/O TO GENERAL PURPOSE INPUTS

 
Posted : 12/12/2013 7:12 am
Share: