Sunspot

Controlling the Aviosys IP9203 stepper motor controller


Objective
Control an Aviosys IP9203 stepper motor controller from a Linux bash script

- Use Blassic basic to prepare and then run a bash command

There is a useful Windows .exe program here - it uses UDP to talk to port 7070 of the control card
ipm9203_02.zip

Japanese site
http://www.moosoft.jp/index.php?option=com_content&view=article&id=45&Itemid=34
Google translation
http://translate.google.co.uk/translate?hl=en&sl=ja&u=http://moosoftjp.com/ippower.htm&ei=QtPfTPSPF4OKhQet37H-DA&sa=X&oi=translate&ct=result&resnum=3&ved=0CDAQ7gEwAg&prev=/search%3Fq%3Dmoosoft%2B9203%26hl%3Den%26biw%3D1296%26bih%3D694


I used Wireshark to sniff the LAN and see what the html form was requesting

I need to send
192.168.0.19/tgi/ioControl_M.tgi
?PinNo=P5_M0&P50M_STEP=100&P50M_TIMER=1&P50M_TIMER_CNTL=0&Apply=Apply

So use the Linux bash script -

curl -d "PinNo=P5_M0&P50M_STEP=100&P50M_TIMER=1&P50M_TIMER_CNTL=0&Apply=Apply" 192.168.0.19/tgi/ioControl_M.tgi

This sets the values of the html POST form via a Linux command line
these set -
P50M_STEP=100
P50M_TIMER=1
P50M_TIMER_CNTL=0 for one way P50M_TIMER_CNTL=1 for the other


The Blassic program below takes 3 arguments
- step, timer, direction
and creates the string that a browser would normally send to the 9203 when filling in the form on the built in web page

#!/usr/sbin/blassic
' /var/www/cgi-bin/servo_board/stepper1.bas 100 1 1
' This program sends a bash command like -
' curl -d 'PinNo=P5_M0&P50M_STEP=100&P50M_TIMER=1&P50M_TIMER_CNTL=1&Apply=Apply' 192.168.0.19/tgi/ioControl_M.tgi
' this "fills in the boxes" of the POST table on the Aviosys 6203 web page
' curl "pretends to be" a browser but from a command line

Step$ = PROGRAMARG$(1) 'Send the number of steps as the first argument - 10 100 etc
Timer$ = PROGRAMARG$(2) 'Send the timer delay as the second argument - 1 10 etc
Direction$ = PROGRAMARG$(3) 'Send the rotation sense - 0 or 1

' next bit all on one line up to -


s$ = "curl -d "+CHR$(39)+"PinNo=P5_M0&P50M_STEP="+Step$+"&P50M_TIMER="+Timer$+"&P50M_TIMER_CNTL="+Direction$+"&Apply=Apply"+CHR$(39)+" 192.168.0.19/tgi/ioControl_M.tgi > /dev/null 2>&1"


' - here

' so now ask bash to send this string out using curl

SHELL s$


' "> /dev/null 2>&1" means "do not show the returning web page from the 9203"

SYSTEM

Please email me here - if you have better information on the 9203 and especially if you can control the 9200 card on its own
Aviosys give very little data - the best I can find is here -

ftp://ftp.ral.ro/../../../FTP%20Public/Support/Aviosys/

Sunspot