Combitronic 基本子程式寫法

Combitronic為SmartMotor獨特內部馬達並聯程式語言

新馬達尚未定址時, 可先應用以下指令測試
RCAN          '詢問CAN通訊狀況
RCAN 0       '正常情況回覆為0
RCADDR   '詢問CAN預設定址
RCBAUD   '詢問CAN BAUD RATE預設值,正常所有馬達BAUD RATE都要一致


Slave 寫法:
ECHO
EIGN(2) EIGN(3) ZS 'Bypass Over Travel Limits
a=CADDR 'Get pre-assigned CAN Bus Address
ADDR=a 'Set Motor Address to CAN address
END

Master寫法:

ECHO
EIGN(2) EIGN(3) ZS
a=CADDR
ADDR=a

GOSUB(1)
GOSUB(123)
END

C1
VT=32768
ADT=1000
PRT=10000
VT:0=VT              'Set speed in slave axis 
ADT:0=AT             'set accel in slave axis
PRT:2=20000
PRT:3=10000
PRT:4=40000
G
G:2
G:3
G:4
TWAIT
WAIT=5000
O:0=0
TWAIT
RETURN

C123
VTS=300000               'Set Vector Path Velocity
ADTS=1000                'Set Vector Path Accel/Decel
PTS(20000;1;2,60000;3;4) 'Set Position Target sync for all axis
GS                       'Go
TSWAIT                   'Wait for synchronized move to complete


RETURN