Elmomc Multi-Axis Motion Controller-Maestro Instrukcja Użytkownika Strona 272

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 313
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 271
B.4.5.3 InputOutputTest2
//InputCallback
function run()
until(InputEvent.loop!=1)
InputEvent.gEvent=-1
end function
// Input handler calls then a input event occur.
function @input(int busId, int nodeId, int data)
InputEvent.iData = data
InputEvent.gEvent = nodeId
end function
//InputEvent
// TODO: Global Variables Declaration...
int loop
int iData
int gEvent
// Entry point of the application.
function run()
global int loop
global int iData
global int gEvent
int input,tmp,i
int m_input_old,a1_input_old,a2_input_old
int input_num
int input_level
input_num = 0
input_level = 0
loop=1
a1.adi=1
a2.adi=1
input = -1
m_input_old = m_din
a1_input_old = a1.IP
a2_input_old = a2.IP
a1_input_old = a1_input_old & 0x3f
a2_input_old = a2_input_old & 0x3f
gEvent = 128
InputCallback.run()
while(loop==1)
// until(gEvent!=128 || loop!=1)
tmp = waitvar(gEvent,-1)
switch(gEvent)
case 0
input = iData & 0xff
input_num = 8
if(input > m_input_old)
input_level=1
tmp = input - m_input_old
else
input_level=0
tmp = m_input_old - input
end if
m_input_old = input
case a1.aid
input = iData & 0x3f
input_num = 6
if(input > a1_input_old)
input_level=1
tmp = input - a1_input_old
else
input_level=0
tmp = a1_input_old - input
end if
a1_input_old = input
case a2.aid
input = iData & 0x3f
input_num = 6
if(input > a2_input_old)
input_level=1
tmp = input - a2_input_old
else
input_level=0
tmp = a2_input_old - input
end if
a2_input_old = input
end switch
for i=0:input_num
if(tmp&0x0001 == 1)
if(gEvent==0)
switch(i)
case 0
m_dout[0]=input_level
case 1
m_dout[1]=input_level
case 2
m_dout[2]=input_level
case 3
m_dout[3]=input_level
case 4
m_dout[4]=input_level
case 5
m_dout[5]=input_level
case 6
m_dout[6]=input_level
case 7
m_dout[7]=input_level
end switch
end if
TRACE( "NodeID %,Input % Input Level
% ",gEvent, i+1,input_level )
end if
tmp = tmp>>1
end for
gEvent=128
end while
end function
/*
// Input handler calls then a input event occur.
function @input(int busId, int nodeId, int data)
global int iData,gEvent
iData = data
gEvent = nodeId
end function
*/
Maestro Software Manual Appendix B: Sample Programs
MAN-MASSW (Ver. Q)
B-20
Przeglądanie stron 271
1 2 ... 267 268 269 270 271 272 273 274 275 276 277 ... 312 313

Komentarze do niniejszej Instrukcji

Brak uwag