Table of Contents - TG Drives
Table of Contents - TG Drives Table of Contents - TG Drives
180 SAnyBus ; Start .define cSTART_INIT = 1 .define cANYBUS_INIT = 2 .define cSET_ETN_CONFIG = 3 .define cCONNECT_TIMEOUT = 4 .define cEND_INIT = 5 .define cNoModule = 0 .define cProfibusDB = 1 EXTENDED REGISTER GROUPS gosub SRou_SAnyBusInit ;init the module wait 1=2 ; ; ; Give the fieldbus module time to start. ; SRou_SAnyBusInit: SAnybus.TimeOut,50 clr rOnLine clr tmr.t0 wait SAnybus.FBType cNoModule if SAnybus.FBType = cProfibusDB then ProfibusDP clr tmr.t0 wait tmr.t0 > 100 return ;================== ; ; ProfiBus-DP ; ProfibusDP: Vector.SAnybus, @IRou_ProfiBus ;set vector or int.sysmask, 4096 ;enable interrupt SAnybus.HasMail, 0 ; Clear mailbox flag SAnybus.Mode, 1+2+4+8+16 ; Enable SANYBUS and all interrupts and reverse ;read gosub SendStartInit ; gosub SendInit64_64 ; gosub SendEndInit return ; ;Interrupt entry for profibus ;Remember that the ABOut buffer is holds the OUTPUT FROM the Anybus module ;seen frombthe PL2 side. ;The ABIn buffer holds the INPUT TO the Anybus module seen from the PL2 side. IRou_ProfiBus: if SAnybus.HasOutput = 0 then isrProfibus00 ;test if any data in output ;buffer SAnybus.HasOutput, 0 ; Clear flag ; User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001
EXTENDED REGISTER GROUPS SAnyBus ; Copy return data anybusout getlong rTmp91,0 ;read byte 0 - 3 into reg anybusout getint rTmp92,4 ;read byte 4 - 5 into reg anybusout getbyte rTmp93,6 ;read byte 6 into reg anybusin putlong rTmp91,0 ;write back first long AnybusIO Send ;send it back isrProfibus00: if SAnybus.HasMail = 0 then isrProfibus10 ; We handle this in code. But we show it here anyway. ; disp SAnybus.HasMail isrProfibus10: if SAnybus.OnLine = rOnLine then isrProfibus20 ; disp SAnybus.OnLine rOnLine, SAnybus.OnLine isrProfibus20: ireturn sys 4096 ; ; START_INIT ; SendStartInit : rProtNumber, cSTART_INIT SAnybus.Command, 1 ; Prepare START_INIT mail message wait SAnybus.Command = 0 ; Wait for it to be done SAnybus.Command, 7 ; Send to fieldbus module wait SAnybus.HasMail = 1 ; Wait for response mail ; Investigate response mail for errors here if ABOutMail.MessageInfo < 0 then ErrorProt SAnybus.HasMail, 0 return ; Clear mailbox flag SendInit64_64: rProtNumber, cANYBUS_INIT SAnybus.Command, 3 ; Prepare ANYBUS_INIT mail message wait SAnybus.Command = 0 ; Wait for it to be done ; Modify default values here in ABInMail ; Length in bytes! ; PBIn.InIOLen, 64 PBIn.InDPRAMLen, 64 PBIn.InTotalLen, 64 PBIn.OutIOLen, 64 PBIn.OutDPRAMLen, 64 PBIn.OutTotalLen, 64 ABInMail.ModuleStatus, 512+2 ; default value (you must keep 512) User's Manual 5.1 Inmotion Technologies AB Doc. No.9032 0027 01 (B), Rev. 11.07.2001 181
- Page 129 and 130: EXTENDED REGISTER GROUPS Bit(0..3)
- Page 131 and 132: EXTENDED REGISTER GROUPS GROUP MEMB
- Page 133 and 134: EXTENDED REGISTER GROUPS RD1CORR, P
- Page 135 and 136: EXTENDED REGISTER GROUPS OptAD, ana
- Page 137 and 138: EXTENDED REGISTER GROUPS OptAD.7 7
- Page 139 and 140: EXTENDED REGISTER GROUPS LAN1, LOCA
- Page 141 and 142: EXTENDED REGISTER GROUPS WriteLAN1
- Page 143 and 144: EXTENDED REGISTER GROUPS LAN1, Loca
- Page 145 and 146: EXTENDED REGISTER GROUPS LAN1, Loca
- Page 147 and 148: EXTENDED REGISTER GROUPS LAN1.ErrVe
- Page 149 and 150: EXTENDED REGISTER GROUPS MsgObjLAN1
- Page 151 and 152: EXTENDED REGISTER GROUPS isrDone: M
- Page 153 and 154: EXTENDED REGISTER GROUPS MsgObjLAN2
- Page 155 and 156: EXTENDED REGISTER GROUPS Denominato
- Page 157 and 158: EXTENDED REGISTER GROUPS ABIN Group
- Page 159 and 160: EXTENDED REGISTER GROUPS DSTORE, Gr
- Page 161 and 162: EXTENDED REGISTER GROUPS PARAREA, G
- Page 163 and 164: EXTENDED REGISTER GROUPS XENDAT, Gr
- Page 165 and 166: EXTENDED REGISTER GROUPS wait tmr.t
- Page 167 and 168: EXTENDED REGISTER GROUPS XENDAT.Tra
- Page 169 and 170: EXTENDED REGISTER GROUPS XENDAT, Af
- Page 171 and 172: EXTENDED REGISTER GROUPS XENDAT.RPo
- Page 173 and 174: EXTENDED REGISTER GROUPS Counter 0
- Page 175 and 176: EXTENDED REGISTER GROUPS IDENTIFIER
- Page 177 and 178: EXTENDED REGISTER GROUPS >RPDATA.Ar
- Page 179: EXTENDED REGISTER GROUPS EXAMPLE US
- Page 183 and 184: EXTENDED REGISTER GROUPS GROUP MEMB
- Page 185 and 186: EXTENDED REGISTER GROUPS SAnyBus As
- Page 187 and 188: EXTENDED REGISTER GROUPS PutLONG Pu
- Page 189 and 190: EXTENDED REGISTER GROUPS ABOUTMAIL
- Page 191 and 192: EXTENDED REGISTER GROUPS EN1-EN4, E
- Page 193 and 194: EXTENDED REGISTER GROUPS IENC Group
- Page 195 and 196: EXTENDED REGISTER GROUPS MODEN3-MOD
- Page 197: EXTENDED REGISTER GROUPS ModEN3.Cap
- Page 200 and 201: 200 Computer Mode Record type 1 2 3
- Page 203 and 204: PL2 On line commands PL2 ON LINE CO
- Page 205: PL2 ON LINE COMMANDS Command name E
- Page 208 and 209: 208 B009 Definitions THE ECT MAIN M
- Page 210 and 211: 210 Edit in generating this code. F
- Page 212 and 213: 212 Compile EXITING EDIT To exit Ed
- Page 214 and 215: 214 Test line, assisting the user t
- Page 216 and 217: 216 Test including the upload and d
- Page 218 and 219: 1 2 3 4 5 6 X7:A 16 15 14 13 12 11
- Page 220: Start (reset entry) Init If ..... t
180<br />
SAnyBus<br />
; Start<br />
.define cSTART_INIT = 1<br />
.define cANYBUS_INIT = 2<br />
.define cSET_ETN_CONFIG = 3<br />
.define cCONNECT_TIMEOUT = 4<br />
.define cEND_INIT = 5<br />
.define cNoModule = 0<br />
.define cPr<strong>of</strong>ibusDB = 1<br />
EXTENDED REGISTER GROUPS<br />
gosub SRou_SAnyBusInit ;init the module<br />
wait 1=2 ;<br />
;<br />
; Give the fieldbus module time to start.<br />
;<br />
SRou_SAnyBusInit:<br />
SAnybus.TimeOut,50<br />
clr rOnLine<br />
clr tmr.t0<br />
wait SAnybus.FBType cNoModule<br />
if SAnybus.FBType = cPr<strong>of</strong>ibusDB then Pr<strong>of</strong>ibusDP<br />
clr tmr.t0<br />
wait tmr.t0 > 100<br />
return<br />
;==================<br />
;<br />
; Pr<strong>of</strong>iBus-DP<br />
;<br />
Pr<strong>of</strong>ibusDP:<br />
Vector.SAnybus, @IRou_Pr<strong>of</strong>iBus ;set vector<br />
or int.sysmask, 4096 ;enable interrupt<br />
SAnybus.HasMail, 0 ; Clear mailbox flag<br />
SAnybus.Mode, 1+2+4+8+16 ; Enable SANYBUS and all interrupts and<br />
reverse ;read<br />
gosub SendStartInit ;<br />
gosub SendInit64_64 ;<br />
gosub SendEndInit<br />
return<br />
;<br />
;Interrupt entry for pr<strong>of</strong>ibus<br />
;Remember that the ABOut buffer is holds the OUTPUT FROM the Anybus module<br />
;seen frombthe PL2 side.<br />
;The ABIn buffer holds the INPUT TO the Anybus module seen from<br />
the PL2 side.<br />
IRou_Pr<strong>of</strong>iBus:<br />
if SAnybus.HasOutput = 0 then isrPr<strong>of</strong>ibus00 ;test if any data in output<br />
;buffer<br />
SAnybus.HasOutput, 0 ; Clear flag<br />
;<br />
User's Manual 5.1 Inmotion Technologies AB<br />
Doc. No.9032 0027 01 (B), Rev. 11.07.2001