<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Galil Tech Talk</title>
	<atom:link href="http://www.galilmc.com/techtalk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.galilmc.com/techtalk</link>
	<description></description>
	<pubDate>Mon, 14 May 2012 22:45:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Communication to a Galil Controller with Beckhoff&#8217;s TwinCAT PLC software</title>
		<link>http://www.galilmc.com/techtalk/galil-news/comminication-to-a-galil-controller-with-beckhoffs-twincat-plc-software/</link>
		<comments>http://www.galilmc.com/techtalk/galil-news/comminication-to-a-galil-controller-with-beckhoffs-twincat-plc-software/#comments</comments>
		<pubDate>Mon, 14 May 2012 22:38:25 +0000</pubDate>
		<dc:creator>Galil_AndyH</dc:creator>
		
		<category><![CDATA[I/O Control]]></category>

		<category><![CDATA[Inside Galil]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Beckhoff]]></category>

		<category><![CDATA[communication]]></category>

		<category><![CDATA[TwinCAT]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=196</guid>
		<description><![CDATA[Beckhoff TwinCAT PLC software allows the user to open TCP/IP sockets directly to a Galil Controller using their TwinCAT TCP/IP Server Communication Supplement.
This post provides a simple function block example that opens a connection to the Galil Controller, then sends commands and receives the responses at 1 second intervals.  This code allows for basic communication [...]]]></description>
			<content:encoded><![CDATA[<p>Beckhoff TwinCAT PLC software allows the user to open TCP/IP sockets directly to a Galil Controller using their TwinCAT TCP/IP Server Communication Supplement.</p>
<p>This post provides a simple function block example that opens a connection to the Galil Controller, then sends commands and receives the responses at 1 second intervals.  This code allows for basic communication from the TwinCAT PLC to a Galil Controller.  The full project can be found here:</p>
<p><a href="http://www.galilmc.com/support/techtalk_files/TwinCAT_TCP.zip">http://www.galilmc.com/support/techtalk_files/TwinCAT_TCP.zip</a></p>
<p>The code is shown below:</p>
<p>The IP address and command sent to the controller are defined in the MAIN (PRG) as i_sRemoteHost and sSendCommand respectively.</p>
<pre>PROGRAM MAIN
VAR
lrVar1: LREAL := 123.45;
fbGalil: FB_Galil;
tUpdate: TIME := T#1s;
xEnable: BOOL := TRUE;
sSendCommand: STRING := 'MG TIME';
END_VAR</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<pre>(* P_simple_TCPIP(); *)

fbGalil(
i_xEnable:= xEnable,
i_sSrvNetID:= '',
i_sRemoteHost:= '192.168.1.74',
i_nRemotePort:=23 ,
i_tReconnect:= T#5s ,
i_tUpdateTime:= tUpdate,
lrVar1:= lrVar1,
lrVar2:=0,
sSendCommand:=sSendCommand );</pre>
<p>The communication is handled in the FB_Galil (FB) Function Block - code is shown below.</p>
<pre>FUNCTION_BLOCK FB_Galil
VAR_INPUT
i_xEnable            :BOOL;
i_sSrvNetID         :STRING := '';
i_sRemoteHost     :STRING;
i_nRemotePort     :UDINT;
i_tReconnect       :TIME := t#45s;
i_tUpdateTime      :TIME := T#1s;

lrVar1                :LREAL;
lrVar2                :LREAL;
sSendCommand    :STRING;
END_VAR
VAR_OUTPUT
END_VAR
VAR
fbClientServerConnection: FB_ClientServerConnection;
fbSocketSend: FB_SocketSend;
sSendString: STRING;
fbSocketReceive: FB_SocketReceive;
iStep: INT;
rtEnable: R_TRIG;
tonUpdate: TON;
sReceiveString: STRING;
END_VAR</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<pre>rtEnable(CLK:=i_xEnable);

IF i_xEnable = FALSE THEN
iStep := 0;
END_IF

CASE iStep OF
0: (* idle *)
fbClientServerConnection.bEnable:= FALSE;
fbSocketSend.bExecute := FALSE;
fbSocketReceive.bExecute := FALSE;
IF i_xEnable = TRUE THEN
iStep := 10;
END_IF

10: (* make the conection *)
fbClientServerConnection.bEnable:= TRUE;
IF fbClientServerConnection.eState = eSOCKET_CONNECTED THEN
iStep := 100;
ELSIF fbClientServerConnection.bError THEN
iStep :=0;
END_IF

100:
IF tonUpdate.Q THEN
fbSocketSend.bExecute := FALSE; (* reset send*)
fbSocketReceive.bExecute := FALSE; (*reset receive *)
iStep := 110;
tonUpdate(IN := FALSE);  (* reset timer *)
END_IF

110:
(* command to just set a variable - this would be commanded moves as well (ie PA, BG etc) *)
(*
sSendString := 'var1=TIME';
(* append a number to a variable decleration - ie var1=123.45 *)
(*        sSendString := 'var1=';
sSendString := CONCAT(sSendString,LREAL_TO_STRING(lrVar1)); *)
sSendString := CONCAT(sSendString,'$r');(*append carriage return and line feed*)
fbSocketSend.pSrc:= ADR(sSendString);
fbSocketSend.cbLen := LEN(sSendString);
fbSocketSend.bExecute := TRUE;
*)

(* command with a response *)
sSendString := sSendCommand;
sSendString := CONCAT(sSendString,'$r$n');(*append carriage return and line feed*)
fbSocketSend.pSrc:= ADR(sSendString);
fbSocketSend.cbLen := LEN(sSendString);
fbSocketSend.bExecute := TRUE;
iStep := 120;

120:
IF NOT fbSocketSend.bBusy THEN
IF NOT fbSocketSend.bError THEN
iStep := 125;
ELSE
(* hanldle error *)
iStep := 9000;
END_IF
END_IF

125:
(*clear memory for receive string and set receive to true *)
MEMSET(destAddr:=ADR(sReceiveString), fillByte:=0, n:=SIZEOF(sReceiveString));
fbSocketReceive.bExecute := TRUE;
iStep := 130;

130:
(* read receive data *)
fbSocketReceive.pDest := ADR(sReceiveString);
fbSocketReceive.cbLen := SIZEOF(sReceiveString) - 1;
iStep := 140;

140:
(* check to see if received data - if not, read again (130) *)
IF NOT fbSocketReceive.bBusy THEN
IF NOT fbSocketReceive.bError THEN
IF fbSocketReceive.nRecBytes &gt; 0 THEN
iStep := 100;
ELSE
fbSocketReceive.bExecute := FALSE; (*reset receive *)
iStep := 125;
END_IF
ELSE
(* hanldle error *)
iStep := 9000;
END_IF
END_IF

9000: (* error step *)
iStep:=0;

END_CASE

fbClientServerConnection(
sSrvNetID:= i_sSrvNetID,
nMode:= CONNECT_MODE_ENABLEDBG,
sRemoteHost:= i_sRemoteHost,
nRemotePort:= i_nRemotePort,
tReconnect:= i_tReconnect    );

fbSocketSend(
sSrvNetId:='' ,
hSocket:= fbClientServerConnection.hSocket,
tTimeout:= t#2s);

fbSocketReceive(
sSrvNetId:='' ,
hSocket:= fbClientServerConnection.hSocket,
tTimeout:= t#2s);

tonUpdate(IN := TRUE, PT:= i_tUpdateTime);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/galil-news/comminication-to-a-galil-controller-with-beckhoffs-twincat-plc-software/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Drive Options for DMC-40&#215;0 and DMC-41&#215;3 Multi-axis Controllers</title>
		<link>http://www.galilmc.com/techtalk/drives/new-drive-options-for-dmc-40x0-and-dmc-41x3-multi-axis-controllers/</link>
		<comments>http://www.galilmc.com/techtalk/drives/new-drive-options-for-dmc-40x0-and-dmc-41x3-multi-axis-controllers/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 21:36:11 +0000</pubDate>
		<dc:creator>Galil_MarkM</dc:creator>
		
		<category><![CDATA[Drives]]></category>

		<category><![CDATA[ServoTrends]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=193</guid>
		<description><![CDATA[Galil’s DMC-40&#215;0 Accelera and DMC-41&#215;3 Econo Ethernet motion controllers are now available with additional multi-axis servo and stepper drive options. The AMP-43540 4-axis 600W brushless sine drive is now available in a 2-axis model as the AMP-43520, and the SDM-44040 4-axis stepper drive is available with 2-axis as the SDM-44020. The new 2-axis drive options [...]]]></description>
			<content:encoded><![CDATA[<p>Galil’s DMC-40&#215;0 Accelera and DMC-41&#215;3 Econo Ethernet motion controllers are now available with additional multi-axis servo and stepper drive options. The AMP-43540 4-axis 600W brushless sine drive is now available in a 2-axis model as the AMP-43520, and the SDM-44040 4-axis stepper drive is available with 2-axis as the SDM-44020. The new 2-axis drive options provide additional cost savings for OEM applications.</p>
<p><strong>AMP-435&#215;0 2- and 4-axis 600 W Servo Drives with Sine Commutation (-D3520, -D3540)</strong></p>
<p>The AMP-43540 contains four transconductance, PWM amplifiers for driving brushed or brushless servo motors with sinusoidal commutation and the AMP-43520 contains two PWM amplifiers. Each amplifier drives motors operating at up to 8 Amps rms cont.,   15 Amps peak, 20–80 VDC.<br />
The gain settings of the amplifier are user-programmable at 0.4, 0.8 and 1.6 Amp/Volt. The switching frequency is 33 KHz. The amplifier offers protection for over-voltage, under-voltage, over-current, short-circuit and over-temperature. Hall sensors are not required for brushless motor commutation.  A shunt regulator option is available.</p>
<p><strong>SDM-440&#215;0 2- and 4-axis Stepper Drives (-D4020, -D4040)</strong></p>
<p>The SDM-44040 contains four drives for operating two-phase bipolar step motors and the SDM-44020 contains two stepper drives. The SDM-440&#215;0 requires a single 12–30 VDC input. The unit is user-configurable for 1.4 A, 1.0 A, 0.75 A, or 0.5 A per phase and for full step, half-step, 1/4 step or 1/16 step.</p>
<p><strong>Highlights of DMC-40&#215;0 and DMC-41&#215;3 Series</strong></p>
<p>The DMC-40&#215;0 Accelera and DMC-41&#215;3 Econo motion controllers are available in 1-through 8-axis formats, and each axis is user configurable for stepper and servo motor operation. The controllers are available as a controller-only model for interface to external drives of any power range or as a controller packaged with an integrated stepper or servo drive. Drive options for the DMC-40&#215;0 and DMC-41&#215;3 controllers are the same and are listed in Table 2.</p>
<p><a href="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/table2.png"><img class="alignnone size-medium wp-image-194" title="table2" src="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/table2-300x125.png" alt="" width="300" height="125" /></a><br />
Standard features of the DMC-40&#215;0 and DMC-41&#215;3 controllers include PID compensation with velocity and acceleration feed forward, memory for user programs, multitasking for simultaneously running up to eight programs, and I/O processing for synchronizing motion with external events. Modes of motion include point-to-point positioning, position tracking, jogging, linear and circular interpolation, contouring, electronic gearing, ECAM, and PVT. The DMC-40&#215;0 Accelera controller uses a faster version of the microprocessor allowing the controller to achieve 40 microsecond command processing, accept encoder inputs up to 22 MHz, and perform servo loop updates at 62 microseconds.<br />
Standard isolated inputs of the DMC-40&#215;0 and DMC-41&#215;3 controllers include forward and reverse limits for each axis and a home input for each axis. 1-through 4-axis models include 8 isolated, digital inputs and 8 isolated, digital outputs. 5 through 8-axis models include 16 inputs and 16 outputs.<br />
Like all Galil controllers, the DMC-41&#215;3 controllers are programmed with Galil’s intuitive, 2-letter command language, making them easy to program. Galil’s command language has used the same 2-letter format for over 25 years and is similar across both single and multi-axis controller platforms. The GalilTools and new GalilSuite software simplifies system set-up with automated servo tuning and real-time display of motion information in the time domain.<br />
For complete pricing and specifications for the DMC-41&#215;3 series, see:</p>
<p><a href="http://www.galilmc.com/products/dmc-41x3.php ">http://www.galilmc.com/products/dmc-41&#215;3.php </a></p>
<p>and for the DMC-40&#215;0 Accelera series see:</p>
<p><a href="http://www.galilmc.com/products/dmc-40x0.php">http://www.galilmc.com/products/dmc-40&#215;0.php</a></p>
<ul>
<li class="pdf"><a href="http://www.galilmc.com/support/servotrends/st_04_12.pdf" target="_blank">View Entire ServoTrends Newsletter (Printer Friendly)</a><a style="float:right;" href="/support/servotrends.php" target="_blank">Back To ServoTrends</a></li>
</ul>
<h4 style="clear: both;">April 2012 Featured Articles</h4>
<ul class="featured-articles">
<li>
<h5><a href="http://www.galilmc.com/techtalk/drives/dmc-30000-motion-controller-now-available-with-microstep-drive-16-bit-adc-and-sinusoidal-encoder/">New Options for DMC-30000 Pocket Motion Controller Series</a></h5>
</li>
<li>
<h5><a href="http://www.galilmc.com/techtalk/drives/new-drive-options-for-dmc-40x0-and-dmc-41x3-multi-axis-controllers/">New! 2-Axis Servo &amp; Stepper Drives for DMC-41&#215;3,-40&#215;0 Controllers</a></h5>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/drives/new-drive-options-for-dmc-40x0-and-dmc-41x3-multi-axis-controllers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DMC-30000 Motion Controller Now Available with Microstep Drive, 16-bit ADC and Sinusoidal Encoder</title>
		<link>http://www.galilmc.com/techtalk/drives/dmc-30000-motion-controller-now-available-with-microstep-drive-16-bit-adc-and-sinusoidal-encoder/</link>
		<comments>http://www.galilmc.com/techtalk/drives/dmc-30000-motion-controller-now-available-with-microstep-drive-16-bit-adc-and-sinusoidal-encoder/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 21:18:21 +0000</pubDate>
		<dc:creator>Galil_MarkM</dc:creator>
		
		<category><![CDATA[Drives]]></category>

		<category><![CDATA[Feedback Devices]]></category>

		<category><![CDATA[ServoTrends]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=189</guid>
		<description><![CDATA[Galil’s recently released DMC-30000 Pocket Motion Controller Series offers higher performance, better power efficiency, smaller size, and a lower price than prior generation, single-axis controllers. A popular product in the series is the DMC-30012 which combines a single-axis motion controller and 800W brushed/brushless sine drive in a single, compact package. Now, Galil introduces another controller/drive [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/left-image.jpg"><img class="alignnone size-medium wp-image-190 alignright" style="float: right;" title="DMC-30017" src="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/left-image-300x240.jpg" alt="DMC-30017 Microstepping Stepper motor controller and drive" width="300" height="240" /></a>Galil’s recently released DMC-30000 Pocket Motion Controller Series offers higher performance, better power efficiency, smaller size, and a lower price than prior generation, single-axis controllers. A popular product in the series is the DMC-30012 which combines a single-axis motion controller and 800W brushed/brushless sine drive in a single, compact package. Now, Galil introduces another controller/drive package, the DMC-30017 which contains a 6A microstepping drive. Also available is the new DMC-31xxx option which features a 16-bit ADC and sinusoidal encoder input option.</p>
<p><strong>DMC-30017 Motion Controller with 6A, 80V Microstepping Drive</strong><br />
The DMC-30017 contains a microstepping drive for operating a two-phase bipolar stepper motor. The drive produces 256 microsteps per full step or 1024 steps per full cycle which results in 51,200 steps/rev for a standard 200-step motor. The maximum step rate generated by the controller is 3,000,000 microsteps/second. The DMC-30017 drives motors operating at up to 6 Amps at 20 to 80 VDC.<br />
There are four software-selectable current settings: 0.75A, 1.5A, 3 A, and 6A. A selectable low-current mode reduces the current by 75% when the motor is not in motion. No external heatsink is required.</p>
<p><strong>DMC-31xxx Option for 16-bit ADC and Sinusoidal Encoder</strong></p>
<p>The DMC-31xxx model increases the ADC resolution from 12-bits to 16-bits and provides +/-10V configurable analog inputs, and provides an option for accepting sinusoidal encoder signals instead of digital encoder signals. The DMC-31xxx interpolates a 1-volt differential sinusoidal encoder resulting in a higher position resolution. The AFn command selects sinusoidal interpolation where n specifies 2^n interpolation counts per encoder cycle (n=5 to 12). For example, if the encoder cycle is 40 microns, AF10 results in 2^10=1024 counts per cycle, or a resolution of 39 nanometers per count.</p>
<p><strong>Highlights of DMC-30000 Series</strong></p>
<p>High performance features of the DMC-30000 include: 125 microsecond servo loop update period, 15MHz encoder frequency, non-volatile memory for user programs, and multitasking for simultaneously running up to four user programs.  Modes of motion include point-to-point positioning, position tracking, jogging, contouring, electronic gearing, ECAM, and PVT. The DMC-30000 includes two 100Base-T Ethernet ports in addition to an internal Ethernet hub which allows multiple units to be daisy-chained without the use of an external hub.<br />
The DMC-30000 provides optically isolated inputs and outputs as a standard feature including forward and reverse limit inputs, homing input, 8 uncommitted digital inputs, 4 uncommitted digital outputs, 2 uncommitted analog inputs and 1 uncommitted analog output.  The DMC-30000 accepts both main and auxiliary quadrature encoders as standard, with BiSS and SSI formats available as an option. The new DMC-31xxx option accepts sinusoidal encoder inputs instead of digital inputs and provides a 16-bit analog-to-digital converter instead of 12-bit ADC.<br />
The DMC-30000 single-axis controller series is available as a controller-only for connection to external motor drives of any power range or it can be purchased as an integrated controller and drive package. The DMC-30012 model is a controller packaged with an internal 800W sine drive for operating brushed/brushless motors at 20-80 VDC, up to 10 Amps rms continuous, 15 Amps peak. The DMC-30017 model is a controller packaged with an internal 20-80 VDC, 6A/phase microstepping drive.<br />
The Pocket Motion Controller Series is compact in size, measuring just 3.9” x 5.0” x 1.5” for the DMC-30012/30017 controller/drive package and 3.0” x 4.0” for the controller-only card. The series is also economically priced for OEMs: $445 in quantities of 100 for the DMC-30012 controller with 800W brushless sine drive.<br />
Like all Galil controllers, the DMC-30000 is programmed with Galil’s intuitive, 2-letter command language, making it quick and easy to program. Galil’s command language has used the same 2-letter format for over 25 years and is similar across both single and multi-axis controller platforms. The GalilTools and new GalilSuite software simplifies system set-up with automated servo tuning and real-time display of motion information in the time domain.<br />
Currently available models and options for the DMC-30000 Pocket Motion Controller Series are listed in Table 1.</p>
<p><a href="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/table1.png"><img class="alignnone size-medium wp-image-191" title="table1" src="http://www.galilmc.com/techtalk/wp-content/uploads/2012/04/table1-300x125.png" alt="" width="300" height="125" /></a><br />
Complete pricing and specifications for the DMC-30000 Pocket Motion Controller Series, are available at: <a href="http://www.galilmc.com/products/dmc-300xx.php" target="_blank">http://www.galilmc.com/products/dmc-300xx.php</a> or contact a Galil application engineer at 800-377-6329 or support@galilmc.com</p>
<ul>
<li class="pdf"><a href="http://www.galilmc.com/support/servotrends/st_04_12.pdf" target="_blank">View Entire ServoTrends Newsletter (Printer Friendly)</a><a style="float:right;" href="/support/servotrends.php" target="_blank">Back To ServoTrends</a></li>
</ul>
<h4 style="clear: both;">April 2012 Featured Articles</h4>
<ul class="featured-articles">
<li>
<h5><a href="http://www.galilmc.com/techtalk/drives/dmc-30000-motion-controller-now-available-with-microstep-drive-16-bit-adc-and-sinusoidal-encoder/">New Options for DMC-30000 Pocket Motion Controller Series</a></h5>
</li>
<li>
<h5><a href="http://www.galilmc.com/techtalk/drives/new-drive-options-for-dmc-40x0-and-dmc-41x3-multi-axis-controllers/">New! 2-Axis Servo &amp; Stepper Drives for DMC-41&#215;3,-40&#215;0 Controllers</a></h5>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/drives/dmc-30000-motion-controller-now-available-with-microstep-drive-16-bit-adc-and-sinusoidal-encoder/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wiring a brushless motor for Galil&#8217;s Sine amplifier</title>
		<link>http://www.galilmc.com/techtalk/drives/wiring-a-brushless-motor-for-galils-sine-amplifier/</link>
		<comments>http://www.galilmc.com/techtalk/drives/wiring-a-brushless-motor-for-galils-sine-amplifier/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 20:21:17 +0000</pubDate>
		<dc:creator>Galil_StephenO</dc:creator>
		
		<category><![CDATA[Drives]]></category>

		<category><![CDATA[Motors]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=188</guid>
		<description><![CDATA[Galil&#8217;s sine commutated amplifiers interface with our DMC motion controllers to create a flexible option for hooking up a motor. In most cases, using the sine drive is easier than setting up commutation with a trap amplifier, and has the ability to still initialize based on hall inputs if desired. This article describes the various [...]]]></description>
			<content:encoded><![CDATA[<p>Galil&#8217;s sine commutated amplifiers interface with our DMC motion controllers to create a flexible option for hooking up a motor. In most cases, using the sine drive is easier than setting up commutation with a trap amplifier, and has the ability to still initialize based on hall inputs if desired. This article describes the various methods of initializing a motor with the sine amplifier. These examples were tested using the DMC-40&#215;0 Accelera series motion controller with the AMP-43540 600W Sine Commutated Drive. The following two methods are discussed below.</p>
<ol>
<li>BZ/BX method</li>
<li>BI Method</li>
</ol>
<p>____________________________________________________________________________________<br />
<strong>BZ/BX method:</strong></p>
<p>This method is the recommended method to initialize the motor, as it requires the least number of steps and provides reliable initialization with the option of minimal movement. Both BZ and BX do not require any additional connections other than the encoder signals to the controller and the motor phases to the drive.</p>
<ol>
<li> Connect the motor and encoder to the DMC controller.</li>
<li> Connect to the controller using Galiltools software. Check encoder position with the TP command and ensure that the encoder is working.</li>
<li> Move the motor manually in the desired positive direction while monitoring TP.
<ul>
<li> If TP is decreasing, issue CE2 to invert the direction. Alternatively, swap A+/A-  encoder leads on a differential encoder, or A/B on a single-ended encoder.</li>
</ul>
</li>
<li> Enable sine amps (BA)</li>
<li> Set brushless modulus (BM. This value is the counts/revolution of the motor divided by the number of pole pairs of the motor. For a linear motor, it is the number of encoder counts per magnetic phase.</li>
<li> Initialize motor (BZ or BX). Ensure that the command voltage for BZ/BX is sufficient to move the motor.
<ul>
<li> If the error &#8220;BZ runaway&#8221; or &#8220;BX failure&#8221; occurs, swap motor leads A and B and reissue BZ/BX.</li>
<li>If the error &#8220;BZ timeout&#8221; occurs, try increasing the timeout time with the BZ&lt;t command. t defaults to 1000msec.</li>
</ul>
</li>
<li> Servo the motor and test commutation by jogging the motor  slowly. If the motor stalls, cogs or runs away, swap motor leads A and B and  re-issue BZ/BX</li>
<li> The motor is now wired for sine commutation using BZ/BX.</li>
</ol>
<p>____________________________________________________________________________________<br />
<strong>BI Method:</strong></p>
<p>BI initialization used the motors hall sensors to initialize the  brushless degrees of the motor. This requires additional steps and  considerations when wiring in order to ensure proper configuration, and is not recommended for most applications. This is useful when dealing with a non-linear load, or when initializing a vertical stage.</p>
<p>To  work, the halls must be wired into the controller along with the motor phases and the encoder signals. The hall inputs must be aligned so that Hall A aligns with Motor A-B, hall  B aligns with Motor B-C, and Hall C aligns with Motor C-A. The halls  must also be counting up when the motor is moving in the positive  direction. Setting up the motor for BI initialization will require  potential wiring changes to both the motor leads and the hall inputs.  The following steps will help ensure that the correct configuration is  reached.</p>
<p><em>Notes: The motor must have standard hall sensors. That means when the  motor is at phase A, hall A is high. If hall A is low when at phase A,  your halls are inverted.</em></p>
<p><em>The AMP-43640 does not support BI-1, but can still support hall initialization using general inputs. See the BI command for more information. To query hall state, use _BCx rather than QH.</em></p>
<ol>
<li> Connect the motor and encoder to the DMC controller.</li>
<li> Connect to controller with Galiltools software. Check encoder position (TP) and Hall State (QH) and ensure that both are changing and connected correctly.</li>
<li> Enable sine amps (BA).</li>
<li> Set brushless modulus (BM). See previous section for explanation.</li>
<li> Move the motor slowly in the desired positive direction while monitoring TP.
<ul>
<li> If TP is decreasing, issue CE2 to account for incorrect encoder  direction. Alternatively, swap A+/A- encoder leads on differential  encoder, or A/B on a single-ended encoder.</li>
</ul>
</li>
<li> Check the hall transitions by monitoring QH/Hall State while  slowly spinning in the positive direction. Halls should be counting in  the following order: 1 3 2 6 4 5
<ul>
<li> If the order is reversed, swap Hall A and C. If you aren&#8217;t getting all 6 states, one of the hall inputs is mis-wired or not connected.</li>
</ul>
</li>
<li> Initialize the motor for hall commutation (BI-1).</li>
<li> Servo the motor and test for closed loop. If motion works, skip to step 9
<ul>
<li> If the motor runs away/stalls, then issue an MO and try initialization  using BZ. If the motor stalls/cogs or runs away after BZ, swap motor phases A and B and retry step 7.</li>
<li>After BZ, check the hall state with QH. If QH shows either of the two values, then rewire the motor  based on the following, and then retry step 7
<ul>
<li> QH=5: Swap Motor AB, then motor BC</li>
<li> QH=6: Swap Motor AC, then motor BC</li>
</ul>
</li>
</ul>
</li>
<li> The motor should now be wired for sine commutation using BI.  Once you have servo control, you can enable sine commutation by issuing  the BC command and commanding a slow Jog move. Once a hall transition is  found, the commutation will be calculated based on the transistion.</li>
</ol>
<p>____________________________________________________________________________________<br />
Galil is here to help you get up and running with our controller and drive as quickly and smoothly as possible. If you have any questions about this, please contact our Applications department at (800)377-6329 or contact support@galilmc.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/drives/wiring-a-brushless-motor-for-galils-sine-amplifier/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Serial Port Command Interpreter</title>
		<link>http://www.galilmc.com/techtalk/dmc-programming/serial-port-command-interpreter/</link>
		<comments>http://www.galilmc.com/techtalk/dmc-programming/serial-port-command-interpreter/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 20:04:33 +0000</pubDate>
		<dc:creator>John Hayes</dc:creator>
		
		<category><![CDATA[DMC Programming]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=187</guid>
		<description><![CDATA[Occasionally, it is beneficial to create a user-defined command set that can be received over the serial port and interpreted at an application program (.dmc) level.  The code below uses the &#8220;Communication Interrupt&#8221; feature of the Galil controller to accept characters over the serial port, parse them, and process specific parts of an on-board dmc [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally, it is beneficial to create a user-defined command set that can be received over the serial port and interpreted at an application program (.dmc) level.  The code below uses the &#8220;Communication Interrupt&#8221; feature of the Galil controller to accept characters over the serial port, parse them, and process specific parts of an on-board dmc program.  The code uses a modified &#8220;prompt&#8221; that is shown as a &#8220;$:&#8221; on the terminal to let the user know they are in a different mode compared to the standard Galil prompt &#8220;:&#8221;.  In this case, the user can enter &#8220;GO&#8221; and the motor will start jogging at the predefined speed.  Entering the string &#8220;STOP&#8221; will cause the motor to stop.  Note - there is a max of six characters when received in the P1ST variable as a string, the P1NM variable is for numeric values and can go up to a 32bit number.  An error handling routine is included such that if an error occurs the code is displayed and the program is restarted.</p>
<p>In the output below, the motor was intentionally shut off using an MO command to cause an error to occur and then turned back on using an SH via Ethernet.  Here is the output from the terminal:<br />
$:<br />
$:GO<br />
Motion Starting<br />
$:STOP<br />
Motion Stopping<br />
$:GO<br />
ERROR  20.0000<br />
$:GO<br />
Motion Starting<br />
$:STOP<br />
Motion Stopping</p>
<p>Here is the .dmc code:</p>
<p>#Main</p>
<p style="margin: 0px; text-indent: 0px;">CI 1,1; &#8216;interrupt on c/r</p>
<p style="margin: 0px; text-indent: 0px;">CW2; &#8216;ASCII readable MG output</p>
<p style="margin: 0px; text-indent: 0px;">#Loop</p>
<p style="margin: 0px; text-indent: 0px;">JP#Loop</p>
<p style="margin: 0px; text-indent: 0px;">EN</p>
<p style="margin: 0px; text-indent: 0px;">#COMINT</p>
<p style="margin: 0px; text-indent: 0px;">JS#PARSE</p>
<p style="margin: 0px; text-indent: 0px;">EN1,1</p>
<p style="margin: 0px; text-indent: 0px;">#PARSE</p>
<p style="margin: 0px; text-indent: 0px;">&#8216;routine to parse input</p>
<p style="margin: 0px; text-indent: 0px;">str=P1ST;</p>
<p style="margin: 0px; text-indent: 0px;">IF (str=&#8221;GO&#8221;)</p>
<p style="margin: 0px; text-indent: 0px;">JS#GO</p>
<p style="margin: 0px; text-indent: 0px;">ENDIF</p>
<p style="margin: 0px; text-indent: 0px;">IF (str=&#8221;STOP&#8221;)</p>
<p style="margin: 0px; text-indent: 0px;">JS#STOP</p>
<p style="margin: 0px; text-indent: 0px;">ENDIF</p>
<p style="margin: 0px; text-indent: 0px;">MG{P1}&#8221;$:&#8221;{N}</p>
<p style="margin: 0px; text-indent: 0px;">EN</p>
<p style="margin: 0px; text-indent: 0px;">#GO</p>
<p style="margin: 0px; text-indent: 0px;">JG 1000; BGA;</p>
<p style="margin: 0px; text-indent: 0px;">MG{P1}&#8221;Motion Starting&#8221;</p>
<p style="margin: 0px; text-indent: 0px;">EN</p>
<p style="margin: 0px; text-indent: 0px;">#STOP<br />
STX;</p>
<p style="margin: 0px; text-indent: 0px;">MG{P1}&#8221;Motion Stopping&#8221;</p>
<p style="margin: 0px; text-indent: 0px;">EN</p>
<p style="margin: 0px; text-indent: 0px;">#CMDERR</p>
<p style="margin: 0px; text-indent: 0px;">MG{P1}&#8221;ERROR &#8220;,_TC1</p>
<p style="margin: 0px; text-indent: 0px;">ZS</p>
<p style="margin: 0px; text-indent: 0px;">JP#Main</p>
<p style="margin: 0px; text-indent: 0px;">RE</p>
<p style="margin: 0px; text-indent: 0px;">
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/dmc-programming/serial-port-command-interpreter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;Infinite&#8221; Array Record over Ethernet</title>
		<link>http://www.galilmc.com/techtalk/software/infinite-array-record-over-ethernet/</link>
		<comments>http://www.galilmc.com/techtalk/software/infinite-array-record-over-ethernet/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 01:27:07 +0000</pubDate>
		<dc:creator>Galil_DJR</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=186</guid>
		<description><![CDATA[This article provides a sample project demonstrating a method to record indefinitely from a controller by uploading subsets of data from a free running circular array record using the RC/RD/RA commands.
With this method, only the host PC&#8217;s hard drive is the limiting factor for the amount of data that can be stored.

Concepts

Lowered TM
Array Record, RC/RD/RA
Array [...]]]></description>
			<content:encoded><![CDATA[<p>This article provides a sample project demonstrating a method to record indefinitely from a controller by uploading subsets of data from a free running circular array record using the RC/RD/RA commands.</p>
<p>With this method, only the host PC&#8217;s hard drive is the limiting factor for the amount of data that can be stored.</p>
<p><img src="http://galilmc.com/ftp/pub/techtalkfiles/infinitearrayrecord.png" alt="Example Screen Cap" width="339" height="171" /></p>
<p><strong>Concepts</strong></p>
<ul>
<li>Lowered TM</li>
<li>Array Record, RC/RD/RA</li>
<li>Array upload via QU command</li>
</ul>
<p><strong>Details/Special Instructions</strong></p>
<ul>
<li>VB 2010 Express, Console App</li>
<li>GalilTools 1.6.0.460</li>
<li>Install GalilTools before using Demo (This installs and registers the Galil COM component)</li>
<li>This Demo was tested on a 4123 and uses TM125 and an array of 16000 elements. This provides a sampling frequency of 4 KHz.</li>
<li>A &#8220;Verify&#8221; project is included to read in large files and verify all data was captured without dropped samples. This project can be used as a starting point for dealing with the file output of the &#8220;infinite&#8221; array.</li>
</ul>
<p><strong><a href="http://www.galilmc.com/ftp/pub/techtalkfiles/infinitearrayrecord.zip">Download</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/software/infinite-array-record-over-ethernet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dual TCP Message Channels on Ethernet</title>
		<link>http://www.galilmc.com/techtalk/software/dual-tcp-message-channels-on-ethernet/</link>
		<comments>http://www.galilmc.com/techtalk/software/dual-tcp-message-channels-on-ethernet/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 01:34:42 +0000</pubDate>
		<dc:creator>Galil_DJR</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=185</guid>
		<description><![CDATA[This article provides a sample project using the GalilTools COM library for setting up two TCP message handles. Using such an approach, Embedded DMC code can send data to two channels (for example a data storage channel and a user interface channel).

Concepts

unsolicited messages over TCP (in lieu of default UDP)
the onMessage() event
routing messages with the [...]]]></description>
			<content:encoded><![CDATA[<p>This article provides a sample project using the GalilTools COM library for setting up two TCP message handles. Using such an approach, Embedded DMC code can send data to two channels (for example a data storage channel and a user interface channel).</p>
<p><img src="http://www.galilmc.com/ftp/pub/techtalkfiles/dualmessagechannels.png" alt="Image of Application" width="542" height="235" /></p>
<p><strong>Concepts</strong></p>
<ul>
<li>unsolicited messages over TCP (in lieu of default UDP)</li>
<li>the onMessage() event</li>
<li>routing messages with the {En} notation in the MG command</li>
<li>moving remote handles with the HS command</li>
<li>multiple GalilTools COM objects</li>
<li>connecting with special options</li>
</ul>
<p><strong>Details/Special Instructions</strong></p>
<ul>
<li>VB 2010 Express</li>
<li>GalilTools 1.6.0.460</li>
<li>Install GalilTools before using Demo (This installs and registers the Galil COM component)</li>
<li>3 Ethernet handles are required for this approach. This demo requires an 8 handle controller because it configures the message handles to G and H.</li>
</ul>
<p><strong><a href="http://www.galilmc.com/ftp/pub/techtalkfiles/dualmessagechannels.zip">Download</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/software/dual-tcp-message-channels-on-ethernet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using GalilTools COM library to receive messages with read()</title>
		<link>http://www.galilmc.com/techtalk/software/using-galiltools-com-library-to-receive-messages-with-read/</link>
		<comments>http://www.galilmc.com/techtalk/software/using-galiltools-com-library-to-receive-messages-with-read/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 23:45:12 +0000</pubDate>
		<dc:creator>Galil_DJR</dc:creator>
		
		<category><![CDATA[DMC Programming]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[COM library]]></category>

		<category><![CDATA[galiltools]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=184</guid>
		<description><![CDATA[The GalilTools COM library provides event-driven functions for asynchronous controller data. One of the more popular events is the onMessage() function which runs automatically whenever a message is received from the controller. This data usually comes from controller embedded code using the MG command.
There are times, however, when the onMessage() function is not desirable. This [...]]]></description>
			<content:encoded><![CDATA[<p>The GalilTools COM library provides event-driven functions for asynchronous controller data. One of the more popular events is the onMessage() function which runs automatically whenever a message is received from the controller. This data usually comes from controller embedded code using the MG command.</p>
<p>There are times, however, when the onMessage() function is not desirable. This can be due to a programming environment&#8217;s lack of support or inconvenient implementation of events. It can also be due to a programmer&#8217;s desire to use strictly procedural programming and skip over the use of events.</p>
<p>When using Ethernet-based communications there is a simple method for opening an extra connection and using the read() function to receive messages waiting in the driver&#8217;s input buffer. The example below takes this approach one step further and opens up yet another connection to the controller to receive a second channel of messages. With the following example there are two streams of messages which can be used, for example, for data collection and for user messages.</p>
<p>The code running on the controller can decide where to send the data with the brace routing notation, for example:</p>
<pre>MG"I am G"{EG};' Sends data to channel one (m1)
MG"I am H"{EH};' Sends data to channel two (m2)</pre>
<hr />The following is the VB code that demonstrates the method for receiving MG messages via read().</p>
<pre>Module Module1
    Sub Main()
        'Command and response handle
        Dim g As New Galil.Galil
        g.address = "192.168.1.5 -mg 0 -ei 0 -dr 0"

        'message handle one
        Dim m1 As New Galil.Galil
        m1.address = "192.168.1.5 -s"
        m1.command("HSS=G") 'set this handle to handle G. This object will receive messages of the form MG"The Message"{EG}

        'message handle two
        Dim m2 As New Galil.Galil
        m2.address = "192.168.1.5 -s"
        m2.command("HSS=H") 'set this handle to handle H. This object will receive messages of the form MG"The Message"{EH}

        g.command("CW2") 'Do not set most significant bit of messages. Read() reads raw, so we don't want this flag
        g.programDownload("MG""I am G""{EG};MG""I am H""{EH};WT1000;JP0;EN") 'sample program
        g.command("XQ") 'start the program

        Console.WriteLine(g.connection)
        Dim string1 As String = ""
        Dim string2 As String = ""
        Dim timer As New Stopwatch
        timer.Start()
        While (timer.Elapsed.Seconds &lt; 5)
            string1 = m1.read()
            If string1.Count &lt;&gt; 0 Then
                Console.WriteLine("m1 read " + string1.Count.ToString + " bytes" + vbCrLf + string1)
            End If
            string2 = m2.read()
            If string2.Count &lt;&gt; 0 Then
                Console.WriteLine("m2 read " + string2.Count.ToString + " bytes" + vbCrLf + string2)
            End If
        End While
        timer.Stop()
        g.command("ST")
    End Sub
End Module</pre>
<hr />Here is the program output</p>
<pre>192.168.1.5 -ei 0 -mg 0 -dr 0, DMC4040 Rev 1.1d1, 5254, IHB
m1 read 8 bytes
I am G

m2 read 8 bytes
I am H

m1 read 8 bytes
I am G

m2 read 8 bytes
I am H

m1 read 8 bytes
I am G

m2 read 8 bytes
I am H

m1 read 8 bytes
I am G

m2 read 8 bytes
I am H

m1 read 8 bytes
I am G

m2 read 8 bytes
I am H

m1 read 8 bytes
I am G

m2 read 8 bytes
I am H</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/software/using-galiltools-com-library-to-receive-messages-with-read/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Example- Communicating with OPTO-22 SNAP-B3000-ENET</title>
		<link>http://www.galilmc.com/techtalk/io-control/example-communicating-with-opto-22-snap-b3000-enet/</link>
		<comments>http://www.galilmc.com/techtalk/io-control/example-communicating-with-opto-22-snap-b3000-enet/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 19:28:09 +0000</pubDate>
		<dc:creator>Galil_AndyH</dc:creator>
		
		<category><![CDATA[DMC Programming]]></category>

		<category><![CDATA[I/O Control]]></category>

		<category><![CDATA[I/O]]></category>

		<category><![CDATA[I/O controller]]></category>

		<category><![CDATA[opto22]]></category>

		<category><![CDATA[plc]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=183</guid>
		<description><![CDATA[This is a section of commonly found in the controller user manuals.
Controller is connected to OPTO-22 via handle F.  The OPTO-22’s IP address is 131.29.50.30.  The Rack has the following configuration:
 Digital Inputs		Module 1
 Digital Outputs		Module 2
 Analog Outputs (+/-10V)	Module 3
 Analog Inputs (+/-10V)	Module 4







  



Instruction


Interpretation




#CONFIG


Label




IHF=131,29,50,30&#60;502&#62;2


Establish connection




WT10


Wait 10 milliseconds




JP #CFGERR,_IHF2=0


Jump to subroutine




JS [...]]]></description>
			<content:encoded><![CDATA[<p>This is a section of commonly found in the controller user manuals.</p>
<p class="western" style="0.04in;"><span style="Times New Roman,serif;"><span style="x-small;">Controller is connected to OPTO-22 via handle F.  The OPTO-22’s IP address is 131.29.50.30.  The Rack has the following configuration:</span></span></p>
<p class="western" style="0.04in;"><span style="Times New Roman,serif;"><span style="x-small;"> Digital Inputs		Module 1</span></span></p>
<p class="western" style="0.04in;"><span style="Times New Roman,serif;"><span style="x-small;"> Digital Outputs		Module 2</span></span></p>
<p class="western" style="0.04in;"><span style="Times New Roman,serif;"><span style="x-small;"> Analog Outputs (+/-10V)	Module 3</span></span></p>
<p class="western" style="0.04in;"><span style="Times New Roman,serif;"><span style="small;"><span style="Times New Roman,serif;"><span style="x-small;"> Analog Inputs (+/-10V)	Module 4</span></span></span></span></p>
<p class="western">
<dl>
<dl>
<dl>
<dl>
<dd>
<table border="0" cellspacing="0" cellpadding="0" width="510">
<colgroup><col width="186"></col> <col width="324"></col> </colgroup>
<tbody>
<tr valign="TOP">
<td width="186">
<p style="0.04in;"><span style="Times New Roman,serif;"><strong>Instruction</strong></span></p>
</td>
<td width="324">
<p style="0.04in;"><span style="Times New Roman,serif;"><strong>Interpretation</strong></span></p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CONFIG</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">IHF=131,29,50,30&lt;502&gt;2</p>
</td>
<td width="324">
<p class="code-text-western">Establish connection</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">WT10</p>
</td>
<td width="324">
<p class="code-text-western">Wait 10 milliseconds</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JP #CFGERR,_IHF2=0</p>
</td>
<td width="324">
<p class="code-text-western">Jump to subroutine</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JS #CFGDOUT</p>
</td>
<td width="324">
<p class="code-text-western">Configure digital outputs</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JS #CFGAOUT</p>
</td>
<td width="324">
<p class="code-text-western">Configure analog outputs</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JS #CFGAIN</p>
</td>
<td width="324">
<p class="code-text-western">Configure analog inputs</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MBF = 6,6,1025,1</p>
</td>
<td width="324">
<p class="code-text-western">Save configuration to OPTO-22</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">EN</p>
</td>
<td width="324">
<p class="code-text-western">End</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">
</td>
<td width="324">
<p class="code-text-western">
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFGDOUT</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MODULE=2</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">CFGVALUE=$180</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">NUMOFIO=4</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JP #CFGJOIN</p>
</td>
<td width="324">
<p class="code-text-western">Jump to subroutine</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">
</td>
<td width="324">
<p class="code-text-western">
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFGAOUT</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MODULE=3</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">CFGVALUE=$A7</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">NUMOFIO=2</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JP #CFGJOIN</p>
</td>
<td width="324">
<p class="code-text-western">Jump to subroutine</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">
</td>
<td width="324">
<p class="code-text-western">
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFGAIN</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MODULE=5</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">CFGVALUE=12</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">NUMOFIO=2</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JP#CFGJOIN</p>
</td>
<td width="324">
<p class="code-text-western">Jump to subroutine</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">
</td>
<td width="324">
<p class="code-text-western">
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFGJOIN</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">DM A[8]</p>
</td>
<td width="324">
<p class="code-text-western">Dimension array</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">I=0</p>
</td>
<td width="324">
<p class="code-text-western">Set variable</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFGLOOP</p>
</td>
<td width="324">
<p class="code-text-western">Loop subroutine</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">A[I]=0</p>
</td>
<td width="324">
<p class="code-text-western">Set array element</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">I=I+1</p>
</td>
<td width="324">
<p class="code-text-western">Increment</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">A[I]=CFGVALUE</p>
</td>
<td width="324">
<p class="code-text-western">Set array element</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">I=I+1</p>
</td>
<td width="324">
<p class="code-text-western">Increment</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">JP #CFGLOOP,I&lt;(2*NUMOFIO)</p>
</td>
<td width="324">
<p class="code-text-western">Conditional statement</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MBF=6,16,632+(MODULE*8),NUMOFIO*2,A[]</p>
</td>
<td width="324">
<p class="code-text-western">Configure I/O using Modbus 							function code 16 where the starting register is 							632+(MODULE*8), number of registers is NUMOFIO*2 and A[] 							contains the data.</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">EN</p>
</td>
<td width="324">
<p class="code-text-western">end</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">
</td>
<td width="324">
<p class="code-text-western">
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">#CFERR</p>
</td>
<td width="324">
<p class="code-text-western">Label</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">MG”UNABLE TO ESTABLISH 							CONNECTION”</p>
</td>
<td width="324">
<p class="code-text-western">Message</p>
</td>
</tr>
<tr valign="TOP">
<td width="186">
<p class="code-text-western">EN</p>
</td>
<td width="324">
<p class="code-text-western">End</p>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dl>
</dl>
</dl>
<p class="western" style="0in;">
<p class="western">Using the equation:</p>
<p class="western">I/O number = (Handlenum*1000) + ((Module-1)*4) + (Bitnum-1)</p>
<p class="western"><span style="Courier New,monospace;"><span style="xx-small;"><span><span style="x-small;">MG @IN[6001]</span></span></span></span> display level of input at handle 6, module 1, bit 2</p>
<p class="western"><span style="Courier New,monospace;"><span style="xx-small;"><span><span style="x-small;">SB 6006</span></span></span></span> set bit of output at handle 6, module 2, bit 3</p>
<p class="western">or 	to one</p>
<p class="code-text-western" style="0.2in;"><span style="x-small;">OB 6006,1</span></p>
<p class="western"><span style="Courier New,monospace;"><span style="xx-small;"><span><span style="x-small;">AO 608,3.6</span></span></span></span> set analog output at handle 6, module 53, bit 1 to 3.6 volts</p>
<p class="western"><span style="Courier New,monospace;"><span style="xx-small;"><span><span style="x-small;">MG @AN[6017]</span></span></span></span> display voltage value of analog input at handle6, module 5, bit 2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/io-control/example-communicating-with-opto-22-snap-b3000-enet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using socket TCP/IP or UDP communication with Galil controllers</title>
		<link>http://www.galilmc.com/techtalk/software/using-socket-tcpip-or-udp-communication-with-galil-controllers/</link>
		<comments>http://www.galilmc.com/techtalk/software/using-socket-tcpip-or-udp-communication-with-galil-controllers/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 18:43:53 +0000</pubDate>
		<dc:creator>John Hayes</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<category><![CDATA[Ethernet]]></category>

		<category><![CDATA[galiltools]]></category>

		<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://www.galilmc.com/techtalk/?p=182</guid>
		<description><![CDATA[For most applications, the standard GalilTools communication libray or API (Application Programming Interface) provides the best method of communicating from either a Windows or Linux computer to a Galil controller.  The GalilTools communication library provides calls such as  &#8220;Command()&#8221; and &#8220;ProgramDownload()&#8221; that provide a wrapper to make it easier for a programmer to get up [...]]]></description>
			<content:encoded><![CDATA[<p>For most applications, the standard GalilTools communication libray or API (Application Programming Interface) provides the best method of communicating from either a Windows or Linux computer to a Galil controller.  The GalilTools communication library provides calls such as  &#8220;Command()&#8221; and &#8220;ProgramDownload()&#8221; that provide a wrapper to make it easier for a programmer to get up and running in their language of choice (C#, C++, VB, LabVIEW, etc&#8230;).  The GalilTools communication library handles the lower level driver functions and communication protocols so that the programmer doesn&#8217;t have to.  However, there are some situations in which it is necessary or required to communicate to a Galil controller without using the GalilTools communication library.  This article will discuss what a user should be aware of when creating their own communication interface.</p>
<p><strong>Part I - Standard Communication</strong></p>
<p><strong> </strong></p>
<p><strong>1) Opening a Socket</strong></p>
<p>Most programming languages that have an Ethernet interface have an &#8220;OpenSocket&#8221; type of function that will handle establishing the UDP or TCP/IP connection.  The arguments will usually be the IP address of the device you are connecting to as well as a port number.  For a standard connection to a Galil controller, the user should connect on port number 23 (Telnet).  Other port numbers are allowed such as those above port 1000 when needed for special applications.  See the IK command for more info.</p>
<p><strong>2) Sending a Command</strong></p>
<p>Once a socket is established, the user will need to send a Galil command as a string to the controller (via the opened socket) followed by a Carriage return (0&#215;0D).</p>
<p><strong>3) Receiving a Response</strong></p>
<p>The controller will respond to that command with a string.  The response of the command depends on which command was sent.  In general, if there is a response expected such as the &#8220;TP&#8221; Tell Position command.  The response will be in the form of the expected value(s) followed by a Carriage return (0&#215;0D), Line Feed (0&#215;0A), and a Colon (:).  If the command was rejected, the response will be just a question mark (?) and nothing else.  If the command is not expected to return a value, the response will be just the Colon (:).</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>4) Closing the Socket</strong></p>
<p>The socket should be left open during general operation to send/receive commands.  In order to close the connection, the programming language should have a &#8220;CloseSocket&#8221; that will close the TCP/IP connection to the controller.</p>
<p><strong>Notes:</strong></p>
<p>1) A single command should not exceed 80 characters, however multiple commands can be grouped together in a single packet by separating them with semicolons.</p>
<p>2) Packet size should not exceed 450bytes</p>
<p>3) See the Appendix of the Application Note to see example packets of sending commands and receiving responses</p>
<p>For the complete Application Note including part 2 on Advanced Communication, go here:</p>
<p><a href="http://www.galilmc.com/support/appnotes/software/note4434.pdf">http://www.galilmc.com/support/appnotes/software/note4434.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.galilmc.com/techtalk/software/using-socket-tcpip-or-udp-communication-with-galil-controllers/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

