Home
pmacpanel user manual
Contents
1. Note that several of these values are redundant To do a software controlled position capture preset this parameter to 0 or 4 when the parameter is then changed to 8 or 12 the capture is triggered this is not of much practical use Encoder I Variable 3 Capture Flag This parameter determines which of the Flag inputs will be used for position capture if one is used see 1902 etc Setting Meaning 0 HMFLn Home Flag n 1 LIMn Negative Limit Signal n 2 LIMhn Positive Limit Signal n Chapter 7 Homing Encoders and Position Capture 3 FAULTn Amplifier Fault Signal n This parameter is typically set to zero because in actual use the LIMn and FAULTn flags create other effects that usually interfere with what is trying to be accomplished by the position capture If you wish to capture on the LIMn or FAULTn flags you must either disable their normal functions with Ix25 or use a channel n where none of the flags is used for the normal axis functions The VI for the cluster is e PmacEncoderlVarCapture Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the Encoder I Variables for the specified Encoder Number are set Otherwise they are fetched from PMAC and provided by Output Encoder I Capture Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 132 0 Ce eee Me fea ee peceecerereee Her Output Bool F Encoder Number 132 1
2. Chapter 7 Homing Encoders and Position Capture 153 Motor positions will now be referenced to a new encoder zero position plus or minus any axis offset in the axis definition statement If the axis definition 1s 1 gt 10000X 3000 the home position will be reported as 3000 counts If software over travel limits are used 1x13 Ix14 not equal to zero they are re enabled at this time after having been disabled during the search for the trigger The trajectory to the new zero position 1s calculated using deceleration and reversal if necessary Note that if a software limit is too close to zero the motor may not be able to stop and reverse before it hits the limit The motor will stop under position control with its commanded position equal to the home position If there is a following error the actual position will be different by the amount of the following error Home Complete If you are monitoring the motor from a PLC program or PMACPanel to see if it has finished the homing move it is best to look at the home complete and desired velocity zero motor status bits The home complete bit is set to FALSE on power up and reset it is also set to FALSE at the beginning of a homing search move even if a previous homing search move was completed successfully Itis set to TRUE as soon as the trigger is found in a homing search move before the motor has come to a stop The home search in progress bit is simply the inverse of
3. 46 Proac Error Last Command 1 ERAROUS Data eror or unrecognized command Solutio Corect syntax of command The error dialog appears because the command string 1J is unrecognizable to PMAC The correct syntax for the command is 1j When error dialogs appear you have the choice of aborting your application or continuing Commands that generate errors are not executed by PMAC and cause no harm However if your application logic continually attempts to send a bad command to PMAC you may have no choice but to abort the application Otherwise you may continue to get this dialog repeatedly Your chances of halting the program using the standard LabVIEW STOP button before your application attempts to send the offending command again is unlikely A complete listing of PMAC error codes can be found in the PMAC User Manual and PMAC Software Reference Manual The diagram for this tutorial demonstrates two basic things you must consider when designing you application If you send commands to PMAC in response to an interface button click the mechanical action of the button should be latched and the PMACPanel VI that sends the command should be in a Case structure Otherwise the command will be sent every iteration of the loop PmacCommRespStr and PmacCommGetStr indicate whether they received a response using Response Available Response String will be the Empty String if nothing was received It is generally good
4. The important thing to note about this VI is that eight commands are executed by PMAC A lt CR gt separates the individual commands in the command string 85 PmacGlobal ICVs 86 Device Number 132 0 utput Device Number 132 0 String This series of exercises introduce the PmacGlobal collection of ICVs These allow you to control monitor and configure PMAC s global characteristics PmacTutor11 Configuring PMAC s Global State This exercise introduces a number of indicators controls and VIs for controlling and monitoring PMAC s general operational characteristics This is done using status indicators a simple control cluster for sending PMAC commands and a few clusters for configuring I Variables In general these capabilities are used for supervisory purposes and not exposed to general users The architecture for PmacGlobal CVs follows those already introduced The basics are introduced with these six VIs and their cousins PmacGlobalBufferSize Monitor and control PMAC buffer space during system development Buffers Open is TRUE if an open prog open rotary or open PLC command has been executed and the corresponding buffer has not been closed yet Available Buffer Memory specifies how much buffer space PMAC has left for gathering and programs A define gather command reserves all available buffer space If Close Buffers is TRUE the gather buffer is deleted and a close command is sent to PMAC Devic
5. ait p l Begin Run Step Prog Hold Jog To operate the tool select a program using the menu ring and a coordinate system to execute the program in using the knob Only loaded programs are shown in the ring Clicking Begin and the Program Execute cluster loads the program into the list buffer from PMAC If you click Run the program will begin executing You can watch the execution by clicking the cursor in the screen The currently executing program line will highlight and track the program through its steps This dynamic display only works when the cursor is in the screen You should understand a few issues about PMAC program execution PMAC pre computes moves several lines ahead of the currently executing motion to allow motion blending Because of this the hi lighted line may not reflect the moves your machine is currently executing For a detailed discussion of this see the PMAC User Manual The implementation of the tool uses two VIs to generate program execution commands and monitor the currently executing program line These VIs are Chapter 5 Development Tools 119 e PmacProgExec Interactively execute the program specified in Program VI State Cluster in response to button clicks in Program Execute Control Cluster New Program is TRUE when Begin is clicked and Program List Cluster contains a new listing Command Executed is TRUE when any button in Program Execute Control Cluster is clicked Device Number i3
6. define MOTOR MAX 8 define BUFFER MAX 512 int32 BufferCount MOTOR MAX int32 ServoTimer MOTOR MAX BUFFER MAX int32 DAC MOTOR MAX BUFFER MAX int32 Move Time MOTOR MAX BUFFER MAX floate4 Commanded Position MOTOR MAX BUFFER MAX floato4 Position MOTOR MAX BUFFER MAX floato4 Velocity MOTOR MAX BUFFER MAX float64 Following Error MOTOR MAX BUFFER MAX floato4 Master Position MOTOR MAX BUFFER MAX fFloate4 Compensation Position MOTOR MAX BUFFER MAX LH os CIN MOET CINRurm int32 Device Number 132 0 y Int32 Movor Number 132 A o Ly Ineo ABUTIS Benge 2352 264 TDL DPR Real Time Vector Cluster LVBoolean ValidData imio DevNum Device Number 132 0 ance VNU MOto Number 197 1 Gol Ly int BCount BufferCount MNum int SizeL Sized Tell PMAC we re doing our thing PmacDPRSetHostBusyBit DevNum 1 Check if PMAC is busy doing its thing if PmacDPRGetPmacBusyBit DevNum Get Servo timer ServoTimer MNum BCount PmacDPRGetServoTimer DevNum Tx TF this 2S the first element of a new butter OR its not the first element of a buffer AND the current servo timer value is not equal to last measurement THEN fetch the DPR data into the proper buffer elements if BCount 0 BCount gt 0 amp amp ServoTimer MNum BCount 1 ServoTimer MNum BCount Commanded Position MNum BCount PmacDP
7. hen Program State Cluster indicates the program Program Run Bool F 3 grenannnannnate PAASEIEREN T or grd BUF TaN J iaacaacasaassassasanssns ss assiieiiniiniinin ev F Convert To Coordinate SRS ERE pa i Coord Defs 3 E Coord 1 T i m W i Capo re H 7 i Loo oy coo 3 Determine Coord Prog 4 Program Wl State Clusterjf Ei jthe state of State Program File Path Edit 2 cacti i penen the Vi t anel Hotor Positions Sa i ggg oh yaa ry te hha Mots LJ SEPARERTE Pos i Sa aa e aeg e aa ae r rororor rar r raror SRE Eor Input PQM Yarant Arra Tal Output PQH Yariant Arra Hew Output Bool F Program Running Bool F Panel Show Bool F Program Listing 7 a Execute the Yla in the this case RR Ra ba aR ba haba hana yh ba yh ba yh hahha ys ha ey han shag ONLY when the 1 anel i open E Frog pe Selection mE Scroll Position lOpen the YI panel Programm Listing To hide many nasty details from the user the VI maintains a Program VI State Cluster When the VI executes the first time the Program Loaded item in the cluster is FALSE Hence the program execution case on the left can t execute the large case does and the program is downloaded thereby updating the Program VI State Cluster indicating that the program is loaded the program number and associated coordinate system At this point the VI is knows everything it needs to r
8. Dual Ported RAM e 209 PmacDPRSetHostBusyBit DevNum 1 Check if PMAC is busy doing its thing if PmacDPRGetPmacBusyBit DevNum Fetch all of the available data DER Real Time Motor Clusler Poervorimer 132 PmacDPRGetServoTimer DevNum DPR Real Time Motor C luster Molor ACtivyated PmacDPRMotorEnabled DevNum MNum 0 LVFALSE LVTRUE ServoStatus Fetch cluster and then individual items ServoStatus PmacDPRMotorServoStatus DevNum MNum DPR Real Time Servo Cluster gt Home In Progress Vervootatus home search 0 2 LVEALSE LVTRUE Th ValidData LVTRUE Jy New Gata tor caller else xValidData LVFALSE Sorry no new data PmacDPRSetHostBusyBit DevNum 0 PMAC can do its thing return noErr If you check the PComm32 Reference Manual you will see that the checking and setting of the DPR Busy Bit is required by PMAC When the unfilled CIN node stub was created LabVIEW generously declared the CINRun parameter order names and data types CINRun s job is to fetch DPR data from PMAC using the PComm32 functions and fill the LabVIEW data types passed by the caller with the data Itis actually very simple The parameters DPR Real Time Servo Cluster and DPR Real Time Motor Cluster are pointers to the data types provided by LabVIEW Calls are placed to PComm32 and data of the proper type is assigned to the members of the data types There is one cat
9. Microsoft Software Certain PMACPanel capabilities are implemented with compiled C code These operate perfectly as is Should you desire to modify them to suit your requirements or add other CINs for specific reasons you need Microsoft Visual C 5 0 or Microsoft Visual C 6 0 PMACPanel does not directly support other compilers However a talented SW engineer can make the required project modifications for other compilers in short order PMAC Options for PMACPanel PMACPanel supports a wide range of PMAC s capabilities Some of these require the purchase of additional Delta Tau hardware and software accessories These options include e PMAC s Dual Ported RAM This is required to utilize the PmacDPR collection of VIs e PComm32 Complete PMAC device driver PMACPanel provides a version of the complete driver with reduced capabilities Tailoring of some PMACPanel capabilities may require the complete Pcomm32 release e Various PMAC I O and accessory options Technical Documentation Chapter 2 Getting Started The PMACPanel User Manual included with this package 1s available in electronic form on the CD The Microsoft Word document is located in the Documentation directory The PMAC User Manual and PMAC Software Reference Manual should have been provided with your PMAC These references are absolutely necessary for any PMAC development effort If you will be modifying PMACPanel VIs that utilize DPR you need the Pc
10. PmacProgSubVI 136 This chapter introduces a variety of VIs and tools to seamlessly integrate PMAC motion programs into your PMACPanel application In Chapter 5 we introduced PmacTerminalEdit This tool allows you to develop new motion or PLC programs or modify existing programs and with the click of a button create a VI wrapper for the program In this chapter we cover the details of the wrapper and introduce the PmacPQM collection of VIs These provide an interface to directly tie controls and indicators in your application panels to motion program variables We introduced this VI in Chapter 5 but do so again because we re going to cover it in more detail e PmacProgSubVI PmacProgSubVICreate makes a copy of this VI with a new name that matches the name of a motion program Because the motion program has the same name with a different extension this VI knows how to open parse load and run a motion program without intervention or extra inputs It allows you to edit the associated program and interactively execute the program Details of its implementation are contained in the manual The VI downloads the associated program when first loaded unless this option is disabled in the diagram and defaults for Program Number and Coord Number are provided for the Program VI State Cluster The interactive panel can be opened and used by setting Panel Show latched TRUE See the documentation for PmacTerminalEdit and PmacTerminalExecute f
11. Velocity Dbl m EJ m n PETTI a ra L Soe m Ea Comm d Pos Dbl i Time Move 2 gt EEA Iteration Timer m O eaen Ji EJ E e PmacDPRFixedBackVectors Once DPR Fixed Background buffer operation is enabled this VI can be used to fetch the data for a specific Motor Number and Coord Number The input Enabled can be used to enable and disable the actual fetch The Default un wired condition 1s TRUE Coord Axis Char is a string X Y Z A B C U V W indicating which axis in Coord Number Comm d Pos will represent When New Output is TRUE DPR Fixed Motor Cluster and DPR Fixed Coordinate Cluster contain the most recent background data When Enabled is FALSE the two output clusters contain the last valid data even though New Output is FALSE Device Number 132 0 Enabled Bool T Buffer Length 2 32 Hotor Number 132 1 8 1 Coord Number 132 1 8 1 Coord Asis Char New Output Bool DPR Fised Motor Vector Cluster x DPR Fised Coordinate Vector We will not discuss the details of the CINs associated with each VI They are very similar to those presented for their cousins in the PmacDPRRealTime collection Specific details are contained in source code comments PmacDPRNumeric PMAC s architecture permits access to any unused DPR memory for whatever purposes you desire using M Variables These may be scratch registers or in the case of DPR registers through which you can pass data between the host an
12. e Jog Pop a jog panel up to allow motor jogging after a Prog Hold The jog panel must be closed before the panel before you can return to this panel to restart the program with Run or Step Closing the panel returns all jogged motors to their pre jog position with j Commands sent to PMAC are generated from the panel e Feed Hold Bring the coordinate system velocity to zero thereby holding moves where they are You cannot jog from this mode You can restart the program with Run or Step The command sent to PMAC is H e Abort Decelerate all motors immediately You can restart the program with Run or Step The command sent to PMAC is A See the safety notes for the command in the PMAC Software Reference Manual e Halt Q Quit the program at the end of the current move or any already calculated moves You can restart the program with Run or Step The command sent to PMAC is Q e Halt Quit the program at the end of the currently executing move You can restart the program with Run or Step The command sent to PMAC 1s PmacTerminalMotors This tool is based on PmacTutor10 that introduced the PmacMotors CVs Its purpose is to allow you to monitor selected motor motions from the terminal The arrays of indicators function as introduced in the earlier tutorial You can select a coordinate system and enable C S conversion for motors defined in the specified coordinate system Motors selected in Plot Select are displayed
13. 106 The only modification is the addition of the PmacTerminalMenu VI that actually spawns the new VI in response to a menu selection and the Current VIs Menu function selected for the function palette e PmacTerminalMenu This VI uses the Current VI Menu supplied to it to check for selections Because you may have time critical operations where you don t want to check for selections you can set Enable Menu Track FALSE using a switch to disable the testing This is done in the PmacTerminalMotors tool because the delay causes a noticeable blip in plotted position data Current YI menu Enable Menu Track Bool T e7 Basic Tool VI Configuration When a tool is spawned the Execution and Window options you define for the VI Setup are important The following panel shows the Execution Options used for a PMACPanel tool The panel should be shown when loaded otherwise selecting the tool runs it without a panel not very useful If you call the VI instead of spawn it then you want the Show Front Panel When Called and then closed afterward The problem with calling the VI rather than spawning it is that it must complete before the caller s panel becomes active again Nota flexible system but it maybe what you want Execution Options M Show Front Panel When Loaded Print Panel When Yl Completes Execution J Show Front Panel hen Called Print Header name date page I Close Afterwards if Originally Closed W Scale to Fit When Printi
14. Boolean Short Long etc has three VIs The VIs for accessing Long 132 I Variables are used to illustrate the interface e PmaclIVarSetLong Set the Long I Variable specified by Var Set Number and I Variable Number The variable address is calculated as Var Set Number 100 I Variable Number Var Set Number 0 addresses global I Variables Var Set Numbers from 1 8 address motors and coordinate system I Variables Device Number 32 0 lAa Mar Set Number 132 0 9 0 SLng l Yarable Number 132 0 99 Input Yalue 132 0 e PmaclIVarGetLong Get the Long I Variable specified by IVar Set Number and I Variable Number The variable address is calculated as Var Set Number 100 I Variable Number Var Set Number 0 addresses global I Variables Var Set Numbers from 1 8 address motors and coordinate system I Variables Device Number 132 0 afar S Yar Set Number 132 0 9 0 GLng Response idz Variable Number 132 0 99 Default i32 0 e PmaclIVarLong If Set Get is FALSE or not wired get the Long I Variable specified by Var Set Number and I Variable Number Response Available will be TRUE to indicate Response contains the new value If Set Get is TRUE set the Long I Variable using Input Value Response Available will be FALSE and Response defaults to Input Value The variable address is calculated as Var Set Number 100 I Variable Number Var Set Number 0 addresses global I Variables Var Set Numbers f
15. DPR allows PMAC to communicate with the host computer using memory in a way that significantly increases the speed of communication In addition PMAC firmware has facilities that automatically copy predefined and user defined data into DPR for access by the host In this chapter we introduce the VIs that support this interface Chapter 12 Interrupts PMAC supports the generation of interrupts from various sources This chapter introduces one mechanism for handling PMAC interrupts from LabVIEW Chapter 13 VI Reference This is an exhaustive alphabetical reference defining the operation of every PMACPanel VI control and data type Conventions Used in This Manual The following conventions are used throughout the manual lt ENTER gt Italic text inside arrows is used to represent keyboard lt CTRL F4 gt keys or key combinations Edit Edit Control Dropdown menu selection or mouse operations OPEN PROGRAM Mono spaced is used for code listings PmacDevOpen PMACPanel VI names Bus Addresses Arial bold text is used for dialog box items Dx7FA000 OCR text is used for dialog box entries Laan fk if not observed may cause serious Information which if not observed may cause damage to equipment or software A note concerning special functions or information of special interest Use Caution When Running the Examples PMACPanel has many examples to introduce itself and verify things are working properly You need to be awar
16. Many of the panel clusters should look familiar There are three new indicator clusters associated with homing and a few new ideas associated with PLC program encapsulation In the bottom left is a very large PmacHomel Var cluster that borrows extensively from PmacMotorIVarSafety and PmacMotorIVarMove It adds a new cluster for Encoder I Vars 2 and 3 On the far right 1s an indicator bar that directly displays eight encoder status bits Next to the Motor Number and Coord System knobs is a Home State Cluster This contains data from several I Variables and memory registers that define how motor position is transformed to encoder position The cluster is updated any time the Capture Encoder button is clicked In the top right is a button that Chapter 7 Homing Encoders and Position Capture 155 will toggle the Execution State of the encapsulated PLC program that sets up and executes a homing operation T E r E z E O o O o 025 320 002 O o 5 aie NAE a a f Before going into the individual pieces of this example lets look at the diagram below As usual the execution loop has several motor ICVs and a standard l Variable architecture The PmacEncoderStat VI and cluster monitor the encoder status bits and PmacHomeComplete monitors the execution of homing moves and retrieves the Home State Cluster At the very bottom is the encapsulated PLC program Sub VI 156 Chapter 7 Homing Encoders and Position Capt
17. SStr SStr SSe TEEETELETELELETELETELELELEErIELELELECELELETELELELELCELET nnn Hzdi t i ne qie 2 E GSES EHE HHI z l 3 I DEN EEH og commands are always in encoder counts If the control value i in C S Units convert them Convert To Coordinate Bool If you generate Motor or C S specific commands always send the Motor or C S number along with the command 72 There are a few things to note about the organization of this VI Unbundled command buttons are used in conjunction with a string format VI and PmacButtSendStr to create and send an appropriate command to PMAC The position parameter required by some commands is converted into encoder units if the actual control value is in C S units Using this architecture eliminates many case structures and allows you to add or delete commands as required Using PmacMotorJogControl and its cluster with PmacMotorPVE and its cluster you can quickly add motor jogging and position monitoring on any panel Control Clusters and Local Variables It has already been noted that clusters should contain either indicators or controls but not both This is a generally bad idea in LabVIEW and because PMACPanel uses latched Boolean controls in most of its control clusters an extremely bad idea When a VI reads the state of a latched Boolean control the control is reset Hence if there were two users of the Boolean state the second one to read the state would get the wrong answ
18. The program is then started as long as there 1s no program executing in the associated CS When Program Running is TRUE this or another program 1s executing in the associated CS DeviceNumber 132 0 pree Frogram Running Bool F Program Run Bool F 5 eee Program l State Cluster Panel Show Bool F p See Mew Output Bool F Input PUM Variant Aray 0 eee Output PUM Varnant Array PmacTerminalExecute 118 This tool is an interactive motion program debugger that queries PMAC for the actual program and allows you to step through it in a variety of ways Querying PMAC for the program allows you to see whether your program is actually what you think it is If you down load a program without clearing the program buffer first the down load contents are appended to the existing buffer This is probably not what you want The indicators and their operation should be obvious Extensive on line help is available for the panel controls using LabVIEW s Help Show Help facility Chapter 5 Development Tools Program 32 v Listing Potton Ho Program Running Program Hold Pre Jog Hove CS End OF Block Stop CS Dets Continuous Motion Reg Continuous Motion Mode Run Time Error Warming Following Error Fatal Following Error 5 Amplifi oa Motor Positions cs 1 W C 5 Units YF ER 5 n ni i D LY i 500 T4250 i ii i CLLECLCCCe l j
19. Variable s defined in DPR as M447 gt DP DE03 PMAC handles the translation of PMAC s representation into Intel format when the DP specification is used When Set Get is FALSE default state Response Available is TRUE and Output Value is the value in DPR located at Offset When Set Get is TRUE Output Value Input Value Response Available is FALSE and the specified DPR location 1s set PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 225 The mapping of PMAC addresses to PC addresses is involved and requires a bit of work to understand In general each 24 bit PMAC word requires one 32 bit PC word For PMAC longs specified as M447 gt DP DE03 this offset should be E03 Device Number 132 0 jel DER ee Response Available Bool F EAE E ag Clutput Value i22 Offset P Inout Walue 32 e PmacDPRNumericDbl This VI is used to Set or Get PMAC double M Variable s defined in DPR as M447 gt F DE03 PMAC handles the translation of PMAC s representation into Intel format when the F specification is used Device Number 132 0 rpex L Response Available Bool F ceea ele Asal Output Value Dbl Inout Value Obl e PmacDPRNumericWord This VI is used to Set or Get PMAC long M Variable s defined in DPR as M447 gt DP DE03 where the equivalent intel representation is 16 bits PMAC handles the translation of PMAC s representation into Intel format when the DP speci
20. We will discuss how a Gather Selection list is built in the next section 128 Chapter 5 Development Tools PRP Addr gt pA Mater Gather Yariable AC a altern Names Initialize the gather specification Setup Er Term Menu Gathering E 5 Chapter 5 Development Tools Setup gathering aden from Gather Spec array fy EEE Seana jand start gather If your z peee W program starts the gather i i exclude PmacGatherStait Execute step or motion program j lin sequence a AA i Set Panel Gathering flac 7 21 Samples E olot cluster o N array of doubles IF your program halts gather you don t need PmacGatherStop Gathered data can be FFT d linear fit etc D Plot Color JE preadsheet Fl on Spreadsheet File al Data is actually gathered in this tool when either the Gather Program or the Gather Step buttons are clicked They require the Gather Spec Cluster created by your program or generated by PmacGatherSelect The gather process begins by executing in sequence the following five VIs In the diagram the sequence of operations is located in a case structure e PmacGatherSetup Use the information in Input Gather Spec Cluster to setup a gather operation on PMAC Output Gather Spec Cluster should be wired to PmacGatherStart PmacGatherStop and PmacGatherCollect to sequence operations and so that
21. and CHC1 as the encoder index channel The trigger event that causes the position capture is determined by Encoder I Variables 2 and 3 1902 and 1903 for Encoder 1 Encoder I Variable 2 defines what combination of encoder third channel CHC Index channel transition and encoder flag transition trigger the capture If Encoder I Variable 2 specifies the use of a flag Encoder I variable 3 determines which flag usually the home flag HMFLn Once these have been configured the on line HOME command will use the position capture feature automatically Homing is a PMAC firmware function that automatically performs a number of operations to establish a motor s zero position The homing search move can be executed with the on line HOME command from a PLC program using COMMAND HOME or a motion program HOME statement However the HOME command is issued x23 specifies the move s speed and direction If x23 is greater than zero the homing search move will be positive If it is less than zero the move is negative The acceleration for a homing search move is controlled by the same parameters I x19 Ix20 and Ix21 as jogging moves Action on Trigger During the homing search move PMAC firmware waits for the hardware trigger When the trigger occurs PMAC reads the position at the time of capture usually the hardware capture register and uses it and the Ix26 home offset parameter to compute the associated motor s new encoder zero position
22. defined in the CS Input Value is assumed to be motor position in encoder counts and Output Value is encoder position If the motor 1s defined and Convert is TRUE Coord Defined 1s TRUE and Output Value is scaled from CS units to encoder position Chapter 8 Encoder Capture and Compare Operation Device Number i32 0 oo gen SEEE Coord Specify Cluster gord L enned Boo Capture Offset Bool F Input Yalue Double Output Value Double The diagram fetches and processes the encoder position two VIs that implement the position transformations just discussed PmacEncoderRegServo covered later fetches the encoder position not capture positions directly from the encoder and displays it on the panel PmacEncoderToCoord uses the transformations discussed above to compute Xformed Encoder Pos directly from this encoder position Open cod EMC Capture Home Offset FF 12001 formed Encoder Pos Enc Servo Haw Encoder Pos EEF I eet aE Motor PYE Cluster Hotor Encoder vet Eek 8 pare gt t Position Capture for Non Homing Purposes Chapter 7 introduced the encoder architecture and its use for homing operations Homing is a firmware command and therefore does not require you to monitor the capture flags access the capture register or do anything with the value To use the position capture function for operations other than homing in your own program you need to e Configure the capture condition e Monito
23. respond with a six or seven digit number Now type HI lt Enter gt PMAC should respond with a beep signifying an unrecognized command Next satisfy yourself that you can communicate with the PMAC card at a basic level Type P lt Enter gt This requests a position PMAC should respond with a number If your system contains a Now type lt CONTROL F gt You should get back eight numbers one for each PMAC LITE you will axis since lt CONTROL F gt requests following errors from all eight motors still get back eight numbers when some or all may be zero Please note that even with encoder counts as read out you type lt CONTROL F gt no scaling PMAC s position is displayed with fractional counts If error dialogs appear or the responses are not as specified check PMACTest s help capability It might help to revisit the previous section Configuring the Driver If the problem persists contact Delta Tau Technical support Congratulations You have successfully installed PMAC and the PComm32 communication drivers on your system 14 Chapter 2 Getting Started Configuring LabVIEW During the installation of PMACPanel the directory PMACPanel lib containing the PMACPanel distribution VIs was created in your LabVIEW directory There are three things that need to be done to seamlessly integrate PMACPanel into your LabVIEW development environment e Create a view e Mass compile the VIs e Configure PMACPanel for your PMAC driver conf
24. 16 1 5 bo SOE E ainciel Set Get Bool F p7 P P a Input Encoder l Capture Clu As noted if you use the LIM or FAULT flags steps must be taken to modify their normal operation These are safety limits that as a rule stop motion and disable the amplifier not useful when you are trying to home the motor or set you limits You can modify this behavior using the PmacMotorIVarFlag cluster covered in Chapter 4 e PmacMotorIVarFlag Motor Flag l Flag Cluster Motor Flag l Flag Cluster l Flag Cluster Kill All Motors C Kill CS Motors C Kill This Motor T Fault True Low O x25 Flags Hex Lal Le By disabling the Position Limits and or Amp Enable you can home into a LIM or FAULT flag Make absolutely certain you have read the PMAC User Manual section on these topics and understand what you are doing As an example of potential problems consider this When homing into a Limit switch you must start the move on the proper side of the switch and move toward it Otherwise you will move away from the switch and might hit a mechanical Stop Generally we have assumed that your PMAC is configured so that Motor N uses Encoder N and Flag N If this is not the case you must create your own VIs using the pieces provided with PMACPanel or craft your own In either situation the architecture and examples presented here will make your life a lot easier Chapter 7 Homing Encoders and Po
25. 26 pin connector works nicely These signals must be buffered the TTL drivers for these outputs on PMAC PC are very weak You can obtain an application note on techniques for accessing these signals by contacting Delta Tau technical support On the PMAC Lite PMAC VME and PMAC STD a JEQU connector provides direct access to the Compare Equals signals The outputs are open collector sinking outputs rated to 24V and 100 mA The user may replace the existing driver IC with a sourcing driver IC UDN2981A To use these HW signals and several others you must refer to the PMAC User Manual We will cover their use as far as NI DAQ boards are concerned in Chapter 9 PLC Compare Handling The PLC programs PmacPosCompSetup pme and PmacPosCompGen pmc located in PmacEncoder demonstrate the use of a PLC to generate a very rapid series of equals pulses at specified position intervals PLC s are an excellent way to handle compare operations that require fast servicing You will find these documented in the PMAC User Manual PMAC application notes and in the Introduction to PMAC tutorial notes PmacPosCompSetup configures the capability by fetching the current encoder position adding the interval and initializing the encoder registers This PLC is executed once to configure the operation After configuring the operation it starts PmacPosCompGen This PLC monitors the encoder s compare equal flag When the specified position is reached it clears
26. Capture Position in motor position encoder counts or Coord Number CS units If Motor Number is not defined in Coord Number or Convert Bool is FALSE the Capture Position is motor position in encoder counts If Convert Bool is TRUE and Motor Number is defined in Coord Number the value is in CS units Device Number 132 0 Encoder Number 132 1 16 1 gaa boo Position Captured Bool F Coord Specify Cluster Fou Capture Position Dbl Enable Compare Bool F e Compare E qual Bool F Input Compare Position Dbl Output Compare Position D bl External Triggers for Position Capture Using the HOME LIM or FAULT flags for other than their obvious purpose is very common on PMAC It requires you to build a simple interface circuit to disconnect the physical limit or flag switches and connect the trigger signal of your choice For example your system may have a proximity switch with TTL output to define HOME When you want to use the HMFL input for your own position capture operations a TTL MUX or other form of digital selector can be used to connect the trigger signal you desire Realize that you do not home the motor using this new trigger signal You will be using it for position capture for registration or some other purpose In the system used to develop and demonstrate PMACPanel s capture capabilities a TTL signal generator was used to drive a reed relay at 5 Hz and trigger the home flag Using this configuration the
27. Device Number i32 0 Men ae eee utput Hi ord Address Spec String Ad b Cutout Lo Word i e PmacMemoryWriteDbl Write a 48 bit quantity Input Value to the memory location specified by Address Spec String For example L 002B Input Value is copied to Output Value Device Number 132 0 Address Spec String kien Output Value Dbl Input Value Dbl Db Output Hi word 2 Input Hi word i32 Output Lo Word iaz Input Lo Word z The panel for the exercise demonstrates the reading of a memory location containing the standard Machine Input at Y FFC2 to the standard Machine Output at Y FFC2 It also demonstrates accessing the 48 bit long word L 002B that is the Present Actual Position for motor 1 The diagram for this exercise demonstrates how the lower 8 bits of Y FFC2 are written to the same memory location 8 bits higher Read lower bits FFC rite them 8 bits higher TFFC2 He aul a variety of info that em OA Get et TF lis found on PHAC J5 B E FFC2 Machine Input Open on ma i i FFC2 MachineUutput DEL Output alue 132 Mem Taz goja AdDb Output Hi Word 132 Output Lo Word 132 F L 002b ts the scaled present actual position for motor 1 Get the double value top and its lohi integer representation CK DoE 64 Chapter 4 Application Basics PMACPanel ICVs The previous set of exercises introduced you to PMACPanel s Device Communication a
28. I Variables for the specified Coord Number are set Otherwise they are fetched from PMAC and provided by Output Coord I Var Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 132 0 Coord Number 132 1 Set Get Bool F Input Coord l Yar Cluster New Output Bool F Output Coord l ar Cluster Chapter 4 Application Basics e PmacCoordStat Query PMAC for the status of the CS specified by Coord Number Report the two status words as arrays of Booleans and unsigned 32 bit integers Device Number i32 0 Coord First Word 24 Element Bool Coord Number 13 1 8 1 Chat First Word Binary Status uaz Second Word 4 Element Bool Second ord Binary Statue wie e PmacCoordStatProg Create a status indicator cluster for the PmacCoordStatProg indicator containing the status for Coord Number Device Number 132 0 Coord Coord Number i3 1 Stal Coordinate System Status Pr Monitoring the coordinate system status is a very common operation because programs run in coordinate systems If your coordinate system has Cartesian X Y Z axes and rotary U V W axes then your program executes its moves using the motors assigned to those axes The coordinate system status reflects the state of the executing program and the combined state of all motors in the system If all motors are in position then the coordinate system is in position If any motor has a warning following error
29. M111 controls whether the compare equal signal is e Transparent TRUE only when the positions are actually equal e Latched TRUE until actively reset by a handler The signal is transparent if this control bit is zero and latched if the control bit is one To clear a latched flag take the control bit to zero then back to one The compare equal signal is always copied into the compare equal flag M116 If you are monitoring this flag from a PLC or PMACPanel application make sure that the signal is latched M111 1 or you will probably miss it To interrupt the host edge triggered you will probably want the signal transparent PMACPanel doesn t currently support an interrupt driven interface Look for this in a future release The output enable bit M112 determines whether the compare equal flag will be output on the PMAC EQU line 1 enables This must be set if you want to use the signal to interrupt the host or to trigger an external event The output Chapter 8 Encoder Capture and Compare Operation 173 invert bit M113 determines whether the EQU output is high true or low true 1 inverts low true For host interrupt purposes this must be configured high true 174 Chapter 8 Encoder Capture and Compare Operation Triggering External Action To trigger external actions from a PMAC PC you should put a connector on the E points E53 E65 that normally jumper these signals to the interrupt controller An IDC
30. NOT update because the Y axis is not defined in CS 1 The operation of the example 1s a little different when you enable the Vector operation by checking its Enable box Nothing happens until you run the program This is due to the organization of the example not the associated Vector VI When you enable the Vector portion of the example and click Run the chart will begin updating You should disable the top portion so that it doesn t steal samples from the Vector operation You will immediately notice that the displayed data is more quantized because of the DPR data is updated in the background Fixed Background data is program related and therefore computed at a slower rate and updated only when requested The other thing you should note is that the velocity for Fixed Background operation is in encoder counts per minute whereas Real Time motor velocity is in scaled x09 counts per servo cycle The diagram for the example shows three VIs One to configure the operation one to fetch the data for a single motor and one to fetch the vector data In addition there is a small diagram to handle the encapsulated motion program A Case structure is used to control the update of the display clusters The PmacDPRFixedBackConfig and PmacDPRFixedBack VI operate similarly to their PmacDPRRealTime versions in that the Enable terminals operate the same way e PmacDPRFixedBackConfig DPR Fixed Background buffer is configured to update motor informati
31. To Coord Bool Motors PVE Cluster The panel for the exercise uses the familiar jog control with LabVIEW menu rings for selecting the motor number and coordinate system number The PmacMotorsPVE cluster and a C S definition cluster display the motor positions and motor definitions in the addressed CS The plot is a standard strip chart with Auto Scaling on the Y Axis To plot one or more motors click the appropriate radio button The colors for the plots and the legend are automatically updated 83 84 These predefined clusters display motor slates using the same standards az Pmach otorP E The legend and plot colors are configured by PmachM otorsPlotSelect Pmac Motors Chart 80 0 60 0 40 0 20 0 0 0 20 0 40 0 60 0 s0 0 Motor 1 Motor 2 Motor 3 Motor 4 Motor 5 Motor 6 Motor 7 Motor 3 Sait Rare Vag Rise Ypg Bare See Eat Encoder Motor 1 Motor 2 kotor 1 Motor 3 i Motor 2 Motor 4 Motor 3 Motor 4 Motor 5 Motor 6 Motor 7 i Motor 8 1279 1300 130 1340 1360 138 Motor 2 v Jog Relative Z e qj 00 10 20 30 ___JogTo __ Make Pre Joc ele Henu rings instead of 5 numeric controls 40 50 60 70 80 90 100 Encoder Counts O You can use the motor and CS menu rings to select motors to jog and coordinate system to convert positions to CS units If there are motion programs running on PMAC while this VI is executing the
32. Tool Menus The tools distributed with PMACPanel can be integrated into your own application using LabVIEW 5 0 s new ability to edit and process menubar selections This allows your applications easy access to the development tools and an easy way to add your own custom tools The figure below shows the panel for the PmacTerminalJog tool The menu bar for the tool shows an entry for PMACPanel that contains the menu items for the development tools gt PmacT erminal og vi Jog Terminal Pal aioe Edit Motion Program Execute Motion Progam Global Configuration Pas Plot Motors Motor Number Coord Num Plot Motor Y l vara Motor rror Chapter 5 Development Tools 103 Modifying the menu This is a custom menu named PmacTerminalMenu rtm that is set as the default for your application VIs run time menu To modify your application VI s menu or modify the existing one use the Edit gt Edit Menu option from your VIs panel to display to following dialog f Menu Editor D Lab View PMACPanel lib PmaclT erminal PmacT erminalMenu rtm File Edit Help Ee Ss as Ee Custom Preview File Edt Operate Windows PMACPanel Help gt File ltem Properties b Edit ltem Type Operate User tern gt Windows l 7 PMAC_Panel Aem wame Jog Terminal Edit Motion Program Heath EE Execute Motion Prograrr PMACFanel_T erminal Global Configuration Plot Motors Enabled Plot Motor ir Che
33. a little later Terminal Controls The PmacGlobalBufferSize VI is used to monitor and control PMAC s buffer status Sometimes when using a terminal program its not obvious that a download can t succeed because you left a buffer open or forgot to delete the gather buffer The size indicator and the Close Buffer button make it easier to monitor and deal with this problem There are three new control clusters and capabilities used to develop this tool We will cover their use in PmacTerminal a little Operationally these VIs are e PmacProgram PmacProgSelect This menu ring control with its VI query PMAC for a list of currently loaded motion programs and display the data in the ring Using it you can easily determine what programs are currently loaded in PMAC e PmacPLC PmacPLCSelect This cluster contains a menu ring control that works with its VI to query PMAC for a list of currently loaded PLC programs and their execution status Enabled Disabled There is also a button that toggles the Execution State of the selected PLC Ifthe menu ring shows PLC 01 as Enabled the button allows you to disable it thereby changing the text displayed in the menu ring e PmacPLC PmacPLCExecute 5 controls the general execution of PMAC PLCs Bit 0 controls the execution state of PLC 0 the foreground PLC and Bit 1 controls the execution state of PLCs 1 31 the background Chapter 5 Development Tools PLCs This control and its VI maintain I5
34. a move or the radius of a circular move can all be specified using Ps and Qs Specific machine inputs and outputs and internal registers are accessible using M variables Mapping of these quantities to LabVIEW controls is facilitated by the ICVs in this collection In addition the ability to log this information to a LabVIEW datalog file and re execute the motion at a later time is provided PmacPLC PLC programs and their execution status can be edited and controlled using the VIs in this collection PmacProgram This collection provides tools at a variety of levels to edit download debug monitor and encapsulate motion programs Encapsulated programs e Load themselves when executed e Know their coordinate system and program number e Can be executed by the click of a button e Indicate the state of their execution e Can be modified monitored and debugged from a powerful front panel e Accept P Q and M variant data types from the PmacPQM tools PmacSubVI This directory contains the actual encapsulated program and PLC wrapper template VIs Chapter 3 PMACPanel Basics 31 Data Gathering and Graphical Tools One of PMAC s most intriguing capabilities is its ability to synchronously gather a variety of motion data during the execution of a program or move An example is the gathering of actual and desired position in response to step inputs This data can be used to analyze the performance of a specific move or m
35. and convert ASCII response strings into numerical values for use in you PMACPanel application PmacButton In most user interfaces queries are sent to PMAC as the result of Boolean user actions and conditions This group of VIs send command strings to request responses when an associated LabVIEW Boolean condition is TRUE Indicators Controls and Vis ICVs Chapter 3 PMACPanel Basics This collection of directories and VIs provide an extensive set of indicators controls and VIs that will tremendously speed the development of PMACPanel applications Each of the 5 groups in this category provide prepackaged indicators and controls to manipulate PMAC s I Variable setup monitor execution status and send commands to PMAC using appealing clusters of LabVIEW controls Capabilities not implemented by these VIs can easily be 29 30 Motor ICVs added by modifying the provided VIs Numerous examples are provided to demonstrate the capabilities of the collection and can used as 1s Interaction with individual and sets of motors is provided by these collections of VIs The collections contain VIs to request PMAC status and motor states and display their data on pre defined cluster indicators In addition controls to Jog and control motors are provided to simplify testing and development of programs PmacMotor Monitor and control individual motors There are numerous ICVs to get motor position velocity and following error modify
36. and or the JEQU signal can also be used for the scan clock thereby synchronizing the DAQ sample rate with PMAC s primary timekeeper E series boards Connect your start trigger to PFIO TRIGI your stop trigger to PFI1 TRIG2 and your scan clock to PFI7 STARTSCAN Legacy MIO boards Connect your start trigger to STARTRIG your stop trigger to STOPTRIG and your scan clock to OUT2 NOTE You must scan two or more channels when specifying an external scan clock Legacy MIO 16X MIO 16F 5 and MIO 64F 5 The start and stop trigger pin is EXTTRIG Connect your scan clock to OUT2 NOTE You must scan two or more channels when specifying an external scan clock Lab 1200 series boards Connect your start or stop trigger to EXTTRIG Hardware pre triggering start amp stop is not supported Connect your scan clock to OUTBI For triggers and scan clocks on PC LPM 16 DAQCard 500 and DAQCard 700 you should refer to the appropriate LabVIEW manual To find the actual pin numbers refer to your hardware user manual There are dozens of approaches to configuring your particular PMAC DAQ application You might consider placing status and position monitoring VIs inside your main DAQ polling loop This requires you to properly organize the configuration and maintenance of PMAC and DAQ device polling For the purposes of this Chapter we selected a multi threaded model consisting of a main VI to control PMAC and self contained DAQ VIs found in the LabVI
37. buffer e Save Save the contents of the screen buffer to the file specified in the path control above the screen e Save As Save the buffer by selecting a new file Chapter 5 Development Tools 109 110 e Clear Window Dump the buffer and reset the display bookkeeping e Down Load Save the screen to a temporary file compile the file and down load it to PMAC This means that the entire buffer must contain legitimate on line commands and or a program Buffers with previous PMAC responses are not downloadable e Show Log When compiling the buffer PComm32 generates a log file with standard compiler messages If the download generates an error a dialog with the log file is displayed You can use this button to review the log file whether or not an error was generated Terminal Indicators There are several indicators introduced in Chapter 4 on the panel that display the status of the motor coordinate system and motor motions These are simple rearrangements of the stock clusters The interesting thing about these clusters is that they track the commands entered by you on the terminal When you address motor 3 by typing 3 in the terminal screen the motor clusters display the status for motor 3 When you address coordinate system 2 by typing amp 2 in the terminal screen the coordinate system status clusters display the status for coordinate system 2 We will discuss the simple implementation of this capability
38. dsw located in PmacCIN and modify them using notepad or Microsoft Word Microsoft doesn t recommend this but it saves a lot of configuring when you create a new CIN If you have 10 or 12 CINs you will get very tired of configuring and managing all the project files The project file has the keyword PmacCINBase used 21 times in it The workspace has the keyword PmacCINBase used once Copy the files to a new directory give them new names such as PmacMyCustomCIN dsp and PmacMyCustomCIN dsw and replace all references to PmacCINBase with PmacMyCustomCIN You can then open the new workspace in Visual C Chapter 10 PComm32 Code Interface Nodes 197 and compile your project using the LabVIEW created C source file named PmacMyCustomCIN c If your installation is different from that contained in PmacCIN try to edit the dsp or dsw files If there are too many changes create a Microsoft Visual C environment from scratch as outlined in Appendix A add the paths and libraries for PMAC and get one project to work From this point on you can copy your dsp edit it and insert it into an existing workspace It takes a little work the first time but adding new CINs is very easy after that Multiple CIN Projects in a Workspace Managing multiple CIN projects gets troublesome quickly if each CIN has its own project and workspace If you navigate your way to the PmacDPR directory and open the Microsoft Visual C workspace named PmacDPR dsw you w
39. eae Det eae 122 Prac termina lMOlOr X Y ani E ees teat O OET E E neste aed eee 124 Prac remna Gahe edri an E E een ner OET OE A E A E EEE 126 Speci yne Gather Addresse vied ir cae aaa ale asa A E EEA 131 Chapter 6 Encapsulated Motion Programs and PQMs 136 AUS ET EEI AT ENE eases I T E E E E T E E E T 136 Parac Prot SUb V erdia a a a ean aetna anes 136 Fma FOME xH Pean a a a a eee een 139 Pmac POM C TUSE S ernsnsei nren N a T N 142 Pmac POM C OnvVersioNS i herensedienr n a E T E EA OE ER 143 FmacPOM Data Gan cassie ca rioa i RE nen wate Senad da senate d tecawatus 144 Using Encapsulated Motion Pro orains si gi00i Gecsusseedigenuntertestistrmietaiaraeniatntd dae 146 IPMN CS Ue AMIN eg de heii csicheaalse ut a deen nmuadenad tin 147 Chapter 7 Homing Encoders and Position Capture 151 Ba Cho ee a eno REE ene ce Renee eC MORN E ee eee re One Ree annem rr 151 POS ONB ORE a net E O eer eee Cres 152 Positions C Ap MUS ee sass EEE E E E EE ota aaa 153 Tigger Condition sane O eee 153 lake aa A A E A AA fled E EI eae E A ea 153 AHON ON TICO Giomar ern anr eterno ree neta le ean onto oa ae ne rete 153 Home 2610 01 6 ot Cormeen enene eee teste E Une Resa eect eee 154 POMS POSIMOm OMS CE sate cde cces aaa actos beatae cee aal ee Aaah als NEA 154 Zero Moye Homin a sti i ale oe een ahs teen ol ad be eee aaa 155 Homing Intoa Limit SW 10 Cos aera a a E A 155 Homing from PLC and Motion Programs ccccccceseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
40. easy PMACPanel does not check to see whether the I Variable being addressed exists its type or its range You can find this information in the PMAC Software Reference Manual The I Variable clusters introduced later perform this type of range checking where appropriate In addition to the organizational architecture I Variables are accessed differently by PComm32 You can use the PmacResponse VIs introduced in PmacTutor4 to access them The problem is that depending on value of I9 I Variable queries may be returned as decimal or hexadecimal values PMACPanel VIs in the PmacResponse collection do not support the conversion of hexadecimal responses into numerical data types If you use PmacRespGetLong to request an I Variable like Ix25 you will get a response of zero if I9 2 or 3 not what you want If you use PmacI VarGetLong you get the proper binary representation and you get the ability to organize your access into groups The panel for this exercise allows you to modify a few Motor PID loop I Variables When creating your application s VI panels you should limit the range of controls to prevent potentially damaging data from being entered by the user Chapter 4 Application Basics 59 60 The diagram for this VI demonstrates two ways of implementing I Variable access As a general principle I Variables should be read when your application begins and anytime you access a different group In this example when t
41. existence of Delta Tau s PMAC device drivers There are several possible options you may either have already installed or purchased with PMACPanel The following information will help you determine where you are in the installation process and the steps needed to successfully install and configure PMACPanel You have PMAC Executive for Windows Pewin32 installed and tested You can skip those installation steps involved with the installation of the PComm32 device driver You have PComm32 installed and tested You can skip those installation steps involved with the installation of the PComm32 device driver You have purchased and installed PTalk You can skip those installation steps involved with the installation of the PComm32 device driver You have purchased none of the above options You will be directed to install a limited edition of the driver configure it and test it Certain PMACPanel capabilities may not be supported without PComm32 National Instruments Software PMACPanel was developed for LabVIEW 5 0 Previous versions of LabVIEW are not supported by Delta Tau s PMACPanel motion package LabVIEW must Chapter 2 Getting Started be installed prior to installing PMACPanel LabVIEW patch 5 0f1x2 available from National Instruments via FTP is highly recommended You may have other SW from National Instruments or Third Party sources such as NI DAQ There are no known conflicts with PMACPanel when using these packages
42. for position compare Chapter 8 Encoder Capture and Compare Operation 167 168 Device Number 132 0 Motor Encoder Number i32 1 ate Encoder Motor Offset Double Capture Offset Bool FI The trick in using this VI 1s to know when to query PMAC for the Home offset information You need to do this after you home the motor If you click the Capture Home Offset button in the panel the offsets and biases for the specified motor encoder number are retrieved The indicator labeled Xformed Encoder Pos now displays motor position as computed directly from encoder position There will be a very slight difference between the position in the PVE cluster and the Xformed Encoder Pos value due to the sub count interpolation used internally by PMAC to compute motor position If you click the Encoder Counts button in the Jog cluster the PVE cluster and the Xformed Encoder Pos indicator will both display motor position in CS units Again the accuracy is subject to the interpolation performed by PMAC for its own internal use The transformation in both cases is implemented by combining PmacEncoderOffset and PmacCoordMotorToCoord to build the following VI that converts a raw encoder position either Capture or Compare to motor position or CS units This VI is most often used to convert a captured encoder position into motor position or CS units e PmacEncoderToCoord This VI converts Input Value Servo Position or Capture Position from abs
43. in the real time chart The sampling rate is not uniform It is a best effort attempt to query as fast as possible For uniform sampling use PmacTerminalGather You can choose to display motor positions velocities or following errors The chart control palette allows you to pan and zoom the display The Free Run Pause button allows you to pause the chart update Clear will clear the chart and restart the chart history buffer The Save button will prompt you for a file to save the chart data as a tab delimited spreadsheet file You can also select File Print Window from the menu bar to print the panel to the printer or a file at any time Servicing PmacTerminalMenu may cause noticeable glitches in the plot data It can be disabled by clicking the Disable Menu Track button 122 Chapter 5 Development Tools 2 000 0 200000 0 188000 0 166000 0 140000 0 12000 0 10000 0 S000 6000 0 4000 0 2000 0 rer i I i i I i i i i i l l l l l I l i 4745 50 55 60 65 YO 5 80 85 50 95 100 105 110 115 120 125 130 135 1 Position Yelocity Following Error C 5 Defs Plot Select Motor 1 Motor 1 Kdotor Motor 2 Kotor 3 Motor 3 Motor 4 Motor 4 Kotor 5 Motor 5 Kotor 6 Motor 6 Kotor 7 Motor 7 Motor 8 Motor amp Depending on your requirements you should alter chart operation using the attributes available with the right mouse button These include the length of the history axis auto scaling of the Y axi
44. is Warning Following Error either way In Position This indicator is Red when the motor is Not In Position the bit is FALSE Its text says Not In Position The indicator is Green and says In Position when the motor is in position the bit is TRUE Imagine a situation where motor Not In Position means its moving therefore your program is running and that is good Do you now make the indicator Green Home in Progress This is Gray when there is no Home in Progress This doesn t mean that the motor has been homed When the motor is homing the indicator is Green It may well be that you want this to be Red when the motor is homing The choice is yours PmacTutor9 Motor I Variable Configuration In PmacTutor6 the general architecture for developing supervisory VIs for modifying individual I Variables was introduced In this exercise four VIs to encapsulate the most common motor I Variables are introduced This type of hierarchical I Variable architecture is used throughout PMACPanel PmacMotorIVarPID Follow PMACPanel s standard I Variable VI architecture When Set Get 1s TRUE the PID I Variables for the specified Motor Number are set Otherwise they are fetched from PMAC and provided by Output Motor I PID Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 132 0 E St De Her Output Bool F Motor Number 132 1 oml o Set Get Bool F Output Moto
45. is used to control the acquisition rate for fast and accurate timing It is a buffered acquisition meaning that the data are stored in an intermediate memory buffer after they are acquired from the DAQ board e PmacDAQSyncServo Cont Acq amp Graph ExtScanClk D Trig v1 This VI retrieves the specified amount of data from one or more analog input channels when a digital start trigger digital stop trigger or digital start and stop trigger occur This VI uses an external scan clock to continually retrieve data from one or more analog input channels This VI Chapter 9 PMAC and NI DAQ Interfacing 191 will only work on devices where you can externally connect a scan clock signal It is a buffered acquisition meaning that the data are stored in an intermediate memory buffer after they are acquired from the DAQ board Single Trigger DAQ input limits PmacDAQTrigger is a LabVIEW example that waits for the external trigger supplied by EQU1 to begin asynchronous acquisition at the specified sample rate In our version of the example channels 0 1 and 2 are sampled at 1OKHz The waveform chart in the panel below shows a triangle signal the EQU trigger pulse and the servo clock You can run this VI by selecting Simple DAQ in the menu ring and clicking the Run DAQ button on PmacDAQMove AFTER the PLC is configured and enabled AND the motor is jogging If the motor is not jogging the VI will wait 5 seconds for the trigger and then time o
46. is configured and enabled AND the motor is jogging If the motor is not jogging the VI will wait 5 seconds for the trigger and then time out The EQU signal is configured to be active LOW You can see the jitter in the EQU signal more clearly in this example The analog signal is now sampled synchronously with the servo clock You will note that the servo clock trace in the chart is even caught once on CH2 Chapter 9 PMAC and NI DAQ Interfacing 193 For instructions select Show Vl Info from the Windows menu device choose tigger type transposed waveform graph TRIGGER ali START OR STOP 10 0 channels o uz 5 0 number of scans pretrigger to acquire cang 250 i time limit sec trigger edge 500 sltaling Input limits data Sig pele Comp Serva 25s 0 0 2 5 5 0 A5 10 0 l 0 000000 100 000000 249 00000 Further Sampling Options The three examples presented here demonstrate that you have many options for triggering and controlling the sampling of your data e Ifyou sample the servo clock or the EQU signals along with your data you have in essence a time code synchronized with your data e Ifyou perform a gather on one of PMAC s position or velocity registers while using position compare intervals you can relate your sampled data with precise cycle by cycle motor positions or other motion characteristic Using these approaches you can achieve servo accurate
47. knobs a Motor PVE indicator and a Jog cluster At the top right of the panel is an LED that turns Green when an externally triggered capture trigger occurs and a position indicator whose value is the position captured when the trigger occurs Before you run this VI you should home the motors you are working with You can do this with the example covered in Chapter 7 or execute a home command from PmacTerminal 170 Chapter 8 Encoder Capture and Compare Operation As with homing position capture the trigger condition must be configured prior to use This is done using the already introduced PmacEncoderI VarCapture cluster The PmacHomelIVar cluster is not required because the motor has been homed and the moves we will be executing are not homing moves After selecting the capture trigger condition the Configure Capture button sets the configuration in PMAC Once this is done the encoder is armed and waiting for the specified capture trigger The simplicity of the diagram demonstrates how the application is organized At the top are the VIs to handle the jog and PVE clusters At the bottom is the logic to handle the configuration of the capture condition The encoder capture trigger condition is configured whenever the motor number changes or you click the Configure Capture button Configure the Capture Condition ms gt T Once the capture condition is configured PmacEncoderTrigger is used to monitor the encode
48. motor I Variables process motor status and jog motors PmacMotors Monitor and plot the motion of collections of motors in defined coordinate systems Plotting tools for selecting which motors and motion variables to plot are available Samples of real time strip charts and XY charts are provided Coordinate System ICVs Global ICVs PmacCoord Monitor the execution of programs and definition of motor coordinate systems This information is required for the development of user interfaces in which information is entered and displayed in coordinate system units rather than encoder units PmacGlobal General PMAC setup and configuration are provided by this collection for VIs These capabilities are used for the development of supervisory VIs Accessory ICVs PmacAcc PMAC has numerous accessories that are used to provide digital I O analog I O and control capabilities This includes the ACC16D front panel and the alphanumeric display This collection provides basic ICVs that access the memory mapped data used by these accessories Position Capture and Triggering ICVs PMAC has the ability to capture exact motion positions in response to external triggers and generate triggers when specified positions are reached This capability can in conjunction with National Instruments DAQ boards be used to capture a position or trigger instrument control in response to specified positions PmacHome This collection of VIs provid
49. or a PMACPanel program Required M Variables To utilize this feature from a PLC you must access the encoder control status register and the position compare equal register For Encoder 1 the standard M Variable declarations are MiO3 gt xX SC003 0 24 5 24 bit pos compare register Midd gt xeoCo00 pd Ly 7 gt Compare flag latch control Mil Z gt x2 C000 125 2 Compare output enable bit MITSS SX sCo00 7 doe gt Compare oultpul tnvert but Mil TO gt eo C000 6 pl Compare equals flag Similar sets of registers and M Variables are defined for the other encoder registers Pre loading the Compare Position To pre load a compare position assign an encoder position value to M103 such as M103 1250 This value must be between 8 388 608 and 8 388 607 You cannot read this value back reading from the same address gives you the position capture register The command can be given from a PMAC motion program a PMAC PLC program from the host or using the PMACPanel VIs introduced in the following example This is the encoder position if you want to reference it to motor zero position you must know the homing offset This translation is handled transparently by the PMACPanel ICVs in the PmacEncoder collection Encoder Control Bits Three control bits configure the format of operation of the compare feature These are SW status bits and if enabled external HW signals available on various PMAC cables The flag latch control bit
50. parsed for PMAC ERR codes Response Available Bool F Device Number 132 0 Flespanse Sinal Exercise PmacTutor3 shows how PMACPanel simplifies the sending of commands in response to panel buttons and Boolean conditions PmacTutor2a Communication Logging Chapter 4 Application Basics This is a rather advanced topic but one that we include here for completeness PMACPanel has the ability to log all communication between your application and PMAC You might use this to monitor what your users are doing or want to log interesting sessions for later play back PMACPanel maintains all communication using the following VIs Future versions of PMACPanel may use this capability to implement a Graphical Motion Language 47 48 PmacCommGlobal This VI is a global copy of the PmacCommGlobal cluster used by several PmacComm VIs for error reporting and logging purposes amp Comm Pmac Communication Cluster This cluster maintains a log of communication between PMACPanel and PMAC Command String Last on line command sent to PMAC Response String Last response received from PMAC Communication Log String A multi line buffer of commands sent to PMAC and received from PMAC Num Commands i32 The number of commands sent to PMAC and logged in the Communication Buffer TF Buffer Log Bool F When TRUE all communication is appended and logged to the Communication Log PmacCommBuffer When Log Enable is TRUE communic
51. position data plotted and displayed by this example will be from those motion programs In either case motor positions are displayed in real time in the PmacMotorsPVE cluster and the strip chart To implement this exercise we use PmacMotorJogControl and PmacMotorsPositions The CS definitions are retrieved using PmacCoordDef covered in a later exercise The PmacMotorsPVE cluster generated by PmacMotorsPositions is unbundled and the array of values is passed to the PmacMotorsPlotSelect VI e PmacMotorsPlotSelect Motors Array contains positions velocities or following errors for all motors on your PMAC Select Bool Array defines which motors are copied into Selected Motors Cluster for plotting on LabVIEW strip charts XY Point Cluster contains two values for X Y plotting New Selection is TRUE when Select Bool changes and indicates Chapter 4 Application Basics the Plot Attributes Array of Clusters and X Y Plot Attribute Cluster contain new information for updating plot legend attributes pC SETI elected Motors Cluster ld otors Array o r Print Cluster Mew Selection Bool F Plot Attributes Array of Cl Taneman aT Plot Attribute Cluster Select Bool Array Po rd Setting the plot attributes is done in the case structure in the lower right of the diagram below Plot Attributes Array of Clusters contains an Active Plot index Plot Color and Plot Name as supplied by PmacMotorsPlotSelect When New Selection is TRUE th
52. positions for every sample of your data With LabVIEW s analysis tools you can perform detailed data reductions relating position velocity and physical measurements Other Interface Options 194 There is no reason you can t use your DAQ boards DIO to control PMAC s MIO inputs and vice versa Multipurpose DAQ boards having timers can be used to generate position capture triggers as can the board s D A capabilities Other possibilities include the use of the timers to generate time base control for PMAC Although not covered here you can use the sample PMAC generated clocks and signals to trigger and clock bench instruments that you communicate with using GPIB Chapter 9 PMAC and NI DAQ Interfacing Chapter 10 PComm32 Code Interface Nodes Basics This Chapter documents a basic framework for developing LabVIEW Code Interface Nodes CINs using Microsoft Visual C This topic is important if you e Desire more sophisticated control over a VIs implementation e Intend to understand and modify the PmacDPR collection of VIs for accessing Dual Ported RAM e Use PMAC s interrupt capabilities PMACPanel primarily interfaces to PComm32 using LabVIEW Call Library VIs to access specific PComm32 functions In some instances your need for increased speed sophisticated manipulation of PMAC or the number of calls to PComm32 begins to create a nasty mess of Call Library VIs that becomes unmanageable In this Chapter we int
53. program Device Number 132 0 Output Gather Clust Input Gather Spec Cluster a i a a PmacGatherCollect Collect the gather buffer and scale the data using each items scale factor The data in Gather Data Array is a two dimensional array of doubles with Number of Items columns and Number of Samples rows In this format the data can be written to a spreadsheet or processed by many different LabVIEW data analysis VIs Device Number i32 0 Gat Number Of Items 32 Input Gather Spec Cluster Collec Selle lee i32 p Gather Data Array Double The sequence frame in the middle of the case executes the step or an encapsulated motion program You can replace the motion program with your own or modify the entire sequence to suit your needs There are two other operations performed within the main case structure The Gather Spec cluster is unbundled and used with PmacPlotColor to setup the legend Finally after the data is collected it can be written to a spreadsheet if the operation was enabled prior to the gather This is done using PmacGatherSpreadsheet Output a tab delimited spread sheet file for import into other plotting and analysis applications If Input Spreadsheet File Path is empty of Not A Path a dialog prompts for a file name The file name used is provided to Output Spreadsheet File Path Chapter 5 Development Tools Input Spreadsheet File Path Gather Data Array Double eo Gather Spec Cluster Output Spread
54. program e A button to start the program e A button to show the encapsulated motion program s execution panel e AnLED to indicate the execution state of the program Chapter 6 Encapsulated Motion Programs and PQMs 147 PQM 1 has an extra button that when clicked allows modification of its associated P Variables with the control panel shown below The VI architecture for doing this isn t really a PMACPanel design issue but it demonstrates an approach for PQM configuration using pop up panels in a larger application This application specific PQM configuration VI doesn t actually send the variables to PMAC It creates a PmacPQMVariant array from the panel clusters that can be used by the encapsulated motion program VI in the main application Update reads the current P Variable values from PMAC and updates the controls on the panel You can close the panel using Cancel and discard the new control values If you click OK the VI indicates there is a new PQM Variant Array available The disposition of the new data is up to the main application VI The description for the VI is given here e PmacTestPQM1Panel Group several PQM clusters together and coordinate their operation with an encapsulated motion program VI Panel Show TRUE displays the panel If you supply Input PQM Variant Array and set Init w Input Variant Array TRUE the controls initialize themselves using the array contents when the panel is displayed If you do not
55. should be subtracted from encoder position usually from position capture to get motor position or added to motor position to get encoder position usually for position compare To move an axis until a trigger is found then convert the captured encoder position to a motor position you can use the following M variable definitions Chapter 7 Homing Encoders and Position Capture MINQ03 gt X25C003 24 5 7 ENCI positilion Captute register MiLiL7 gt x ssC000 1 7 7 ENCI position capture flag M12 5 gt Y19 0815 24 5 7 il encoder pos Orrsel register Zero Move Homing A If you have following error when you give the HOMEZ command the reported actual position after the HOMEZ command will not be exactly zero it will be equal to the negative of the following error If you wish to declare your current position the home position without commanding any movement you can use the HOMEZ on line or HOMEZn motion program command These are like the HOME command except that they immediately take the current commanded position as the home position The x26 offset is not used with the HOMEZ command This is not a reliable home and the PMACPanel VIs introduced in this chapter and the next do not handle this phantom home offset You can if desired fake this by modifying PmacEncoderOffset Homing Into a Limit Switch A The polarity of the limit switches is the opposite of what many people would expect The LIMn input shou
56. the panel are active The panel clusters are converted to variants and used to set Output PQM Variant Array Thus Output PQM Variant Array always reflects the current state of the controls If Init w Input Variant latched is TRUE or if the user clicks Update the controls are updated using either the newly fetched data or the Input PQM Variant Array When Cancel or OK 1s clicked the panel is closed The state of the OK button is used to set New Output Incorporation of this pop up VI into PmacTestExamp can be seen in the example s diagram Chapter 6 Encapsulated Motion Programs and PQMs 149 150 E buy EE Program Running Circle Show Circle LTF j i ing Ci EE Subi 5 Program Running Circles Show Circles IE te pea Program Running POM Dev show PQM2 TF I Motor Position Chart Open gt HEE bore bm LEE Pos Bbc Murs ETF Close T 5 Plot Select rogram Running POM1 3 Subvi LE zl T Plot Color E Use a Panel to configure the move The handling of the Run Show Panel and In Progress indicators for the individual motion programs is very simple because of the encapsulation VIs At the bottom the Show PQM1 Panel button is supplied to PmacTestPQM1Panel to allow configuration of the PQM Variant Array supplied to the appropriate encapsulation VI The implementation of the plots charts and other indicators is identical to that covered already Chapter 6 Encapsulated Motion Programs and PQMs
57. therefore may not appear elsewhere in this manual PMACPanel assumes that you have had a basic course in the use of LabVIEW or equivalent experience PMACPanel s architecture was designed to hierarchically encapsulate common operations into VIs that you can use to develop your own applications without doing a lot of basic communication parsing and wiring Depending on your application s requirements and your experience with LabVIEW you will have your own design patterns The tutorial exercises that follow and the examples contained in the release reflect different ways to architect your applications to maximize the utility of PMACPanel These techniques are used throughout PMACPanel and can be applied in your own application For an excellent reference on LabVIEW techniques and application design issues see LabVIEW Graphical Programming by Gary Johnson McGraw Hill ISBN 0 07 032915 X Dataflow and Sequencing In LabVIEW the order of VI execution is not guaranteed Some PMAC operations require sequenced command execution For example a command to start a motion program should be sent before you go waiting for it to complete In other situations M Variables must be defined before they can be used Some PMACPanel VIs anticipate the need for sequencing and provide an output to enable this without using a LabVIEW sequence structure In some instances you must use a sequence structure Chapter 4 Application Basics Chapter 4 Applicat
58. they can get the information they require for their operation Use the information in Input Gather Spec Cluster to setup a gather operation on PMAC Output Gather Spec Cluster should be wired to PmacGatherStart PmacGatherStop and PmacGatherCollect to sequence operations and so that they can get the information they require for their operation The actual setup can also be done using Pewin32 PmacTerminal or your motion PLC programs This is not recommended if you intend to use PmacGatherCollect to retrieve the gathered data These methods require 129 130 intimate knowledge of PMAC s internal architecture and are automatically handled by this VI Device Number 132 0 Output Gather Clust Input Gather Spec Cluster A P Ea a PmacGatherStart Start a previously defined gather operation You should immediately start the desired motion after this VI executes You can eliminate this VI if you start gathering by using the PMAC program command define gather in your program Device Humber 132 0 Output Gather Clust Input Gather Spec Cluster a i PmacGatherStep This is only one of any possible motion or encapsulated motion program Device Number i32 0 Step Bool Motor Number rt 1 8 1 Step Ta walt Time m5 Output Device Number i32 0 Done Bool PmacGatherStop Stop an executing gather operation You can eliminate this VI if you stop gathering by using the PMAC program command end gather in your
59. used to convert between encoder counts and coordinate system units and determining which motors if any are defined in a given coordinate system The architecture for the following PmacCoord CVs is a little different from that used for status and other fundamental queries A few of these VIs make use of local state variables to keep track of queries for coordinate system definitions so that these queries are not placed every time the VI is executed within your VI This reduces communication traffic and relieves the developer from having to check for a new query The fundamental assumption in this approach is that after you create your application you will not constantly redefine the specified coordinate system When you ve requested a coordinate system definition from PMAC and change it the new definition will not be reflected in your application To refresh the definition temporarily request the definition for another coordinate number or close your VI and reopen it The architecture for determining coordinate system definitions relies on the following three VIs They perform similar operations but return coordinate system definitions for different purposes e PmacCoordMotorDef Query PMAC for the definition of Motor Number in Coord Number If the motor is not defined in the specified CS Coord Definition is Encoder Coord Scale 1 0 and Coord Defined is FALSE If the motor is defined in the specified CS Coord Defined is TRUE Coord Scale
60. vector s have been accumulated the updating of the charts requires between 75 and 100 mS 212 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual The diagram for the example is very similar to that of PmacDPRRealTimeExamp The configuration VI is the same The Vector VI PmacDPRRealTimeVectors is similar to PmacDPRRealTimeMotors in that it takes an Enable input It also has a Buffer Length input Rather than a Coord Specify Cluster you simply provide a Motor Number The decision to do this is based on the view that whereas single Servo sample data for a motor might be used to drive a PVE type of panel cluster this is not true for a Vector operation You should note that the update of the chart is wrapped in a case structure DO NOT use the cluster of arrays unless Valid Output is TRUE The arrays should have zero length but this may cause problems Dey 1 Unbundle the vectors of interest Open 2l pone to Cua ama M Servo Timer i32 Dr o Tai a Postion DB penea m Velocity Dbl Velocity Dbl Buff Length alkaa a A Error Dbl Sri rir rir r rori rn rr ror hs rire rr ronron ror ror rr rororo r rror ror ror ror roro rororo roro Waa ea ro Sample Period A anonacenancnancnsnccanestaes seen fe o 2 Enabled Motor Numbers Walid Output void Dap A Position Db A j Velocity Dbl Following Error Dbl H Buff Length Ee Tea EH Conve
61. with the mouse To accomplish this the motion program shown below uses DPR mapped M501 and M502 to define the target position for motors 3 and 4 M500 is a Boolean used to control a loop that breaks the target position into a set of smaller moves The program is encapsulated in a VI for easy use gt USE CF eS amp 3 3 gt 10x 4 gt 10y These are DPRAM mapped target coordinates M501 gt F SDE06 gt X coordinate M502 gt Fr9 DEO Y Goordinate RUM BOOL M500 gt Y ro DEOD 61 e 7 open prog 61 clear Smee wat LS DOO P209 1000 gt Vector distance per increment P211 10000 Slarvring positions M501 10000 PZL 10000 M502 10000 tm1 0 Move tracking while M500 1 P22 1 P222 MSO PZL Cartesian distance to go M502 S PALZ PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 233 P200 soqrt P2zil P221 P222 P222 if P200 gt P209 If longer than increment P200 P209 P200 Fraction of distance P211 P211 P221 P200 P212 P212 P222 P200 else P211 M501 P212 M502 endif x P211 y PZ12 endwhile close The panel for the example is shown below When the VI is running and Enable Track is checked the values in DPR Numeric Slave Cluster M500 M501 and M502 are continuously written to memory for use by the motion program Checking Enable Poll sets M500 TRUE so that clicking the Program Run button enables th
62. yer yer yr el aol ao eee S a ea A a aa i tal PMACPanel Terminal aria To add new tool selections click the night mouse button on the case selector and select Add Case Enter the ltem Tag used when adding the ttem to the menu Copy the items from the case above and and paste them into your new case Change the name of the YI to run when the tem Checking for menu selections consumes alot of Lab VlIEW s time The counter and conditional limit the checking to once every 32 calls You can change this In your own application if desired There are a few limitations associated with using LabVIEW s menubar capabilities The main one is that it noticeably slows applications that are doing highspeed query response updates of status and position indicators To remedy this the PmacTerminalMenu VI is configured to execute the actual checking of the menu selection once every 32 calls You can change this logic or add timers to suit your own needs Basic Tool VI Requirements PMACPanel s use of the menubar selection VIs spawns the VI specified by the selection as a separate concurrently executing task This means the VI should be organized much like the exercises Open PMAC run a while loop use s Stop button The diagram for PmacTerminalJog is show here to illustrate this Co iT lt Motor LITE Term Lim t Menu Motor BEH Coord Humber JogSt Motor State Chapter 5 Development Tools 105
63. you may also have to handle the rollover of encoder registers if they will be traveling more than the 8 million counts supported by the 24 bit encoder register The modulo operator is useful for this For more details refer to Synchronizing PMAC to External Events in the PMAC User Manual Input Encoder Encoder Motor Axis Signal Position Position Position Position Quadrature Capture Position Mx03 Act Pos Cmd Target Pos Move End Pos Parallel Compare Position Mx03 P Mx62 Mx61 Mx63 Mx65 en Phase Position Mx01 Extended Interpolated Count User Integer Count 1 x08 32 ct Units Count 1 32 ct fixed point floating point PMATCH gt v A A 24 bits Encoder 24 bits 48 bits l 48 bits Decoder gt Position Axis ee gt __ Conversion L eoa ao 3 Counter e g 1 T Extension Scaling i 32 e 1x08 Axis Coefficients Done Always Done Always Done for pone for Activated Motor Defined Axis Set to Zero on Set to Zero on Set to Zero on Can be Offset Power up Reset Power up Reset Power up Reset Axis offset PSET and Home axis COMMAND ACTUAL POSITION POSITION Motor position is always kept in terms of encoder counts When a motor is assigned to an axis through a Coordinate Definition statement as in amp 1 fil L000X 152 Chapter 7 Homing Encoders and Position Capture for use in a motion program the scale factor in the statement deter
64. 026 Dbl Encoder Home Position Offset 0x0815 132 0 Motor Pos Bias Ox08135 132 fo 0 Position Scaling Factor 1x08 132 Motor Home Offset x26 132 Present Encoder Position 0xC002 i32 The encoder Servo position register is 2 Encoder counts with the LSB the direction bit This output value is en actual encoder position referenced to a power up reset position of zero Present Commanded Motor Position 0x0028 Dbl This is the motor s present commanded position in units of 1 32 Ix08 encoder counts referenced to the motor s home position Present Actual Motor Position 0x002B Dbl This is the motor s present actual position in units of 1 32 Ix08 encoder counts referenced to the motor s home position Encoder Home Position Offset 0x0815 132 This is the encoder s home offset position in encoder counts It represents the difference between the encoder s power up reset zero position and the position when a home operation completes Motor Pos Bias 0x0813 i32 This is the position bias of the motor and represents the coordinate system translation in motor position encoder counts Position Scaling Factor x08 i32 This parameter controls how the position encoder counter is extended into the full length register For most purposes this is transparent to the user and does not need to be changed from the default There are two reasons that the user might want to change this from the default value First beca
65. 1 Diagram File Edit Operate Project Windows Help 7 h H e Se mid 13pt Application Font a Ro E a PmacView Functions Ea Cmar atar aT le F mmf Coord et Th Sint Hem Motor eH PmacMotor Prag PmacHotornog Yi rar Ka Ke a te Tate Ka e en LEA aa a o Ka aa a o Ka o a ja OU a _ pel eel ed _ pel eel ie Motor MPY Motor Mtrst PYE E mp Stat Lirits Motor Motor Motor kotor Stat Stat2 StaE Error BARR l Mov PID l Satelf Jog Fos botn el ater PER oi Ee PMACPanel VI Terminal Conventions PMACPanel has carefully chosen terminal names that are used consistently throughout the library Extensive terminal descriptions and their behavior are available with LabVIEW s Help Show Help facility and in the VI Reference chapter of the manual To help you utilize the on line help associated with PMACPanel VIs there are terminal naming conventions to identify the name type default value and range of inputs and outputs Most input terminals have a default value Those that have a range coerce inputs to the range Most inputs are required A few are recommended Their default action is fully defined Chapter 4 Application Basics Cluster inputs and outputs are typically named for the wire type expected The following VI icon demonstrates these standards Range if any inserted here e g 1 8 Required Terminal Default Value M Device Number 132 0 etc E te a a H
66. 2 0 Program WI State Cluster Program Execute Control Clu New Program Bool F Program List Cluster Command Executed Bool e PmacProgDebug Query PMAC for currently executing line in Coord Number and output the response in Current Command Determine the scroll position and characters that delimit this line in List Buffer and create Debug Location Cluster for setting selection attributes in a multi line string control for real time display of Program Number s execution This information is obtained from PMAC using the LIST PE command Device Number 132 0 Program List Cluster Debug Location Cluster Curent Command String The specification of the currently executing line in the program listing buffer is given by Debug Location Cluster Cluster of information for string control attributes The items define the Scroll Position of the string in the buffer and the Start and End Character of the line currently executing Selection Start and End character in List Buffer for currently executing program line Character Start Character End Scroll Position Number of currently executing line in List Buffer This information in this cluster is used in the diagram to set the selection and scroll position attributes for the string control used to display the listing You can see this at the top of the diagram 120 Chapter 5 Development Tools OXKXKr tem Fog Hoe Buep_Selecton Menu Program f D bug Sc
67. 28 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual a Ome O T Set POM PLC Disabled The handling of the five VIs in the earlier example diagram is reduced to a single VI PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 229 PLC teration Timer mS a gt Ce The diagram for the DPR Numeric Cluster VI is shown below You can copy this and modify it to support your own requirements Note that the addresses are specified by cluster constants These can be created using the right mouse button and selecting Create Constant 230 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Set 5Get Bool F Device Number 122 0 EVICE MUMDET I EE E Response Available Bool F T DEL Taz TE gE Output DPR Numeric Cluster Input DPR Numeric Cluster 3 TEPEDE PmacDPRNumericCINClusterExample This example takes the previous example a little further and implements the actual handling of DPR data using a CIN This can be useful if you have many data being transferred or have trouble maintaining dozens of PmacDPRNumeric VIs or have special data handling requirements that benefit from a CIN The diagram handling the 5 M Variables in the example above are reduced to a single CIN VI that will handle the reading and writing of the data with direct PComm32 calls To simpl
68. 78 80 PmacMotorlI VarSafety 78 79 80 155 PmacMotorJog 74 PmacMotorJogControl 38 39 71 72 73 84 114 PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Index e 247 PmacMotorLimitControl 73 160 PmacMotorPosition 68 PmacMotorPVE 70 72 73 74 82 203 PmacMotorStat 55 76 PmacMotorStatJog 37 73 76 PmacMotorStatLimit 73 160 PmacMotorVelocity 69 PmacMotors 30 PmacMotorPosition 69 PmacMotorsCloseLoop 128 PmacMotorsErrors 82 PmacMotorsPlotSelect 84 85 PmacMotorsPositions 81 82 84 PmacMotorsPVE 82 83 84 93 PmacMotorsVelocities 82 PmacMotorsPlotSelect 126 PMACPanel Documentation 33 Panel and VI pairs 38 PMACPanel Organization 28 Communication 29 Device Management 26 29 Indicators Controls and VIs ICVs 29 Program Compilation and Download 27 Query Response 26 29 PmacPLC 31 PmacPLCExec 113 PmacPLCSelect 110 112 PmacPlot 32 PmacPlotX Y ChartBuffer 126 PmacPQM 31 PmacPQMaArray 139 144 PmacPQMBool 143 PmacPQMDbI 143 PmacPQMExamp 139 146 147 148 PmacPQMLong 142 143 PmacPQMLong2Var 144 PmacPQMShort 143 PmacPQMVar2Long 144 PmacPQM Variant 143 144 146 148 PmacProg PmacProgDebug 120 PmacProgEdit 109 112 113 PmacProgExec 120 PmacProgParse 116 PmacProgRun 139 PmacProgSelect 110 112 PmacProgram 31 PmacProgSubVI 136 PmacResp 52 PmacRespGetBool 53 PmacRespGetDbI 52 PmacRespGetLong 53 59
69. Background buffer select the items you want in the buffer and check an Enabled box In the example the upper set was created to handle these three items The lower set was created to handle P44 and P45 that are generated by the PLC program The VBGB Status Cluster maintains information about the individual buffers and the entire pool Refer the VI Reference for details of each item Here we will discuss what these clusters show The top status cluster item VBGDB indicates that it is buffer 2 whereas the bottom cluster indicates it is buffer 1 Buffers are assigned in the order created Num Entries indicates that the top buffer has three items as defined by the Gather Spec and the bottom buffer has 2 items When the first buffer was created the Total number of entries was 2 After the second buffer is created the Total number of entries is 5 Start Address indicates the start of the buffer in DPR This is the last location PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 237 reserved by DPR The Start Address of the first buffer created indicates the first address you can use for DPR Numeric access Notes on the use of PmacDPRVarBack Variable Background buffers should be created AFTER all other DPR mechanisms have been enabled PComm32 might and sometimes does moves things around when you start reconfiguring DPR If you create more than one buffer DO NOT delete a previously created buffer Again
70. CONTENT CSTR CTO On 194 Other Interlace OPUONS aeniea r E T O T 194 Chapter 10 PComm32 Code Interface Nodes 195 Basico aaa E a a an eon taetad a ts 195 LabVIEW Code Interface Node Basics nneennssssssssssseeerresssrssssssssssseeeereeesrssssssssereereeeesesss 195 VAS AO TIN e a a E sctna saat aah aeeaeds eogananeated 195 Using a CIN with PComm3 2 cence ee ee 196 Setting up a PMACPanel CIN Configuration cccccccccccccccccccceceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 196 Addins PComim3 2 Include Path anaa knee eS 196 Addie Pima MD to PLOj CCU x5 ore adie apg eee 197 Sr 1 ae Cs IDE Ne ae Doone 197 The Easy Way to Add New Projects cede eee aii aia 197 Multiple CUN Projects ina W OfKSp aCe ssi castosd coset ioscan an aaa 198 Creating a CIN C Stubdtor PCOMM 3 2 525 003 sc cecehs e a a a 199 Chapter 11 DPR Dual Ported RAM 200 Iv Table of Contents MS VS E EEE oe tae ee aaa EET AEE eda tas ee sedan Sees E AE Required Background Understanding ccccceeeeeeeeeeeees General Architecture Notes cccccccceeeeeeeeeeeeeeeeeeeeeeeees PmacD PRR Gal limes naaa a a a PmacDPRRealTimeExample ccccccceeeeeeeeeeeeeeeeeeeeeeees PmacDPRRealTimeVectorExample ccccccccceeeeeeeeeeeeees Pmac DPR Exe dB ACK poeni satel ee tusaanesei ae eroutase ees PmacDPRFixedBackExample ccccccceeeeeeeeeeeeeeeeeeeeees Pimac DIP RINUMCRC x s2 c2 svaroudsdseendassacteel E DPR Addresse
71. Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual fetched data directly to the items of the cluster it is stored in a set of global arrays The BufferCount array keeps track of the next array location to be written when valid data is available for storage There is a cryptic if clause involving the ServoTimer data and BufferCount The actual storage of fetched data in the temporary arrays requires that the ServoTimer not be the same as that of the last sample Otherwise the array would contain multiple samples of the data After the temporary arrays are updated the CIN check the current buffer count against the desired buffer size If there are enough samples in the temporary array the data will be copied from the temporary arrays into the cluster of arrays passed back to the VI This requires you to resize each array in the cluster using LabVIEW s NumericArrayResize and then copy the data from the temporary array into the data buffer that will be returned to the VI Once you get the basics of this requirement clusters and arrays are very easy to handle in your CIN There are some conditions associated with this approach The temporary storage arrays have a fixed size defined by MOTOR MAX and BUFFER MAX They have a native 2 dimensional C organization As compiled you cannot ask for a Motor Number larger than MOTOR MAX or gather more samples than BUFFER MAX The CIN does not check this condition If you
72. Chapter 3 PMACPanel Basics 22 PMACPanel and PMA C as Client did Sry ef cisi5 osaSscscvedeas eat iersd ceed a 22 Application Development Components aisis ea a 23 Powinno 2 P MAC ExecUVearinniinnea re aae aa a A 24 PTalk ActiveX Controls for Visual C and Visual Basic cccccccccccceeeeeeeeees 24 PMACPanel PMAC for LabVIEW 5 0 0 cccccesscccccceesssssscceecessessneceeeceessessnaaeeeeees 24 PMAC Panel Intertace 16 PC Omin3 2s 2s oie ee E E NETE AAEE 29 D vice Man zeme itra EA EA A EA EE 26 Query Response Communication s cn ccs bcc hudi nv E E E AT S 26 LabVIEW and PMAC Numer Dita cnc ea hn ean meee 2 Download Majade Mentera em ees 2i DPR Binary Datar BUE S cansan a nET RTE E N an 28 PMAC Panel Ore an Zat Orena a a aaa e EAE E tee ete 28 Device Management and Communication cccccccccccccccccccccceceeeeeeeeeeeeeeeeeeeeeeeeeeeeees 29 CUCKY INES PONS JI CIA CS nicet araiiesistniaal rsitsle sn dadanlivenaievs T N 29 Indicators Controls and Vis IC VS ioeina e a winds vat aleideudinssaawsndeeies 29 IVR OLOR ICN eree EE binsie T E T NE T ENT 30 Coordinate Ss VSte mil VS 665005 aa aa agneassbsdy are terelatades 30 ATO AS Fa hasasncs a A T nite wie mmnasepacceasc aera este 30 PC CCS SOR IO VS cota ae ahaa hance des acta e A mnmeeten Meee 30 Position Capture and Triggering ICVS 0 0 cccccccccccccccccececeeccecececeeeccceeceeeceeeeeeeeeseeeees 30 Program Development and Encapsulation Tools ccccccccccccc
73. Chapter 7 Homing Encoders and Position Capture Basics PMAC utilizes a custom gate array to interface motor encoders to PMAC and perform a number of high speed computations required to monitor motor position When writing PMAC programs you specify moves in coordinate system units Motor positions are specified in encoder counts The gate array uses another version of encoder counts to translate motor position into encoder position In Chapter 4 we introduced the PmacMotor and PmacCoord collection of ICVs that allow you to convert between motor position in encoder counts and motor position in coordinate system units In this chapter we complete the picture by introducing the PmacEncoder and PmacHome collection of ICVs that give you the ability to move freely between coordinate system motor position and encoder position specifications These are important if you want to relate precise position information to actions in your system Using the encoder gate array you can configure PMAC to e Capture positions in response to external or internal triggers e Generate triggers at pre specified compare equal encoder positions The first operation required for precision position measurement of any sort is the establishment of a zero or home position On PMAC this is done using an encoder capture operation that is triggered by a home position sensor Homing details are covered in detail in the PMAC User Manual Some of this information is repeated i
74. Device Number 122 U LVBoolean Enable Bool ine3s2Z hnable Motor Numbers 132 1 g T z int32 Servo Period i32 1 CIN MgGErr CLINRun i1nt32 Device Number 132 0 LVBoolean Enable Bool IOCS Enable Motor Numbers 132 18 14 mesa Serve Period i32 L 4 ENTER YOUR CODE HERE return noErr To access PComm32 capabilities you need to add the line include lt pmacu h gt You can then utilize all of PComm32 s capabilities In the Chapter that follows we make extensive use of CINs for the implementation of VIs to access PMAC s DPR Chapter 10 PComm32 Code Interface Nodes 199 Chapter 11 DPR Dual Ported RAM Basics Every collection of VIs presented so far uses ASCII command strings to communicate between PMAC and the host This is independent of whether the actual transfer between the host and PMAC takes place over a serial port the bus or DPR The parsing formatting handling and interpretation of the commands is responsible for most of the time required for communication even communication that takes place using Dual Ported RAM DPR Dual Ported RAM provides seven other mechanisms for the transfer of limited and specific sets of numeric data between the host and PMAC that requires far less handling This results in much faster transfers that may be advantageous in your application These mechanisms are 1 Fixed Real Time Data Buffer Automatic copying of limited servo data to
75. Dwell Ww arming Fatal Following Error Following Error Amplifier Fault Error ipi Pafii Motor Status Jog Cluster A lot of work went into developing indicator clusters with proper names and item descriptions You will find that when you have Help Show Help enabled extensive descriptions of PMACPanel cluster items can help you understand what is displayed and what operations are performed by controls and indicators Cluster Item Access The individual items of each PMACPanel cluster are named and given a Tab Order Within PMACPanel they are generally unbundled without the name so that the diagrams are a little easier to fit on a single page The diagram below demonstrates the two different techniques for accessing the individual items of a cluster Standard Unburndle Tab Order determines which tem i connected to which terminal ouwe got to provide access to all of the tems even those ou don t want Unbundle by name 3 Motor Activated Open Loop oy can select which item Is accessed by which terminal This i useful if you want only a few items 37 Chapter 4 Application Basics Using the mouse on function VI terminals you can easily create cluster constants if you require them These can then be filled with the appropriate data Clusters Contain Controls or Indicators but not Both Clusters are wonderful for grouping commonly used items together to make your life easier A majo
76. EW Chapter 9 PMAC and NI DAQ Interfacing examples We made a few modifications to the DAQ examples such as defining defaults for the sample rates and channel configuration to demonstrate the sampling of the Compare Equal output Servo clock and a simple analog signal This allowed us to create the examples quickly and validate the operation of PMAC in a more demanding execution environment PMAC and AT MI0 16 Signal Connections The following examples were built using a PMAC Lite and a National Instruments AT MIO 16 The MIO card signals were accessed using a SC 2070 termination card The various PMAC signals were accessed using various terminal blocks of the proper sizes See the Hardware Reference Manual for your PMAC for a list of mating connectors In our examples the DAQ triggers are driven by ENC1 There is no reason other encoders or combinations of signals from multiple motors can t be used with simple modifications PMAC Signals JRS232 10 pin connector Pin 8 Servo clock SERVO Pin 9 Common JEQU 10 pin connector Pin 1 ENCI Compare Equal Output EQU1 Pin 10 Common JMACHI1 60 pin connector Pin 55 ENC Home Flag Input HMFL1 Connected to External TTL Clock Pin 58 Common ATMIO Signals OUT2 Scan clock Wired to PMAC SERVO EXT TRIG Start trigger Wired to PMAC EQUI CHO Wired to signal generator CH1 Wired to PMAC EQU1 CH2 Wired to PMAC SERVO Commons Groun
77. FLAG inputs Hence your use of these inputs must be coordinated with the system manufacturer s usage 187 DAQ Signals This manual in can no way cover the wide selection of NI DAQ boards or their signal sets For the purposes of this chapter we will consider a few general signals found in some form on most National Instruments DAQ boards that can be used to trigger acquisitions and define the DAQ sample rates More detailed information can be found in the LabVIEW DAQ examples and tutorials and the manual for your DAQ board All of the examples in this Chapter use the standard LabVIEW examples Connections to the DAQ board are best done using one of National Instruments many terminal blocks or breadboards The terminals are well labeled and the chances for shorts are limited Analog I O Channels You may or may not wish to connect PMAC output signals to the analog input channels on your DAQ board In several of the examples that follow we connected the servo clock and JEQU signals to Channel 0 and 1 for the purposes of demonstrating what the clocks look like To configure test and operate these inputs refer to the appropriate National Instruments manual Trigger and Scan Clock Connections PmacDAQMove 188 You can trigger acquisitions from PMAC in many ways You can use the JEQU signal to start or stop acquisition at a precise position or you can use general purpose digital outputs and synchronous M Variables The servo clock
78. ICVs to facilitate your application These are all documented here Encoder Register Access VIs to access the encoder registers are provided but are generally not used in your applications They are however very useful when beginning to work with the encoders The most important of these are 180 Chapter 8 Encoder Capture and Compare Operation e PmacEncoderRegStat Fetch the encoder control status word for Encoder Number and parse it into its pieces Encoder Status Control 132 is the integer representation of the register Position Capture Control can be used with PmacEncoderCaptureControl Capture Flag Control can be used with PmacEncoderCaptureFlag Encoder Status Control Cluster can used with PmacEncoderStatControl Encoder Status Flag Cluster can be used with PmacEncoderStatFlags Encoder StatusContral m2 Position Capture Contral gt Capture Flag Control ERcoder Status Control Cluster Encoder Status Flags Cluster Device Number 132 0 Encoder Number 132 1 16 1 e PmacEncoderRegServo Query PMAC for the two position registers containing commutation phase and servo position Servo Position is actual encoder position in counts referenced to a power up reset position of zero Encoder Phase 1s used internally for commutation Device Number 132 0 Ere Encoder Phase 132 Encoder Number 132 1 16 1 Serva Serva Position te e PmacEncoderRegisters Query PMAC for all registers for Encoder Number Assemble the value
79. M YVarnant Array Chapter 6 Encapsulated Motion Programs and PQMs 145 Using Encapsulated Motion Programs We ve already seen the panel for PmacPQMExamp Lets look at how PmacPQM ICVs can be combined with the custom PmacProgSubVI created by PmacTerminalEdit to build great applications The diagram for the example is shown here Dey Open C S Defs bitre Coord lE Close een mt Parra Hotor Position Handle Datalog of PAH arra poma s D atalog Control 2 e Datalog Display D atalo f D z la Reena P rh Fa ha ira is ha hats a hee he hee Pe r eon ies rora rars File ai li i Read rite C cle Ef Dlog nn e c ubyl HI a gt a fe J Convert PQM controls to ara MachineQutput Acc Show Prog gH Mou De PAM jo La A la A La P a la la La A la Update PUH controls Reg eT oe oe oe oe eg eat e Te T MRP Ril P iii ccc 1 r i 1 Ca 1 a 1 f l 1 5 s a OE T iii f D a oc ce i ir ms Acceleration in m5 a a a BEX Move 1 in crn a a ak ad ak ak ak ak ake ae ak a ak an ak ade ak ad ak a a ak ak ak ak ake ke ak ok ak ok ak a ak od ak ad ad a ak ok ak ok ak oka 2 2 Delay in mS xf E E E T g Erle a a F t z h P g M d a t auns t a t up T Erm Beet eee i Menu Fetch new POM data re eceepenetececceecccecee cece cece cececeeancecnencd The application has the standard execution loop with menu processing and a Stop button In the mid
80. MAC requesting the position for motor 1 as long as the button is TRUE The response string is displayed both as a string and converted into a numerical value for display When sending any motor or coordinate system specific command to PMAC you should include the motor or coordinate system number with the command to prevent LabVIEW s execution order from sending addresses and commands in whatever order it desires The next exercise demonstrates how PMACPanel simplifies these operations further Button and Response VIs The PmacResponse VIs send commands to PMAC and convert the ASCII response string into LabVIEW numeric data types This relieves you of having to scatter string conversion VIs all over your application There are more members in the PmacButton collection introduced in PmacTutor3 that use the PmacResponse VIs to convert ASCII string responses into numeric data PmacResponse PmacResponse consists of 6 VIs one for each type of numeric response conversion supported If you have a data type you truly want to support you can easily add it by copying and modifying one of these When using these VIs refer to the PMAC Software Reference Manual determine the size of the response whether it will be signed or unsigned and whether you will be manipulating the bits of the response PmacRespGetDbI is used to introduce the collection e PmacRespGetDbI If Command String is not the empty string send it to PMAC and wait for a respo
81. P L C F L E a Tue FP subi og Control ee A EA Subi LTE Enable Compare a i a D cable Conade TLE ABEEB AME LEME MEMEDE BA LEBA LEALE ALEEA LE kA LS LAS Configure Compare i Encoder Compare E gual Control Cluster rr 43 gt fc The three VIs as named in PmacDAQ are described below The name of the original VI in the LabVIEW example library is included in parentheses We will discuss the DAQ VIs briefly in the following sections with a view to understanding PMAC s signals and their use by the DAQ board e PmacDAQTrigger Cont Acq amp Graph buffered D Trig v1 This VI continuously acquires data from one or more analog input channels when a digital start trigger occurs This is a timed acquisition meaning that a hardware clock is used to control the acquisition rate for fast and accurate timing It is a buffered acquisition meaning that the data are stored in an intermediate memory buffer after they are acquired from the DAQ board Data are retrieved from that buffer and displayed on the graph e PmacDAQSync Acquire N Multi Digital Trig v1 This VI retrieves the specified amount of data from one or more analog input channels each time a digital start trigger digital stop trigger or digital start and stop trigger occur It shows how to trigger an acquisition multiple times while avoiding the overhead of configuration and buffer allocation each time This is a timed acquisition meaning that a hardware clock
82. PComm32 will shift things around and it is very likely that your remaining buffers will contain garbage If you do delete a buffer you should delete and recreate the remaining buffers You are encouraged to try this using the example If you un check the Enabled box that buffer is deleted Chances are VERY HIGH that the remaining buffer will give you garbage data Un check the remaining buffers and then re check them Things will now behave as expected The diagram for this example demonstrates how easy it is to create and access a buffer At the top left is the VI to handle the Gather Select Cluster Check the section on PmacTerminalGather if you have questions On the top right are the PLC and motion program handlers o pee Gather Selection Tem C aa A Tue ee PLC Enable PLC PLC Enabled Program Running POM1 Lat sow is SAL asta J Gather Spec Cluster Gather Select Cluster pec men cra et arson aro n EE SE F B M x Pareles A Open Show PUMI Panel FP F ss i peer _ a a ee DEL BGE Status Cluster Group 2 BGE Status Cluster AE fteration Timer mS a A poe a 238 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual There are two almost identical configurations to handle the two buffers Each consists of a configuration VI PmacDPRVarBackConfig and PmacDPRVarBack to actually fetch the data The configuration VI requires a Gather Spec C
83. PMAC Fanel a elect EEA a i Maw Wale Tau Data Been i ene DELTA TAU Ny Data Systems Inc NEW IDEAS IN MOTION Single Source Machine Control Power Flexibility Ease of Use 21314 Lassen Street Chatsworth CA 91311 Tel 818 998 2095 Fax 818 998 7807 www deltatau com Copyright Information 2003 Delta Tau Data Systems Inc All rights reserved This document is furnished for the customers of Delta Tau Data Systems Inc Other uses are unauthorized without written permission of Delta Tau Data Systems Inc Information contained in this manual may be updated from time to time due to product improvements etc and may not conform in every respect to former issues To report errors or inconsistencies call or email Delta Tau Data Systems Inc Technical Support Phone 818 717 5656 Fax 818 998 7807 Email support deltatau com Website http www deltatau com Operating Conditions All Delta Tau Data Systems Inc motion controller products accessories and amplifiers contain static sensitive components that can be damaged by incorrect handling When installing or handling Delta Tau Data Systems Inc products avoid contact with highly insulated materials Only qualified personnel should be allowed to handle this equipment In the case of industrial applications we expect our products to be protected from hazardous or conductive materials and or environments that could cau
84. PMAC for your applications One of PMACPanel s nicest features is that it can create a wrapper VI around a native PMAC motion program that allows you to easily integrate the program into your application Chapter 7 Homing Encoders and Position Capture When you use PMAC in a test and measurement application establishment of an accurate home position is important In this chapter we introduce VIs that enable you to do this from your application and introduce PMAC s HW position capture capabilities Chapter 8 Encoder Capture and Compare Operation This chapter introduces PMAC s ability to generate HW and SW triggers at specific motor positions This includes a suite of VIs to configure these capabilities and encapsulate PLC programs much like the wrappers introduced in Chapter 6 Chapter 9 PMAC and NI DAQ Interfacing Chapter 1 Overview In this chapter we show you how to tightly couple PMAC with standard NI DAQ boards to establish triggering conditions and if required sample by sample registration of acquired data with motor positions Chapter 10 PComm32 Code Interface Nodes Accessing PMAC s DPR in an efficient way requires the use of LabVIEW Code Interface Nodes CINs CINs are compiled C code that a CIN calls when executing In this chapter we discuss some basic issues associated with using Pcomm32 in CINs and develop an architecture for adding new CIN rapidly Chapter 11 DPR Dual Ported RAM
85. PR This directory will be empty if you did not purchase the PComm32 package Sample Applications This collection of VIs demonstrates a general PMACPanel application and a set of tutorials to walk you through the correct use of PMACPanel capabilities PmacTest An all encompassing demonstration of program encapsulation and monitoring with 4 different motion programs their PQM configuration and real time strip chart monitoring PmacTutorial A sequence of exercises covered in Chapter 4 These exercises introduce you to the basic architecture and proper use of PMACPanel in your own applications All first time users of PMACPanel should read this chapter and examine the tutorial VIs PmacDAQ This collection of VIs utilize standard LabVIEW analog input DAQ example VIs and a PMACPanel motion VI to demonstrate a few of the techniques you can use to integrate PMAC and NI DAQ boards to develop precision motion based data acquisition applications Chapter 3 PMACPanel Basics Miscellaneous Utilities This collection provides many VIs used to implement PMACPanel without regard to a specific category PmacSetup True maintenance of a deployable PMAC application requires Pewin32 This collection of VIs is the start of set of VIs to download and maintain the configuration of PMAC s numerous P Q M and I variables For the purpose of speed the VIs are implemented using CINs PmacUtility This collection provide controls and
86. PR Fixed Background Example 4 5 d 5 A Valid Output DPR Fixed Coordinate Cluster E BF 6 OPA Fixed Motor Cluster oo e Comm d Pos Dbl DJ J ae BE Tarcet Pos Dbl M Tine Move i32 i g 1 g oo Bias Fos Dbl ET Time Accel 13 Motor Number Coord System go Velocity Dbl Prog Remain 132 Coordinate Axis i In Pos BE Pros Exec 132 Enable _ Motor Motion pao En AE Amplifier Prog Mode 4 5 Fault Error J E wW aming Fatal i Following Error Following Error 1 p MOEk Home Enable Motor Numbers Enabled Program 13 Iteration Timer m i Motion Mode Amplifier Fault Error Fatal Following Error Warming Following Error Single Step Ho Program Running Continuous Hotion Reg Continuous Motion Mode tone Run Time Error Circle Radius Error i Hl disks Chart 4 5 0000 0 Target Pos z 100000 0 Velocity J f 0 0 Comm d Pos 1 g iei Time in Mov Motor Humber na 1000000 0 il ats 8 eF a e 2oonaggg ws alo V i 10 0 Valid Output g 00 2000 0 Coord System Coord Axis sd 1000 0 Buff Len E 0 0 Enable a 1023 D To execute the example select how many motors you want PMAC to copy to DPR using the knob labeled Enable Motor Numbers and click the Enable button You can enable the operation of the display clusters by checking the box labeled Enable on the top left There are two clusters p
87. PRRealTimeVectors Query PMAC DPR for the Real Time Fixed buffer Motor and Servo data When Enabled is TRUE the Default state the data for Motor Number is fetched and used to build DPR Real Time Motor Cluster and DPR Real Time Servo Cluster Motor PVE Cluster contains data in encoder counts or coordinate system units depending on the state of Coord Specify Cluster See PmacMotorPVE for details on how this is done A successful query of PMAC s DPR depends on whether PMAC is accessing the memory If Wait For Valid is TRUE the VI places queries to PMAC until a successful read at which time New Output is TRUE indicating valid output data If Wait For Valid is FALSE the query may or may not succeed If the query fails New Output is FALSE and the output clusters contain the data fetched during the last read Device Number 132 0 ppp L New Output Bool Enabled Bool T poprad Butter Length i32 128 DPR Real Time Vector Cluster Motor Number 132 1 8 1 If you enable both portions of the example you should insure that each requests the data for a different motor We will discuss the reasons for this in the next section Servo Accurate Sampling There is an important issue regarding the PmacDPR Vector VIs that must be understood to avoid misconceptions PMAC is a very fast real time controller that generates more data than could possibly be used in any given application In Chapter 5 we discussed the PmacGather coll
88. Panel wraps selected PComm32 functions with appropriate logic to provide a transparent interface between your LabVIEW application and PMAC It provides three primary categories of access to PMAC These are e Device Management e Query Response ASCII and Binary Communication e Download Management Chapter 3 PMACPanel Basics 25 A Device Management Open Close Configure ASCII Commands Query Response and Responses Conversion To From LabView Datatypes Binary Variable Access Serial Bus DPR Comm PMAC Memory Map Download Management Manage Programs Highspeed Binary DPR Binary Buffer Status Data Data Buffers DPRAM MS Visual C Code Interface Nodes Device Management DPR is primarily Access to the device driver is handled with the PmacDevOpen VI configured intended to pass real earlier It defines whether Query Response communication uses the Serial Port time data gathering buffers and binary Bus or DPR Pcomm32 hides all details associated with a given mode from the data for operations like inverse user If your PMAC is inserted into your host computer Bus communication is a kinematics between PMAC and sure bet DPR while slightly faster is not required If your PMAC is located the client It is not required for remotely then you need to communicate with it using the serial port If your general Query Response application does a lot of polling for status data you w
89. PmacDevOpen with a Device Number Communication Mode etc every time access your PMAC in more than itis used the VI was configured with defaults for the Device Number and one way it is easy to do Communication Mode in Chapter 3 If you have more than one PMAC or wish to access the device using more than one mode you can use one of two equally simple methods e Make copies of PmacDevOpen and rename the copies something like PmacDevOpenSerial or PmacDev0Open and PmacDev1Open Set the defaults for the Device Number and Communication Mode as desired Use these exactly as you would PmacDevOpen e Make a copy of PmacDevOpen and add input terminals for Device Number and or Communication Mode When using this VI provide the inputs and use the outputs exactly as you would PmacDevOpen Multi threading and PmacDevOpen PMACPanel and PComm32 readily make use of LabVIEW s multi threaded programming model You can have multiple PMACPanel application VIs open PMAC and execute simultaneously without problems Chapter 4 Application Basics 43 PmacTutor2 Sending Commands and Getting Responses LabVIEW string controls do not treat a lt CR gt as anything other than a lt CR gt It is possible to tie this keystroke to a control on the panel Check the LabVIEW documentation on 44 The most basic interaction with PMAC is done using one of three PmacComm VIs e PmacCommGetStr Check if PMAC has data available When Response A
90. PmacMotorsPVE on your application panels The lower portion of the panel is a modified PmacCoordSpecify cluster used to specify a motor coordinate system and conversion from encoder counts to coordinate system units The modifications were made by replacing individual control items in the stock cluster with types that are more appropriate The Orange numeric position indicator and its caption indicate the motor definition within the specified Coord Number CS Definition Cluster CS Scale Cluster Coord Number Definition Sting Scale Factor Defined CA a Coordinate System 1 Conversion between encoder counts and coordinate system units are supported for Individual motors and arrays of motors Coordinate Specify Cluster Coord sys loo Motor 1 Y Motor Position 2g 49 Convert Bool EC ooo Menu minge are great for selecting motors and coordinate system numbers However they start at zero so remember to add 1 before using the value Chapter 4 Application Basics The diagram for the query of coordinate system definitions is simple The lower portion of the diagram demonstrates how to use the conversion VIs to convert and display the motor position data The Coordinate Specify Cluster in this example is made from Menu Rings whose index always starts at zero Because PMAC motors and coordinate systems start their number at one you must add one to the selection index This is not necessary if you use nume
91. PmacRespGetShort 53 PmacRespGetULong 53 PmacRespGetUShort 53 PmacResponse 29 53 59 PmacSetup 33 PmacSubVI 31 PmacPLCSubVI 165 PmacProgSubVI 118 126 136 137 144 146 148 149 PmacProgSubVICreate 117 248 e Index PmacTerminal PmacTerminal 26 31 44 102 107 109 110 114 115 167 170 176 177 PmacTerminalCoordIVars 102 PmacTerminalEdit 102 115 118 126 136 137 139 144 146 147 165 176 PmacTerminalExecute 102 118 137 PmacTerminalGather 102 122 126 237 238 PmacTerminalGlobal 103 PmacTerminalJog 102 103 105 114 PmacTerminalMenu 104 105 106 112 122 PmacTerminalMotorIVars 102 PmacTerminalMotors 102 122 124 125 126 PmacTerminalMotorsX Y 102 PmacTest 32 PmacTestCircle 147 PmacTestCircles 147 PmacTestExamp 147 149 PmacTestPQM1 147 PmacTestPQM1Panel 148 150 PmacTestPQM2 147 PmacTutor PmacTutor 10 125 6 78 7 83 114 PmacTutorl 42 PmacTutorl0 81 122 PmacTutor11 86 PmacTutor12 91 PmacTutor13 94 PmacTutor14 97 PmacTutor15 99 PmacTutor2 44 PmacTutor2a 47 PmacTutor3 47 50 52 53 PmacTutor4 52 55 59 PmacTutor5 55 76 PmacTutor6 57 PmacTutor6b 61 PmacTutor7 68 PmacTutor 73 PmacTutor9 78 PmacTutor1 41 PmacTutor2 41 PmacTutorApp 41 PmacTutorial 32 PmacTutorSub 41 PmacUtility 33 Position Querying 52 Position Capture 30 Position Extension in Software 151 Position Loop Feedback Addr
92. Pos Captured LED flashes on and off dutifully signaling the capture of the position When the capture condition occurs PMACPanel reads the capture register and converts it into motor position or CS units depending on whether the Encoder Counts button in the Jog cluster is activated When the motor is jogging the numeric updates with every tick of the HOME trigger signal PMAC Position Compare Operation 172 PMAC s encoder position compare function is essentially the opposite of the position capture function Instead of capturing the encoder position when an external signal changes compare operations generate a signal when the encoder reaches a specified position In fact the encoder register into which the captured position is written is used to store the position for compare operation Using this capability you can configure trigger events that occur at specified encoder positions in your system Because the triggering is implemented in hardware it is very fast and accurate In Chapter 9 we show how to use external TTL level signals to trigger data acquisition on NI DAQ boards Compare operations require three steps 1 Enable and configure the operation using the encoder control register 2 Load the compare position into the encoder register Chapter 8 Encoder Capture and Compare Operation 3 Monitor the compare equal flag in the encoder status register and repeat these steps as required These steps may be performed in a PLC
93. RGetCommandedPos DevNum MNum 1 0 PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 215 Position MNum BCount PmacDPRPosition DevNum MNum 1 0 BufferCount MNum Check for full buffer then copy to LabVIEW data structs if Buriercount MNum Butter Length 132 126 jc 4 BCount BufferCount MNum Resize the arrays in the structure NumericArrayResize ilL 1 UH ance DPR Real Time Vector Cluster POSr vO Timer 132 BCount DPR Real Time Veer Ol ster zoer VO Timer 2 92 2 di moL7e BOCOURE ie eas SizeL BCount sizeof int32 SizeD BCount sizeof float64 memcpy DPR Real Time Vector Cluster gt servo Timer 132 gt Value ServoTimer MNum SizeL memcpy DPR Real Time Vector Cluster gt Posiucton Dbl Valtie Position MNum SizeD I Indicate a valid butrier to caller and reset buffrer counter BufferCount MNum 0 ValidData LVTRUE else Validbata LVEALSE No valid buffer PmacDPRSetHostBusyBit DevNum 0 PMAC can do its thing return noErr CIN MoErr CINLOad RSrerile TT TAT ae Reset the buffer counters POI Ca SOS a K MOTOR MAX i BufferCount i 0 return noErr It s a bit longer than PmacDPRRealTimeMotor but has much the same structure The PMAC Busy Bit is processed as before Instead of assigning the 216 e
94. Rom Date and Rom Version of your PMAC as shown here 18 Chapter 2 Getting Started Fie Edit Dperate Project Windows Help Communication Hode Device H umber Bus Pmac Type 0 Y 0 o Device Number i32 0 Rom Date Date Rom ersion Version ieee 01 12795 pias 1 156 Ls If you see something like this on your panel Congratulations You have successfully installed PMAC and the PComm32 communication drivers on your system Proceed to Chapter 3 PMAC Communication I Variables Chapter 2 Getting Started PComm32 supports communication with PMAC using UNICODE and standard C C ASCII strings PMACPanel is configured to use C C ASCII strings not UNICODE due to the use of LabVIEW s Call Library VI to interface LabVIEW with PComm32 PMAC uses I Variables to define communication characteristics These are important to verify because the behavior of PMACPanel depends on their value If PMACPanel communication is not operating properly configure these values using Pewin32 or the PMACTest application included with PMACPanel I1 Serial Port Mode This parameter specifies whether PMAC will use hardware flow control using CS and whether a software card address is required with each command At present no software card address is required hence I1 should have a value of 0 or 1 If desired a card address can be pre pended to all communication with some modifications to PmacCommSendStr PmacCommGetStr and PmacCommR
95. TRUE Coord Defined is TRUE and position is scaled from encoder counts to CS units Coord Definition is a string specifying position units as Encoder or the CS definition of the motor Coord Defined Bool Position Double Coord Definition String Device Number 132 0 Coord Specify Cluster e PmacMotorVelocity Query PMAC for Motor Number s present actual motor velocity scaled in counts servo cycle rounded to the nearest tenth The raw response reports the contents of the motor actual velocity register divided by Ix09 32 This is converted to counts msec by multiplying by 8 388 608 and dividing by the I10 default 3 713 707 If 110 is changed modify this value in the diagram Coord Defined Bool Velocity Double Coord Definition String Device Number 132 0 Coord Specify Cluster e PmacMotorError Query PMAC for Motor Number s following error Following error is the difference between motor desired and measured position at any instant When the motor is open loop killed or enabled following error does not exist and PMAC reports a value of zero Coord Defined Bool Following Error Double Coord Definition String Device Number 132 0 Coord Specify Cluster The implementations of these VIs rely on the PmacCoord collection to convert values reported in motor encoder counts to coordinate system units This capability is a fundamental component of PMACPanel You will get tired of seeing the description of this process Th
96. The logic of the if statement uses the current enable state of the operation and the desired state passed in by Enable Bool T_ to turn the DPR Real Time data buffer on or off Notice the type of the Boolean and that most parameters are passed as pointers to data PmacDPRRealTimeMotor CIN The diagram for PmacDPRRealTimeMotor is shown below You will note that the Device Number Motor Number and a FALSE Boolean constant are passed to the CIN The CIN returns two clusters and a Boolean indicating whether the fetch operation succeeded The CIN is only executed when the input Enabled is TRUE If Wait For Valid is TRUE the while loop will execute the CIN until New Output is TRUE thereby waiting until the fetch from DPR succeeds Repeated requests for DPR data is done by the diagram rather than the CIN code If the C code waited in a while loop that was never satisfied you couldn t abort your application Enabled Bool T fe Te Device Number i32 Coord Specify Cluster Code Interface Node Motor ee Cluster Motor PYE Cluster Hew Output Bool 4 208 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual CIN source include include include Types typedef struct be SEDI typedef struct E TDZ C This VI s CIN code has a simple structure but places many calls to PComm32 This is the reason we selected to implement this VI with a CIN rathe
97. VIs to modify file paths handle radio buttons etc Documentation Chapter 3 PMACPanel Basics PMACPanel has an extensive suite of documentation and help that can answer most of your questions This manual along with the various PMAC User and Reference manuals contains thousands of pages of information on every aspect of PMAC and PMACPanel There a numerous help files available and more being written all the time Check the Delta Tau web site for documents and help files for your system PmacDocument contains electronic copies of this document miscellaneous help items and a few useful bitmaps 33 Chapter 4 Application Basics Basics This chapter contains several systematic exercises that guide you through the hierarchy of PMACPanel to introduce the various concepts required to develop your own applications For detailed explanations of the individual VIs used in each tutorial consult the VI Reference If you have not used PMACPanel before this chapter must be read Although most PMACPanel VIs can be used as is the developer is encouraged to use them as templates that can be extended and customized to meet the requirements of your own application PMACPanel required over 1000 hours of development time time that you don t have to expend to achieve rapid and surprising results LabVIEW Techniques for PMACPanel 34 The following are general LabVIEW programming techniques not related to a specific PMACPanel VI and
98. Vectors 198 218 221 PmacDPRMotorVecToCoord 213 PmacDPRNumericCINCluster 23 1 PmacDPRNumericDbIl 226 PmacDPRNumericD Word 225 PmacDPRNumericD WordBit 227 PmacDPRNumericDWordBitTest 227 PmacDPRNumericDWordSetMask 228 PmacDPRNumericSlaveCluster 235 PmacDPRNumericSpec 227 PmacDPRNumeric Word 226 PmacDPRRealTimeConfig 205 206 PmacDPRRealTimeExamp 211 213 PmacDPRRealTimeMotor 202 205 208 211 216 PmacDPRRealTimeMotors 202 205 206 213 234 235 PmacDPRRealTimePVE 205 206 PmacDPRRealTimeServo 211 PmacDPRRealTimeVectors 211 212 213 214 217 218 PmacDPRVarBack 201 235 236 238 239 240 PmacDPRVarBackConfig 239 PmacDPRVarBackVectors 240 PmacEncode PmacPosCompSetup 175 PmacEncoder 30 PmacEncoderCaptureExamp 170 PmacEncoderCompare 179 PmacEncoderCompareConfig 177 PmacEncoderCompareExamp 176 PmacEncoderl VarCapture 157 158 159 171 PmacEncoderOffset 155 167 168 PmacEncoderPositionExamp 166 PmacEncoderRegADC 181 PmacEncoderRegCapture 181 PmacEncoderRegDAC 181 PmacEncoderRegisters 181 PmacEncoderRegServo 169 181 PmacEncoderRegStat 181 PmacEncoderRegTime 181 PmacEncoderStatFlags 160 PmacEncoderToCoord 168 169 PmacEncoderToEncoder 168 PmacEncoderTrigger 171 178 179 180 PmacPosCompGen 175 176 178 179 180 PmacPosCompSetup 175 176 178 179 PmacFile 31 PmacFileDatalog 144 146 PmacFileDatalogAppend 145 PmacFileDatalo
99. Velocity Error and The most basic motion operations involve controlling or jogging motors under manual control and monitoring the position velocity and following error during the move Requesting and Formatting P V and E PmacMotor has three VIs that request and format motor position velocity and following error for your use These require a Coordinate Specify Cluster input This cluster is more of a data type than a cluster associated with a specific control It is often assembled from controls in your own application It is defined as Coord Specify Cluster Cluster defining the motor CS and conversion state to be applied Coord Number i32 1 8 1 Coordinate number to use Motor Number i32 1 8 1 Motor Number to use Convert Bool Apply a conversion for the specified motor in the specified CS The VIs are e PmacMotorPosition Query PMAC for Motor Number s position PMAC reports the value of the actual position register plus the position bias register plus the compensation correction register and if bit 16 of Ix05 is 1 handwheel offset mode minus the master position register Chapter 4 Application Basics Device Number 132 0 Coord Specify Cluster Chapter 4 Application Basics Coord Specify Cluster specifies a motor within a CS and an attempt to convert motor position from encoder counts to CS units If the motor is not defined in the CS no conversion is applied If the motor is defined and Convert is
100. When the button says Background OFF the background PLCs are off Clicking on the button toggles them on and will now indicate Background On Implementation Diagram The diagram for this tool illustrates some important concepts in the development of tools and your own applications We will not cover the spaghetti diagram in the sequence frame at the top that handles the bookkeeping for the terminal screen The diagram is shown here Terminal window fia E visible Terminal Window Co iT Motor Positions i blots f T Prog F Fae ile Select i o Eo Deis Coord Cal Cal f Current Yl s Menu Motor ist Er Term Curr bola Menu Limst i Close Buffers Globe Buffer Open kg Buffer Buff Space Status Yls execute AFTER the terminal loop processed Query PHAC for currently addressed motor and CS If they execute concurrently with the loop terminal commands addeszing motors and CSs TF f wE will get out of sync and the indicators will not reflect the new a from the terminal E File Path I J eo Tue PPO La ma 43 gt G ite B File Path Chapter 5 Development Tools 111 112 The general framework should look familiar There is an execution loop a PmacDevOpen a Stop button and the PmacTerminalMenu items Several bookkeeping local variables are initialized outside the loop Most of the status indicator VIs are located in the lower left The currently addressed
101. a can be requested and converted using a single VI Chapter 4 Application Basics 53 Although the operations are more complex the diagram is simpler As we progress through more exercises the real power of PMACPanel will become apparent Status responses are not simple numeric values Open E utt hans i 1 i GSi ei Response String 1 Resp Motor 1 Realtime Position ee Jo ol aia This configuration places a request for Motor 1 s position 1p every iteration of the loop No button i used No case statement is required to limit the update of the indicator because a response is fetched every iteration PmacHespDbl does the converion from the ASCII response string into the Lab View numeric Send Latched lMerging PmacHesponse and PmacButtons together makes your life even easier 54 Chapter 4 Application Basics PmacTutor5 Accessing PMAC Status PMAC supports up to amp motors and coordinate systems If your PMAC has fewer motors PMAC ignores commands to them Chapter 4 Application Basics PmacTutor4 demonstrated the conversion of PMAC responses into numerical LabVIEW data types Several responses require conversions that are more sophisticated PMAC status is returned as 12 hexadecimal characters for a total of two 24 bit status words Because status is critical to successful integration of PMAC with your LabVIEW application there are three VIs that request status and conv
102. ability as you progress from the lower levels to the higher levels PMACPanel Directory PmacCIN Organization DPRand PmacDPR Sample Applications PmacTest Other Tools Pmacinterrupt PmacTutor PmacSetup PmacDAQ PmacSubV Program Development PmacProgram Data Gathering PmacGather Encapsulation Tools PmacPLC Graphical Tools PmacAddress PmacPQM PmacPlot PmacFile PmacTerminal GlobalICVs PmacGlobal Motor ICVs PmacMotor Accessory PmacAcc EMACMOIS Coordinate PmacCoord a rill e System ICVs gg g Miscellaneous Query PmacResponse Utilities Interfaces PmacButton ICVs Indicators PmacSetup Device Management PmacDevice Controls Pmacutility and Communication PmacComm Vis PmacDocument PmaclVar PmacMemory PComm32 PMAC 28 Chapter 3 PMACPanel Basics Within each category are several sub directories containing collections of indicators controls and VIs ICVs that provide capabilities to make your application development task easier The VIs in each sub directory follow a naming convention that makes them easier to locate For example in the directory PmacCoord all VIs are named PmacCoord The names of VIs in a given sub directory may have shortened names to make them a little easier to fit on screens and such For example VIs in PmacResponse are shortened to PmacResp The collections of VIs in each category implement most commonly used capabilities and generally have examples to demons
103. able Background data buffer In each of the four collections contains e A configuration VI to enable and configure the operation e V Is to read or write the data using convenient clusters and types e VIs to buffer multiple data samples into vectors for charting and analysis e Examples of all capabilities Several indicators and controls are provided to handle the data in easy to use clusters In many instances previously introduced concepts and clusters are used in ways that tightly integrate the new capabilities available through DPR into PMACPanel s familiar architecture We are not going to cover the CINs for all of the VIs in these collections Once the structure of a configuration fetch and vector VI are understood for one of the collections the others will be readily duplicated You may well find that your applications require a slightly different architecture than that presented here If so you can modify the existing CINs to suit your particular needs Required Background Understanding Before reading this material you must have some familiarity with PMAC s DPR capabilities This can be found in the PMAC User Manual PMAC Software Reference Manual and PMAC Dual Ported RAM manual The architecture of the CINs to support the VIs is heavily influenced by the PComm32 DPR API so having that manual available is also necessary In particular the Chapter PComm32 DPR Features should be read before proceeding General Architectur
104. achine configuration using LabVIEW s powerful analysis suite PmacGather This collection of VI s allow the user to select motion variables to control the collection and conversion of data into standard LabVIEW analysis formats Collected data can be output to files in tab delimited format for export to programs such as Matlab or Excel PmacAddress A collection of tools for specifying addresses scale factors and descriptions for gathering Variables not already accessible from PMACPanel can easily be added to the tables PmacPlot A few generally useful plotting VIs for setting plot colors and legends An XY Chart buffer is available to make an XY plot into an XY strip chart Code Interface Nodes and Dual Ported RAM PMAC Dual Ported RAM DPR provides a high speed binary data transfer mechanism that greatly speeds access to certain types of motion data To facilitate this capability PMACPanel utilizes LabVIEW Code Interface Nodes CINs This collection of VIs demonstrates how to use this capability PmacCIN A detailed description of the process required for configuring your environment to use CINs with PMACPanel PmacDPR A large collection of VIs for configuring and operating the many modes of DPR supported by PMAC There are numerous examples demonstrating the use of DPR and how to modify the supplied collection to suit your purposes PmaclInc A directory of include files required to use CINs or modify PmacD
105. al demonstrates two VIs One that allows you to access the general purpose machine input port and one that accesses the output port On the demonstration box used for the development of PMACPanel switches drive the inputs and the outputs drive a set of LEDs When running the example the GP Machine Input indicator directly reflects the operation of the physical switches Chapter 4 Application Basics The physical inputs are copied into the output port located in a different bit field to drive the GP Machine Output array and the LEDs on the physical device If you check the Counter box a bit is rotated through a number and written the physical port thereby driving the LEDs This is shown on the diagram below 97 GP MachineUutput The two VIs that implement the example require a little discussion so that you can comfortably develop or modify your own PmacAcc VIs e PmacAccMachinelInput8 If Set Get is FALSE or not wired get the Machine Input Port contents Response Available will be TRUE to indicate the Outputs contain the value If Set Get is TRUE set the Machine Input Port using Input Value Response Available will be FALSE and the outputs default to Input Value Device Number 132 0 a boos Response Available Bool F SetGet Bool F lt 0 Output Value ue 0 Input Value ug 0 w utpat Bool Aray 3 e PmacAccMachineOutput8 If Set Get is FALSE or not wired get the Machine Output Port contents Response Available
106. am is down loaded a cluster indicating the coordinate system to use program number and Load State is created Program Wl State Cluster Se Program Loaded o rogram Humber 132 o oord Humber 132 I This cluster is used by a number of PmacProgram VIs to do useful things for you The diagram for the tool has a standard organization Note the use of PmacProgParse to parse the program window and generate the Program State cluster This cluster is hidden on the panel and not used in the tool 116 Chapter 5 Development Tools a P H Fr all T d 0 0og0 og0g0 ogd og0 g0 gd 0 0 Prompt the user for ad file when starting TF Taga oe alata toe alata Create PLC YI eo a True P aeaee a Sub Term Menu Save program PLE G withthe proper name O O fa C The next section discusses one of the most powerful features of PMACPanel the encapsulation of PMAC motion and PLC programs into a single easy to use wrapper VI Eii Encapsulating Motion Programs The Create Prog VI and Create PLC VI case structures at the bottom pass the program buffer to a very special VI that creates a VI wrapper for the program being edited The detailed use of your new motion or PLC program VIs will be covered in Chapter 7 8 and 9 e PmacProgSubVICreate Prompt the user for a file to save Program Buffer to Make a copy of PmacProgSubVI VI changing th
107. am to 4 30pm PST Voice 818 998 2095 FAX 818 998 7807 BBS 818 407 4859 E Mail support deltatau com al We invite you to use this service You can download amp upload files and read posted bulletins and Delta Tau newsletters Messages may be left for anyone who is a member user of the Bulletin Board System s All you need is a modem and ProComm Plus or similar communications program Many Download Upload Protocols such as Z Modem are supported Eastern U S Office Delta Tau Data Systems Inc 10754 Decoursey Pike Ryland Heights KY 41015 Support Hot Line Monday through Friday 8 30am to 4 30pm EST Voice 606 356 0600 FAX 606 356 9910 BBS 606 356 6662 E Mail support deltatau com BBS Settings Baud Rates 1200 to 19 2 8 data bits 1 stop bit No Parity European Office Delta Tau Data Systems International Industrieweg 175 Suite 7 3044 AS Rotterdam Netherlands Support Hot Line Monday through Friday 8 00am to 4 00pm GMT Voice 31 10 462 7405 FAX 31 10 245 0945 BBS TBD E Mail bradped xs4all nl Chapter 1 Overview Chapter 2 Getting Started Unpacking and Inspection After receiving and opening the PMACPanel package compare the contents to the packing list to ensure everything has been received If anything shown on the packing list is missing contact Delta Tau immediately Carefully inspect all components for signs of physical damage PMACPanel consists of e PMACPanel CD c
108. any of the PmacDPR VIs that use CINs are reentrant This is generally not a problem unless you are not careful how you use them If you have two Vector VIs buffering servo data for the same motor you will get strange results Sometimes one of the VIs will update the BufferCount and sometimes the other VI will update the count Eventually one of the two VIs completes the acquisition and gets the vector data leaving the other one without an acquisition Generally this is a mistake in your application logic and can be remedied by handling the distribution of the acquired vectors in your diagram One should use one Vector VI per motor thereby guaranteeing no need for mutexs to control access to the temporary data buffers PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 217 PmacDPRFixedBack PMAC s Fixed Background data buffer mechanism automatically copies 34 selected Motor Calculation Registers Coordinate System Control Registers and Program Execution Registers from their native PMAC locations to DPR locations when requested Whereas the Fixed Real Time data buffer is motor specific the Fixed Background data is Motor and CS specific therefore program specific PComm32 supplies a set of routines to read these from DPR and convert them into legitimate Intel formats This process hides the required handshaking between PMAC and the host to avoid collisions when accessing DPR Update of a particular item i
109. applet there will be no PMAC s listed in the Motion control devices list box This is because none have been Added to your operating system yet To add a PMAC press the Add button to get the following dialog box 11 Add Motion Device This dialog box prompts you for a device number to associate with the PMAC you are adding Always start with your first PMAC as Device 0 the second PMAC in your system as Device 1 and so on The applet will handle the enumerating for you Press OK to get the configuration dialog PMAC Device 0 Configuration Wace emar senal Part poe eo PULer Heare nse heradecmal saral Port O10 he amat WaN Ear ete aT Sddiess Modher TEETE None E Pamedal Gree eet With Weare rites are EET oco oe This is where you specify how PMAC is connected to your system and the resources used by PMAC The configuration you define here must match the hardware jumper settings on the PMAC itself and not conflict with those already assigned by Windows 95 or Windows NT to other system devices or National Instruments accessories Serial port communication requires the use of a serial cable When the configuration is properly specified click OK If PMAC is communicating with the driver properly the following dialog appears PHAC Motion Control Device Driv Chapter 2 Getting Started If there is a problem with PMAC the assigned resources or the driver the following dialog wil
110. ariant Array to the file specified in Input Datalog Display at the end of the file Update the Current Record and Num Records in Output Datalog Display Cluster Indicate the new data by setting new Datalog Display TRUE Append Record Bool meen Dy fmm New Datalog Display Bool F saan Output Catalog Display Cluster Input Datalog Display Cluster Input PQM Yanant Array e PmacFileDatalogRead When Read Record is TRUE read Output PQM Variant Array from the file specified in Input Datalog Display using Current Record Update the increment Current Record in Output Datalog Display Cluster and display the Note if any stored with the record Indicate the new data by setting new Datalog Display TRUE New Record Bool F Qutout Catalog Display Cluster a Qutput PUM Warant Array Head Record Bool Input Datalog Display Cluster e PmacFileDatalogCreate Create or Open an existing datalog file to store data of type Input PQM Variant Array along with notes When Create Open is TRUE use the path in Input Datalog Cluster If this path is empty or Not A Path display a file selection dialog When a file name is entered or an existing file is selected the number of records in the file is determined All updated information 1s available in Output Datalog Display Cluster and indicated by New Datalog Display TRUE Create Open Bool log ee New Datalog Display Bool F Input Datalog Display Cluster ad eat Output Datalog Display Cluster Input PO
111. ation logging is enabled Log Enabled Bool Log String and Num Commands reflect the state of the log buffer when logging is enabled Log String is the empty string Num Commands 1 and Log Enabled is FALSE when logging is disabled When Log Empty is TRUE the log buffer is emptied Log Enabled Bool F Log String Num Commands i32 1 Log Enable Bool Log Empty Bool PmacCommAppend Copy Command String and Response String to the Last Communication items in PmacCommGlobal If Logging Enabled is TRUE they are also appended to the Communication Log Command String Comm Response String pp d The panel for this exercise demonstrates how communication is logged The VI queries PMAC for the value of 1123 When Good Bad is clicked the incorrect command j is sent resulting in an error You will see the log of this bad command in the Command String and Response String items in the PMAComunication Cluster on the right You will also see the error dialog pop up allowing you to continue or abort the application click Continue Chapter 4 Application Basics e Ss paee If you click the button Buffer Enable all communication is appended to Communication Log Buffer in the cluster You can stop logging by clicking Buffer Disable This only stops the logging of communications If you click the Buffer Empty box and click Buffer Enable the buffer is cleared before logging is enabled The diagram for this exercise i
112. ative 1125 Sc000 Use Flagsl for Motor 1 limits enabled I1126 32000 Home offset of 2000 counts gt enough to take you out of the limit 1902 3 Capture on rising flag and rising index 1903 2 Use LIM1 as flag negative end switch T125 S2C000 Disable LIM as limits CMD 1HM Home 4l inte Limit and offset Out Of it WHILE M145 1 Waits for Home Search to start ENDWHILE Chapter 7 Homing Encoders and Position Capture WHILE M133 0 Waits for Home motion to complete ENDWHILE T125 SC000 Re enable LIM as limits DIS PLC10 gt Disables PLC once Home is found CLOSE End of PLC Using PmacTerminalEdit you can load this program and click the Create PLC VT to create an encapsulated PLC Sub VI for this PLC This has already been done for this homing PLC PmacHomePLCl vi and the other PLC and motion homing programs documented in the PMAC User Manual The raw encapsulated PLC Sub VI is shown here e PmacPLCSubVI PmacPLCSubVICreate makes a copy of this VI with a new name that matches the name of a PLC program Because the PLC program has the same name with a different extension this VI knows how to open parse load and run a PLC program without intervention or extra inputs It allows you to interactively monitor and change the PLC program s execution state Details of its implementation are contained in the manual The VI downloads the associated PLC program when first loaded unless this opti
113. ator cluster for the PmacMotorStat2 indicator containing the status for Motor Number Device Number 132 0 Kotor Motor Number i32 1 8 1 cal Motor Status Word 2 These clusters are organized to reflect the 4 bit organization of the status words The first column is for the first four bits 23 20 the second column for the second four 19 16 etc You should note that some bits are not defined hence they are Reserved or For Internal Use Also note that for motor status word 2 three bits are interpreted as the coordinate system to which the motor is assigned A Word on Status Indicator Colors Human factor considerations play a major role in how you assign colors to your application s status indicators Is Green good Is it TRUE If Green is TRUE and Red is FALSE then an Amplifier Fault is Green although it is probably not good Setting up your definitions can be very confusing In PMACPanel status indicators attempt to convey a generally useful meaning by the LED s color and text To clarify this a few examples are covered in more detail You should feel free to change colors and text to reflect the intent within your application e Following Errors These are Red when there is an error For these status bits that means the bit is TRUE When the bit is FALSE the indicators are Gray there is no error Gray can generally be interpreted as NOT TRUE 77 78 or not dangerous The text in the indicator says what the indicator
114. atus bits that are reserved and for internal use e PmacGlobalStatWord1 Create a status indicator cluster for the PmacGlobalStat1 indicator containing PMAC s global status Chapter 4 Application Basics 89 neal A Hear Lata t k e PmacGlobalStatWord2 Create a status indicator cluster for the PmacGlobalStat2 indicator containing PMAC s global status Device Number i22 0 a Global Status Word 2 Cluster PmacCoord ICVs 90 This series of exercises introduce the PmacCoord collection of ICVs Coordinate systems organize motors into familiar engineering measurement systems in which motion programs execute They define the scaling between motor encoder counts and engineering units such as inches centimeters degrees or radians They can also define coupling between multiple motors and a single coordinate axis You will not use these ICVs to configure your coordinate systems But you can use them to query the coordinate system configuration so that motor motion can be specified in coordinate system units rather than encoder counts Generally you will not work with these VIs at this level Their capabilities are integrated into other collections of VIs Chapter 4 Application Basics PmacTutor12 Using Coordinate System Definitions Chapter 4 Application Basics This exercise introduces ICVs for determining coordinate system definitions and parsing these definitions into LabVIEW data types that can be
115. bottom of the diagram is a labeled case structure labeled Compute Scale Factors for each table entry It is reproduced here for clarity Compute scale factors for each table entr Select the last case in the structure using your mouse and add another case The default last case is 29 so add case 30 or whatever you require If the scale factor is fixed and specified in the table wire the orange scale factor input tunnel from the unbundled cluster to the output select tunnel on the right Click through a few of the cases and you ll see what we mean This will copy the scale factor in the translation table into the scale factor item for the Address Item Cluster being built The case shown here depicts the scale factor computation for item 16 Actual Velocity at Address Offset X 0033 with stride 3C The units of the gathered data as documented in the PMAC Software Reference Manual Chapter 8 are 1 1x09 32 counts 1x60 1 servo interrupts 134 Chapter 5 Development Tools The scale factor in the translation table is 1 32 Hence this portion of the diagram computes ScaleFactor 1 Ix09 Ix60 1 When modifying the tables make sure that you keep an original copy of the PmacAddressMotors VI If you happen to pull a control out of the cluster or pull the cluster out of the array the table clears all entries Chapter 5 Development Tools 135 Chapter 6 Encapsulated Motion Programs and PQMs Basics
116. c Cluster gt M446 Mask 132 Input DPR Numeric Cluster gt M446 XOR OR Outpuc DPR Numeric Cluster gt M446 Bat Field PhacDPRNume ricDWordBit Set Get Bool E OXE 3p TAA Oy Input DPR Numeric Cluster gt M447 Bit Outpuc DPR Numeric Cluster gt M447 Bit PmacDPRNumericDWordBitTest OxEO4 Y 8 Output DPR Numeric Cluster gt M448 Bit PmacDPRNumericResponse Response Available Bool F pet GEL BOO oF ry I Ss return noErr 232 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual As with all CIN nodes LabVIEW writes the function declaration and defines the parameter types The macros require the device number be defined DevNum whatever it is in your parameter list The macros perform a conditional test for read write operations address calculations and PComm32 operations Generally the macros require an address and a pointer to the input and output elements of the cluster Bit operations require the bit number and Mask or Bit Field operations require the mask field mask and XOR OR operator The actual C code for the example contains the macros and their actual C counterparts to illustrate the operations performed If you ve followed the examples so far the operation of the macros will be obvious PmacDPRNumericSlaveExample This example uses PmacDPRNumeric and PmacDPRRealITime capabilities to build an application that allows the user to move a 2 axis X Y table
117. cccccccccecececeeeeeeeeeeeeeees 31 Data Gathering and Graphical Tools ccccccccccccccccccccceeceeeeceeeeeeeeeeeeeeeeeeeeeeeeeeeeees a2 Code Interface Nodes and Dual Ported RAM ccccccccccccceeeseeeeeeeeeeeeeeeeeeeeeeeeeeees 32 SETHE 6 sae 0 6101672110 8 fc ae RE ee nT Pe Se ee ed ee ee ee 32 Miscellaneous WUMIES si dcicnctradsareonenseaseeunaedieiaca tateaeverenateuns due SAO 33 Domena OI eesriie a set ay eam EE a teean esas OE 33 Chapter 4 Application Basics 34 BASIC asndan T AE EE 34 LabVIEW Techniques for PMACPanel ss0seeeeesenesensnsnnnnnssnnsnsssnsssssnsssssncssnneeees 34 PMACPanel Indicator and Control Clusters ccccccccccceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 37 Accessa PMAC Pane VIS irese TE cies etwas amok SEs ahead ee eesaase 38 Clusters With an Associated Function VI 0cccccccceseseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 39 PMACPanel VI Terminal Conventions cccccccccccccscceeeeeeeeeeeeeeeeeeeeeeeeeseeeeessseeeess 40 PMAC Panel Turia Ran a a E aT NE 4 PMACPanel Communication Tutorial ssraireiesp inte a vee esac aeeeeeashe 4 Pinacd utorlsAccessime PCOM 2 eect devices E E dental cee ee es 42 PmacTutor2 Sending Commands and Getting Responses ccccccccecccceeeeeeeeeeees 44 PmacTutor2a Communication Logging cccccccccccccccceeeceeceeeeeeeeseceeeeseeeseseseseeeeess 47 PmacTutor3 Sending Commands Using Buttons ccccccc
118. ccceeceeeeeeeeeeeeeeeeeeeeeees 50 PmacTutor4 Button and Response VIS cccccccccccccccccecceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 52 PmacTutor5 Accessing PMAC Statuses te civicadiesis nits beed iets escd ees 55 PmacTutor6 Accessing PMAC l Variables cccccccccccccccececeeeeeeeeeeeeeesseeseeeeeeeees 57 PmacTutor6b Accessing PMAC Memory cccccccccccceseeeeeeeeeeeeeeeeeesseeeeeeeeeeeeeeeeees 61 PMAC Pai CTC Gaiters tee ast ac Deh tal E EAA an E E ial ad eerie 65 iis linie C OMAN ted else lett vate aan Se sa alates aaa ete 65 Pma c Motoi TOW Soa ten et oie ta ees ete Hees ace an a else a A eee a dit 68 PmacTutor7 Position Velocity Error and Jo Qing ccecccccccccceeeeeeeeeeeeeeeeeeeeeees 68 PmacTutor8 Motor Control with Status Monitoring cccccccccccccccceceeeeeeeeeeeeeees 73 PmacTutor9 Motor I Variable Configuration ccccccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeees 78 Pac MOtOrS ION sacana Sr eae tea pet se eat enya esd dete eed a pettael 81 PmacTutor10 Requesting and Plotting Motor Motion cccccccccccccccceeeeeeeeeeeeees 81 Pia C GOW all TE VS 5 2525 22s testes ana a a eae 86 PmacTutorl1 Configuring PMAC s Global State ccccccccceeceeeeeeeeeeeeeeeeeees 86 Pacc oord CN Seier avausatececees Aasan tinal oso uaatessembail nace cea O 90 Table of Contents PmacTutor12 Using Coordinate System Definitions ccccccccccccceeeeeesssssstteeeees 9 PmacTutor13 Con
119. ch component is requested individually These controls have a Motion N Motion bounded ranges and 3 b O did ee Position Wage which motor to 5 p 7 a Velocity C S Units H 1 5 T Following Error If the motor is defined In a coordinate system the motor definition can be used to convert commands and measurements between C 5 units and encoder counts Motor Number Motor N Jog Pmac iEW displays motion Pre Jo Joa Relative states in two colors se a Blue gt Encoder Counts e JogTo Make Pre Joc Orange gt C S Units This cluster displays a motors position velocity and following error It s associated YI requests and packages all three for display in this cluster The bottom LED ts orange when the display is in C 5 units Encoder a 4 00 10 20 30 40 50 60 70 80 30 100 Encoder Counts BD This cluster groups the most common motor Jog commands into an easy to use control You should not we did not mix indicators and controls in clusters The numeric control is used tied to the slider control and specifies where to Jog To or how much to Jog Relative Encoder Counts tells the control s YI whether to interpret this yalue in encoder counts or C S units Generating On Line Jog Commands The front panel contains a cluster of controls defined by PmacMotorJogControl to group the most commonly used jog operations into a single panel item This cluste
120. ch here You will note that Booleans returned by PComm32 are converted to LVTRUE and LVFALSE before being assigned to the members of the clusters This is precaution that avoids possible mismatches in data types PmacDPRRealTimeVectorExample The following example demonstrates a very powerful PmacDPR technique that takes multiple samples over time This is done by placing repeated CIN that build vectors for the desired items This creates a simpler and faster VI diagram because building the vector is done by the CIN and the data is returned by the CIN only when a vector of a specified length 1s built The panel for the example is shown below The panel demonstrates the fetching of vectors for the purposes of driving a real time chart On the top left 1s a knob for selecting a motor and specifying the number of samples to accumulate before updating the chart On the bottom the same operations are performed but motor 210 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual items such as Position Velocity and Following Error are converted to CS units in the standard manner defined for PmacMotors On the left between the two sets of controls is a small block of controls to enable DPR Real Time data buffering Pmac DPR Real Time Vectors Example Servo Ditt Foston Velocity Follow Error DAG Motor Number Enable E T you Buff Length 028 TRIE J Valid Outp
121. chanical axes of the motor amp 1 i gt 86600 25X 5000Y fF2 gt 5000X 8660 25Y There is no easy way to parse this information when returned by PMAC and present it to you for use because there are so many possible ways of defining coupled motor systems Furthermore the individual items in the PmacMotors indicator clusters as defined would change definition every time you switch from encoder counts to CS units If your axes are coupled like this you should study the VIs presented here and modify them for your own use or you can hard code the scaling and motor state conversions into your application There are three VIs that use the scale factors provided by the previous VIs to convert numerical inputs from encoder counts to coordinate units and back This can be done for individual motors or all motors in a coordinate system e PmacCoordMotorToEncoder Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Value from CS units to encoder counts Ifthe motor is not defined in the CS no conversions is applied If the motor is defined and Convert is TRUE Coord Defined is TRUE and Output Value is scaled from CS units to encoder counts Device Number 132 0 Coord Specify Cluster Input Yalue Double Coord Defined Bool Output alue Double e PmacCoordMotorToCoord Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Value from encoder counts to CS units If the motor is not defi
122. cked Lather Data Vars Motor Help Shortcut Press key combination Select File Open to display the selection box then double click on PmacTerminal PmacTerminalMenu rtm or click OK This will change your VIs run time menu from the default or minimal options to custom You will note that the panel shows an Item Name as it appears in the menu and an Item Tag that is used by PmacTerminalMenu vi to decode your selection and execute the desired tool To add your own tools to the menu highlight an existing menu item entry and select Edit Insert User Item Give the new entry a name and a tag Save the modifications All existing PMACPanel tools using the menu capabilities will now reflect your changes If you ve added a new tool you must make some additions for your new VI Modifying PmacTerminalMenu To actually implement the new selection you need to add it to PmacTerminalMenu The diagram for the VI 1s shown here The instructions direct you to add a case for the Item Tag specified in the Edit Menu panel and to copy the VIs to execute your VI into the new case Once completed all tools can access each other without needing any new configuration 104 Chapter 5 Development Tools Enable Menu Track Bool T Ra aS Roa aa eM ia a a TATE TATE T RATS TE TNS i E a oe ee eer eter ee ere eee rnrrreyas E Bs ey aye aea Ea aea aea ea a aor arg ay ay ay Wado ad oy aa a aea oye era ae ae ao ea a aa m Pease yee ae aoa aoa oye gsr oy ry
123. click the appropriate gt button the specified variable is added to the selection list e On the bottom is a Custom Gather Specification cluster that allows you to enter a description address and scale factor Clicking its associated gt button adds this item to the selection list Be aware that the PComm32 library requires you to specify addresses as X Sx xxx Y Sx xxx DP S x If you want to write the gathered data to a spreadsheet file click the Write Spreadsheet radio button before executing the gather To actually gather the data click Step or Program Step executes a 250 mS step to 1000 counts and back to 0 counts using the motor specified in the menu ring used to setup the gather Program executes the encapsulated motion program wired into the diagram During the gather the Gathering indicator is green After the gather the data is plotted and the indicator turns gray If you selected Write Spreadsheet you will be prompted for a file name The diagram for implementing this tool is a great source of ideas for building gathering into your own applications Being a full application tool it requires a bit more work but it is not as bad as it looks it fits on one page Outside the execution loop all motor servo loops are closed by PmacMotorsCloseLoop To exit the loop the Stop button first sends a delete gather command to PMAC to free the buffer space Buffer space is monitored using PmacGlobalBuffers and an indicator
124. clusters The time required for this multiple motor fetch is on the order of 1 2 mS In this example you can select a Motor Index for display As shown a Motor Index of 1 displays the data for Motor 2 Dev peri 3 iorns DPF Enabled EE rae pi ca Sample Period DUI a DPR da DPR Real Time Servo Cluster maa i DPR Real Time Motor Cluster Enable Motor Numbers Wait For Valid LH Motor PYE Cluster 7 aa TFL a n DPR Real Time Motor sad z gt BFR Real Time Servo Clust z fiz G Eto EE The diagram for the example requires three VIs One to configure the operation one to fetch the data for a single motor and one to fetch the data for multiple motors Case statements are used to control the update of the display clusters The architecture of the PmacDPR VIs is a little different from most of those already introduced Whereas almost all other collections operate in a query response mode that is always enabled these VIs require the enabling of specific capabilities by a configuration VI Hence most PmacDPR VIs have an enable input that prevents them from querying DPR until it is enabled 204 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual On the top left the PmacDPRRealTimeConfig VI requires a Sample Period Enable Boolean and an integer indicating how many motors to copy The enable input is not latched When it is TRUE the Real Time data buffer is enabled When i
125. d PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 221 PMAC By avoiding the translation involved in standard ACSI communication you can move data between the host and PMAC much more quickly and it does not utilize precious P or Q Variables The process requires no explicit handshaking between PMAC and the host to avoid collisions when accessing DPR The PmacDPRNumeric collection consists of a number of VIs that use Call Library Function VIs to access DPR The simplicity of the interface doesn t require CINs We show how to access individual memory locations as doubles long 132 and short 116 integers bit fields and booleans The examples use encapsulated PLCs and motion programs to generate and process the data transferred between the example PMACPanel applications and PMAC If you use DPR for this purpose the examples are very useful DPR Addresses and Data Organization The mapping of memory addresses between the host computer on one side and PMAC s address space on the other side is simple To PMAC DPRAM appears as standard memory in the range D000 DFFF which can be thought of as AK of long 48 bit words or 8K of single 24 bit X Y words This memory is accessed using M Variables mapped to this address range Depending on the DPR mechanisms used Real Time Fixed Background Variable Background etc the lower portions of this memory space are automatically allocated Hence
126. d Visual Basic Applications with demanding computational needs can written in C and their needs can be communicated to PMAC using PTalk As an ActiveX control PTalk can be used from within PMACPanel Itis also possible to compile this code into a dynamic link library or as a LabVIEW Code Interface Node and use it from your own custom VIs in a PMACPanel application PMACPanel PMAC for LabVIEW 5 0 PMACPanel provides a complete suite of VIs to simplify and standardize your application s access to PMAC from LabVIEW It is divided into 4 basic levels or categories At the very lowest level are VIs that provide an interface to PComm32 Above this are two levels that provide collections of indicators controls and VIs that you can use in your LabVIEW applications to control PMAC and monitor its status Finally there is a level that provides program development utilities that can be used to encapsulate PMAC motion and PLC Chapter 3 PMACPanel Basics programs as VIs that are controlled by the application In general you will use the top three levels for application development Your Logic Development amp Encapsulation Indicators Your GUI amp Controls Command Generators PComm32 LabView Interface VIs PMACPanel Client Application PMACPanel Interface to PComm32 PMACPanel s lowest level provides a flexible set of capabilities through which all command interactions with PMAC is conducted To do this PMAC
127. d the home flag s and call this commanded location as motor position zero This register permits the motor zero position to be different from the home trigger position It is particularly useful when using over travel limits for a home flag offsetting out of the limit before re enabling the flag as a limit If large enough greater than 1 2 times home speed times accel time it permits a homing move without any reversal of direction The units of this parameter are 1 16 of a count so the value should be 16 times the number of counts between the trigger position and the home zero position Example If you wish your motor zero position to be 500 counts in the negative direction from the home trigger position you would set x26 to 500 16 8000 Encapsulated PLC Programs 164 In Chapter 6 we introduced VI wrappers that encapsulated motion programs and their operation into a single VI PMACPanel also encapsulates PLC programs The discussion of this topic was deferred until here because we now have a good example of their use homing from a PLC program The following PLC program PmacHomePLC1 pme taken from the PMAC User Manual and uses the LIM flag to establish a home position for motor 1 PLC Set up Variables to be saved ChOSE ML39 gt X S003Dy 13 1 Desired Velocity Zero bit MiL45 gt 7 S0314 10 1 Home complete bit PLC program to execute routine OPEN PLC 10 CLEAR LAZ3H 10 Home speed 10 cts msec neg
128. ded into memory When executed the first time Initialization State is set to TRUE and will remain that way until it is reset by an operation in this VI or the calling VI is closed thereby unloading this from memory Be aware that LabVIEW 5 0 has a bug handling this National Instruments plans to release a fix for this problem with 5 0 1 Until then PMACPanel 1 0 has added a few wires and local variables to fix this Mechanical Action Most PMACPanel VIs requiring Boolean inputs or buttons have their mechanical action set to Latch When Pressed You can configure your buttons as shown in the figure below Using this configuration the button is read once when pressed and reset to FALSE This is useful for preventing commands from being repeatedly sent to PMAC ls Change to Indicator Synchronous Display Find Terminal Show Data Operations Create kep Navigation Replace Data Range Mechanical Action p Latch when Pressed Release Text Chapter 4 Application Basics PMACPanel Indicator and Control Clusters PMACPanel makes extensive use of predefined indicator and control clusters to make your development task easier These clusters are easy to drop into your application You should understand what clusters are how to edit them and how to access the individual controls and indicators they contain An example of a Motor Status Jog Cluster PmacMotorStatJog is shown here Assigned to CS Running Running Hove
129. der compare operation These are extremely useful for synchronizing data acquisition operations with complex motion The three methods are e Using encapsulated versions of the PmacPosCompSetup and PmacPosComGen PLC s to generate position interval clocks e Directly setting an encoder compare position from your application for a one time position compare trigger e By servicing the control status and position registers directly from PMACPanel This is a poor man s approach to using the PLCs The panel shown below has Motor Encoder and Coord System knobs a Motor PVE indicator and a Jog control cluster At the top left of the panel is an LED that flashes green when a compare equal condition occurs Below this is a cluster of three buttons that allow you to configure the encoder control bits When these are properly set clicking the Configure Compare button sets the encoder bits The remaining controls are divided into three groups One for each method demonstrated in the example Chapter 8 Encoder Capture and Compare Operation e On the bottom left are LEDs indicating the Execution State of the two PLCs used to service the encoder and a button to disable the PLC handler e To the right is a numeric control used to specify a compare position and a button to configure the encoder for one time compare operation e To the right of this is a checkbox that enables encoder servicing directly from PMACPanel not the PLC The LED
130. detail Many of them are complex and require in depth knowledge of PMAC s internal memory map that are way beyond a reasonable user manual The last chapter contains detailed descriptions of the every cluster and VI in PMACPanel even those not detailed in the previous chapters Chapter 1 Overview This chapter is an introduction to the PMACPanel features manual layout important safety issues and how to access technical support Chapter 2 Getting Started This chapter specifies HW and SW equipment requirements installation of the SW configuration and testing of device drivers and basic testing of PMACPanel communication Chapter 3 PMACPanel Basics This chapter introduces the client server architecture that PMACPanel is based on and various issues involved in defining your application Chapter 4 Application Basics This chapter covers a number of LabVIEW techniques that are used in PMACPanel and may be new to you This is followed by a set of tutorial exercises that start with opening communication with PMAC and start you down the path of developing your own PMAC enabled applications Chapter 5 Development Tools PMACPanel has numerous tools for developing and testing applications These tools not only ease your development task they are a great source for components and ideas of your applications Chapter 6 Motion Program Interfaces This is where you really harness the motion computer powers of
131. detailed in Chapter 4 The PmacEncoderIVarCapture cluster and its two sub controls are documented here Chapter 7 Homing Encoders and Position Capture 157 158 PmacEncoderIVarCapture Encoder Capture Cluster Software Control Encoder Variable 2 8 Home Flag Position Capture Control C Limit Flag Encoder l Yariable 3 gt Limit Flag Capture Flag O Amp Fault Flag Encoder I Variable 2 Position Capture Control This parameter determines which signal or combination of signals and which polarity triggers a position capture of the counter for encoder n Ifa flag input home limit or fault 1s used 1903 etc determines which flag Proper setup of this variable 1s essential for a successful home search which depends on the position capture function The following settings may be used Setting Meaning Software Control Rising edge of CHCn third channel Rising edge of Flag n as set by Flag Select Rising edge of CHCn AND Flag n Software Control Falling edge of CHCn third channel Rising edge of Flag n as set by Flag Select Rising edge of CHCn AND Flag n Software Control Rising edge of CHCn third channel Oo CO ala A Nn A WO N e OS Falling edge of Flag n as set by Flag Select Rising edge of CHCn AND Flag n Software Control Falling edge of CHCn third channel BR UO N Falling edge of Flag n as set by Flag Select 15 Rising edge of CHCn AND Flag n
132. dle is the PmacProgSubVI VI created for the motion program PmacPQMTest pmce already introduced When the Cycle Read Write button is clicked a sequence of operations begins The PmacPQM clusters on the panel are translated into PmacPQMVariant clusters and bundled into an array The array is passed to PmacFileDatalog which appends the array to the datalog file ignores data logging or ignores the current input and reads a record from the specified data log file The array is passed to the encapsulated motion program VI along with a TRUE Boolean The wrapper VI will down load the variables to PMAC and start the program If PmacFileDatalog has new PQM array data due to because it read the data from a datalog file or simply passed the input array through the PQM clusters are updated with the PQM array This is done by the two case structures in the lower right of the diagram that convert the array items to appropriate types unbundle them and set the local variables for the clusters on the panel If this is the first execution of the VI the shift register will query PMAC for the current PQM variables and update the clusters This example program indicates its location in the program by setting bits of a standard memory mapped machine output The output is monitored by PmacAccMachineOutput8 and used to drive an indicator on the panel The VIs and indicators in the upper right display the coordinate system definitions and motor position The coordinate s
133. ds ATMIO DGND ATMIO AGND JEQU and JRS232 commons all wired together The panel for PmacDAQMove is shown below This VI 1s comprised of pieces from several of the previous examples It allows you to home motors Jog them configure capture and compare operations and initiate three different DAQ operations We will discuss these in a moment If you have connected your system in the manner described above or something similar you can begin testing the system by connecting EQU1 to an oscilloscope or by running the VI and using your DAQ board When you start the VI select the capture flag configuration and click Configure Capture Then home the motor When this has been completed you can set Chapter 9 PMAC and NI DAQ Interfacing 189 Compare configuration cluster booleans as shown below and click Configure Compare This VI uses the encapsulated PLC covered in Chapter 8 to monitor and update the compare equal operation The value 500 in the numeric control specifies the pulse generation interval You can change this if you desire and click Enable Reset Compare The Green LED indicates the PLC is running When you Jog the motor using the jog controls you should see the PVE display update and a pulse train on the scope You should probably use level triggering on the scope If you are doing this the pulse train will have stable intervals with jitter in the actual pulse widths This is because a background PLC services the encoder If you ne
134. ds you will be using Similarly you must have some understanding of PMAC s external connectors and their configuration You will be making connections between these boards If you are not certain of your abilities precisely which signals you need where to locate them or what to connect them to do not attempt to connect them You can easily damage the boards the host computers and many other items Make certain you have thoroughly studied the information presented in this chapter and the HW manuals provided for your model of PMAC and your DAQ boards Contact Delta Tau or National Instruments Technical Support if you have any questions prior to proceeding External PMAC Signals 182 PMAC provides a number of HW interfaces that can easily be used to synchronize PMAC with most NI DAQ boards and systems Depending on your needs PMAC also supports a number of I O accessories PMACPanel doesn t support all of these with ICVs It is way beyond the scope of this manual to detail all possible approaches to accessing the interfaces on these boards You can easily create your own ICVs for these accessories using PmacAcc and PmacMemory ICVs Chapter 9 PMAC and NI DAQ Interfacing We will consider three primary PMAC signals here Position Capture was discussed in Chapter 7 and will not be repeated here When interfacing these signals to DAQ boards we will demonstrate how to use these signals to trigger acquisitions and provide the sample scan cl
135. e Compare E qual Operation pel Re a ea Wea Bee ee ee en Pen Pen eo eo Boe eee ee ad PRR RRR Motor Encoder E atime g Encoder Compare E qual Control Cluster ncoder Compare E qual Eontrall Cluster E Enc Sw Update Update gt Trig CTE Compare Equal Compare Compare Value Compare Yalue TE Disable Comp ma FLC p Sub PEI erer i Comp Pulse PLC Comp Fun PE gS Update a pocion in PHACPanel when the PLC isn t doing ttl PLC L i Sub CF ry Comp Setup PLC PI 01 PLO S Ww Com pare Inte oe Setup and enable PLC compare operations E topl E _ dao E At the bottom of the diagram is logic to service the panel s P101 slider when it changes Changes in the value update P101 and enable the encapsulated PLC PmacPosCompSetup covered earlier Above this is the wrapper VI for PmacPosCompGen The panel button Disable Comp Pulse can be used to turn the PLC on and off as desired When this PLC is not executing a compare trigger occurs and SW increments is TRUE the case to the right executes and computes the next Compare Value The final piece of the example is PmacEncoderTrigger also covered earlier In this example the Enable Compare input is TRUE whenever Enable Compare or SW Update are TRUE This updates the encoder registers thereby arming the compare operation Chapter 8 Encoder Capture and Compare Operation We ve already noted that PmacEncoderTrigger ha
136. e Notes PMACPanel s DPR support is designed to be simple and extensible There is not a lot of error checking The basic assumption is that you have a DPR card with your PMAC PmacDPR doesn t automatically check for this nor does it automatically enable or disable itself As you inspect the examples you will see that each mechanism has a configuration VI As you develop your applications you might want to move these into your PmacDevOpen VI so that opening PMAC also enables DPR the way you desire PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 201 PmacDPRRealTime PMAC s Real Time data buffer mechanism automatically copies 27 selected Motor Calculation Registers from their native PMAC locations to DPR locations at a specified servo cycle sample rate PComm32 supplies a set of routines to read these values from DPR and convert them into legitimate Intel formats This process requires some handshaking between PMAC and the host to avoid collisions when accessing DPR from the host To minimize your work and simplify the interface the PmacDPRRealTime collection bundles the 23 most useful items them into clusters This ensures that all data items are gathered during the same servo cycle It also prevents you from having to wire 27 VIs PmacDPRRealTimeExample The following example demonstrates three PmacDPRRealTime VIs One to configure and enable the operation of Real Time data buffering and
137. e Number 132 0 Close Butters Bool F Butters Open Bool Available Buffer Memon re PmacGlobalControl Generate PMAC on line commands for controlling PMAC program execution and save state Command Executed Bool is TRUE when any button is clicked in Global Control Cluster Device Number 132 0 Globe Global Control Cluster Crh Lommand Executed Bool F PmacGlobalIlVarComm Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the global communication I Variables are set Otherwise they are fetched from PMAC and provided by Output Global I Comm Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Chapter 4 Application Basics Chapter 4 Application Basics Device Number 132 0 _ _ New Output Bool IF Set gt iiget Bool F E Input Global l Comm Cluster a Output Global l Comm Cluster e PmacGloballVarMove Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the global movement I Variables are set Otherwise they are fetched from PMAC and provided by Output Global I Move Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 132 0 __ _ Mew Output Bool F Cet iGet Bool F A Input Global l Move Cluster CA Output Global l Move Cluster e PmacGlobalStatBuffer Create a status indicator cluster for the PmacGlobalStatBuffer indicator contain
138. e case is executed and the array is auto indexed The cluster of attributes is unbundled and used to set the three attributes for the plot One important thing to note is that Motor Number and Coord System are specified using LabVIEW rings These controls start their indexing from 0 not 1 Hence to use them to specify legitimate motors and coordinate systems they must be incremented by one You can change the range on the ring from 0 7 to 1 8 However this leaves item zero in the ring empty all positions Pmac Motors Chart Perl Motor Number Mrs P Close Em Close all motors H A Get C S Defs TrF fo i A for displa ia N Mitre padre E 7 GE ann Ca Plot Select Def Le 5 Defs LELELLELLELLELLitt Actve Plat i e HE Plot Color H m wn TF m E Add 1 to get the motor number Rings start their indexing from 0 e a Set plot attributes based on selections Use autoindexing to process array of and C_5 clusters Ci Chapter 4 Application Basics As you begin to develop your own applications you will create your own simple VIs to do common things for you PmacMotorsClose is an example of this The VI and its diagram are shown here If you find yourself repeatedly sending PMAC simple commands in your application you should begin creating your own set of useful VIs e PmacMotorsClose Close all PMAC motor loops Device Number 132 0 nae Device Number i32 0
139. e clusters The architecture for configuring the I Variables is slightly different from that used to configure motors There is no Motor Number equivalent that can change Instead a shift register is initially set to TRUE to force an I Variable read and set FALSE for every other iteration 88 Chapter 4 Application Basics C Close Buffers gt Close ma Global Buffers Open el a Buffer Available Buffer Space D Ey Open Global Control G lobe Ctrl lobe EA Eta Glohe Gather Status Gath a Lom P Global Communication lars Force Initial i Global Communication l Yars E i Globe Leet Mov Global Move Vars Global Move I ars PmacGlobalBufferSize provides two capabilities The VI queries PMAC for available buffer size and parses the state of the buffers and their size When Close Buffers is TRUE PMAC executes a command to close the open buffers and delete the gather buffer Generally an open gather buffer prevents the download of any new program or modification of any existing program Device Number 132 0 ulfers Open Bool i32 cloze delete gather Close Buffers Bool F Global Status ICVs In typical fashion the PMACPanel global collection of ICVs provides a pair of indicator clusters and associated VIs to monitor all global status bits The icons for the VIs and the indicator clusters are shown below Unlike the PmacMotor status word clusters these clusters have many st
140. e control input PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 227 e PmacDPRNumericDWordSetMask This VI operates on the DPR DWord bit field specified by DPR Numeric Spec Cluster When Set Get is FALSE the default state the Mask specified by DPR Numeric Spec Cluster is AND d with the specified address to produce the output Bit Field Value Response Available is TRUE When Set Get is TRUE the Mask is either OR d or XOR d with the contents of the field at the specified address If XOR OR is FALSE the mask is OR d with the contents of the field at the specified address thereby setting bits specified by the mask If XOR OR is TRUE the mask is XOR d with the contents of the field at the specified address thereby clearing the bits specified in the mask Device Number 132 0 IDPR bee Response Available Bool F Seth Get Bool F p Bit Field Yalue i32 DPR Humeric Spec Cluster n7 ees Bit Field Bool Array SOR AND Bool F PmacDPRNumericClusterExample This example extends the previous example by defining a cluster containing a set of DPR numeric data The purpose of doing this is to hide the addresses inside the VI and get ready for another example that will use a CIN to access the DPR numeric data The example operates the same as the previous one except that a large number of controls for defining the M Variables have been reduced to a single cluster as shown in the panel 2
141. e diagram for PmacMotorPosition shows that these VIs format a command string to request the desired motor position and let PmacCoordMotor2Coord process the response The details of this implementation are left until later and gets involved Coord Defined Bool Position Double Coord Definition String e PmacCoordMotor2Coord Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Value from encoder counts to CS units If the motor is not defined in the CS no conversion is applied If the motor is defined and Convert is TRUE Coord Defined is TRUE and Output Value is scaled from encoder counts to CS units Coord Definition is a string specifying Output Value units as Encoder or the CS definition of the motor 69 Coord Defined Bool Output Value Double Coord Definition String Device Number 132 0 Coord Specify Cluster Input Yalue Double PmacMotorPVE is an extension of the position velocity and following error VIs that combine them into a single VI that can be used to drive the PmacMotorPVE indicator The use of these VIs is shown in the diagram below e PmacMotorPVE Query PMAC for the position velocity and following error for Motor Number operating in Coord Number Assemble the measurements into Motor PVE Cluster If Convert is TRUE convert the measurements to CS units Otherwise leave them in encoder counts See the documentation for PmacMotorPosition PmacMotorVelocity and PmacMot
142. e exceptions to this are commands like LIST PROG n LIST GATHER which will generate long multi line responses LabVIEW strings are happy to handle these Depending on the size of the string indicator or control on your panel these may not wrap correctly This is a LabVIEW issue If you execute PmacTerminal and list a long gather buffer you will see this There is also an issue when entering strings using a control The natural temptation is to expect that hitting lt CR gt will cause the string to be sent LabVIEW doesn t work this way Panel values are input using the lt Enter gt key Chapter 4 Application Basics K ee ee M Ka sor The panel and diagram for this exercise demonstrate the use of these three communication VIs Execute the operations specified in step 1 through 4 on the panel When you execute step 1 in this exercise the following error dialog will appear informing you of a problem with your command If the dialog does not appear see the section PMAC Communication I Variables in Chapter 2 to modify your PMAC s communication configuration as specified Chapter 4 Application Basics 45 Until proper HW safeties have been installed configured and tested extreme caution must be exercised when moving motors to prevent damage and possible injury Do not send a Jog command unless you are certain your actions will not damage your system or you
143. e name to the same base as the saved program For example if Program Buffer is saved to PmacTest1 pmc a new VI named PmacTestl vi is created from PmacProgSubVI Program Buffer String Program State Cluster Using the example names above there are now two items with the same base name An ASCII program file PmacTest1 pme and a VI Chapter 5 Development Tools 117 PmacTest1 vi The icon for the new VI based on PmacProgSubVI shown here e PmacProgSubVI PmacProgSubVICreate makes a copy of this VI with a new name that matches the name of a motion program Because the motion program has the same name with a different extension this VI knows how to open parse load and run a motion program without intervention or extra inputs It allows you to edit the associated program and interactively execute the program Details of its implementation are contained in the manual The VI downloads the associated program when first loaded unless this option is disabled in the diagram and defaults for Program Number and Coord Number are provided for the Program VI State Cluster The interactive panel can be opened and used by setting Panel Show latched TRUE See the documentation for PmacTerminalEdit and PmacTerminalExecute for details on interactive execution The panel is closed by clicking the Stop button on the panel When the latched input Program Run is TRUE Input PQM Variant Array is sent to PMAC to initialize a program s P Q or M variables
144. e of a few issues before actually running the examples e PMACPanel will cause your PMAC to execute motion Please be careful Chapter 1 Overview 3 e PMACPanel may require some changes in your PMAC s I Variable configuration You may also inadvertently change an I Variable during the execution of some of the examples If you have a currently working system please use Pewin32 to save the configuration before making changes to your PMAC PMACPanel will download programs and PLCs when some of its components run If you currently have motion programs and PLCs that you value please use Pewin32 to save them before executing those examples that utilize encapsulated motion programs and PLCs Otherwise they will be replaced Safety Summary The following are general safety precautions not related to any specific procedures and therefore may not appear elsewhere in this publication These are recommended precautions that all personnel using PMAC must understand and apply during different phases of operation and maintenance Motion Commands Until proper HW PMAC moves motors Sometimes very powerful motors driving sensitive safeties have been equipment PMACPanel developers are responsible for making certain they installed configured and tested extreme are thoroughly familiar with their mechanical setup its capabilities and caution must be exercised when performance and movement limitations Furthermore that motion commands moving mot
145. e program loop If you don t check the box prior to starting the motion program the loop in the motion program will not execute The Close Loop button is provided to close the servo loops if they are not closed or the initial rapid move to home results 1n a fatal following error X Pos 642060 DPR Numeric Slave Example Y Pos 1390325 b Enable Track Iteration Timer mS 15 CY Warm Plot DPR Numernc Slave Cluster 20000 0 Handan E Enable Poll 15000 0 12500 0 Boara 5000 0 sty P 2500 0 xY Pos M 0 0 FAREI PES l l l l l 0 0 5000 0 100000 0 15000 0 20000 MY43 a The indicators on the middle left of the panel display the actual X Y motor positions as retrieved by PmacDPRRealTimeMotors The Yellow cursor in the plot is the target position for the move and determines the values of M501 and M502 When you click the Yellow cursor and drag it to a new position the target position for the move is set and executed by the motion program The Green worm will begin moving toward the Yellow cursor with the Red cursor bringing up the rear The diagram for the example is similar to those already discussed The motion program wrapper VI on top handles the program execution Below this is the VI handling the DPR Numeric cluster containing M500 M502 234 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual cal al EE Oe Cr Enable Trackj F Enable Trac
146. ection of ICVs that utilized PMAC s data gathering capabilities The gather facility gathers and buffers a specified set of items at a specified servo rate using PMAC memory The gathered data can be transferred to the host later for decoding and use The PmacDPR Vector VI collects the data in host memory on an as it gets there basis Samples will be missed when your application is busy with other operations This can be seen in the example s Red chart strip of the Servo Timer difference This strip chart is the difference between successive Servo Timer samples and reflects the jitter in the sampling Most samples are taken every five servo cycles in this example When a complete buffer is accumulated passed back to the VI and then used to update the chart the sampling interval experiences a blip of approximately 75 mS You will even notice 5 and 10 mS blips in between the major buffer updates From a practical point of view the Servo Timer vector definitively identifies the time each sample was taken This can be used to resample the other data vectors or handled however you choose Until Delta Tau includes DPR data gathering in PComm32 you should use regular data gathering if you absolutely require servo accurate sampling This form of gathering does not support strip charting on a continuous basis As can be seen in this panel the interval required to process both fetches is between two and four mS without the update of the charts When the
147. ed a more stable pulse width change PLC 19 to PLC 0 in PmacPosCompGen pmce and the reference to PLC 19 in PmacPosCompSetup pmce to PLC 0 The foreground PLC will be serviced more regularly thereby resetting the output in a more deterministic manner If you are not using an oscilloscope you can use the DAQ card to do the same thing On the far right below the two selector knobs on the panel is a menu ring that allows you to select three different DAQ VIs Clicking the Run DAQ button starts the selected VI as a separate application thread These VIs are slightly modified versions of standard LabView examples located in the Examples Daq Anlogin library supplied with LabVIEW The diagram uses the expected pieces from previous examples The encapsulated PLC that generates the pulses is enabled by the setup PLC and can be disabled by the Disable button The Run DAQ button uses the Server VI to start the selected PmacDAQ VI as a separate thread 190 Chapter 9 PMAC and NI DAQ Interfacing Change YVar hi 5 t or le ie a a pre emer ae L i m 5 t a k P Ga SPmacDAGSyncServa vi Motor Status Limit Cluster Motor Limit Control Cluster Motor fe Limits Run DAQ a a eres H a see econ een arae e arare ara rAr irarria r im paca a Coord System 22I Hotor E ncoder LIH Jog k PVE Aun l Open motor ve Duste 7 Ma olor fl Ea a a A AAA AAAA E AAAA AAA E a AA E a rrr Ts Jog o Raag anaana anaa
148. ed for the name of a datalog file You can select an existing file created using this example or provide the name for a new file There are two example files named datalog dat and datalogl dat New File closes an existing log file and allows you to select a new one This needs to be done prior to actually logging PQM data The Read Append Ignore radio buttons define what to do with the PQM data when the Cycle Read Write button is clicked Chapter 6 Encapsulated Motion Programs and PQMs 141 142 Read It is assumed that you opened an existing data log file created earlier Use the record specified by Current Record to read a PQM record set the PQM variables in PMAC using the retrieved record then execute the encapsulated motion program You will see the values on the cluster controls change to those read from the record when Cycle Read Write is clicked Using this you can replay previously executed tests and configurations The state of the panel illustrates that a Read operation was performed during the last cycle using record 1 after the cycle Current Record was incremented to 2 The note indicates that X1 12 and indeed P2 has a value of 12 Append Read the PQM cluster controls append them to the datalog file send them to PMAC and start the execution of the encapsulated motion program You can add a note to the record prior to clicking the Cycle Read Write button Ignore Keep the datalog file but do not read or write anythin
149. editing process Mass Compilation If you have purchased the PComm32 package you have the ability to develop LabVIEW Code Interface Nodes that may require re compilation See Chapter 10 for details This step compiles the entire PMACPanel release so that there are fewer searches when loading VIs and confirms that everything can be found Select Edit Mass Compile to display the file selection dialog while you have a VI any VI open Browse your way to the directory PMACPanel lib and click Select Cur Dir LabVIEW will then begin loading and compiling the entire PMACPanel release When this is complete click Cancel If the compilation process encounters problems note the error message The most common problem encountered will be its inability to locate the PComm32 driver extension Pmac dll installed by the Pewin32 PComm32 PTalk or PMACPanel This should be located in c Windows System If the file is not in this directory try to locate it and determine where the file was placed You can copy the file into the correct directory and reattempt the compilation On Line Help 16 PMACPanel has extensive on line help in two forms Extensive documentation of every VI and its terminals is available using the standard LabVIEW Help Show Help option There are also several standard Windows on line help files located in the LabVIEW Help sub directory These include help versions of the printed manuals and several PMAC manuals Th
150. eeeeeeees 155 PmacHome Exi Danen a a a a a a 155 Configuring the Position Capture Trigger issin inona a a 157 Monitormne the Home Position Capture morissen e eee 160 Home Position Trans tornnmati NS cena a a Gages eaeeeeeseceet 162 Table of Contents iii Encapsulated PLE Prostam vrata taco cte trees maeansiact N ES 164 Chapter 8 Encoder Capture and Compare Operation 166 ISVS NG 6 aca tee nonsesnsis nope aamsansestexamien N A A R A 166 PmacEncoderPOsitiOn EXAMP a 00scssacatarssaneates aatieseatsiaeeriere Red ene 166 Encoder Position Transtorimations j psisihs ccsiessatachoisann saauiaewadeubicmodebeenesbeuieungeevomanteakes 167 Position Capture for Non Homing Purposes ccccccsssessssseesessessssssssssesssssssssssssssssseeaeaas 169 PLC Capture Flag Processing asoro irere ara ENa EEEE aera 169 PmacEncoderCaptureExXamiP ss 9 s ccs ssseeeseenssvapssasuteeaveewespesesawaaseen ache TEA EAEE EEE 170 External Triggers for Position Capture ccccccccccccseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 172 PMAC Position Compare Operation cccccccccccccccccccceceeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 172 Reguired MeV aria ple Sororis inira aA E A a ee 173 Pre loading the Compare Position ccccccccccccccccccececceeeeeeeeeeeeeeeeeeeeeeeeeeseeseeeeeeeeees 173 Trace crime Bx ternal ACHO ossee e n E TE LA O 175 PLC Compare Pain Hi 6 sesiaiceresione e e a Ri 175 Piniac BncoderC Giiip are Ex An py anemi eien iee
151. er A corollary to this rule is that you cannot use local variable copies of control clusters that contain latched Boolean controls Chapter 4 Application Basics PmacTutor8s Motor Control with Status Monitoring This exercise introduces another PmacMotor control and several indicator clusters for displaying motor status As with the PmacMotorJogControl status clusters require an associated VI to query PMAC for the required information and assemble it into a useful form This is the first exercise to actually generate an application you can really use to exercise PMAC The panel contains PmacMotorJogControl and PmacMotorPVE already introduced In addition there is a PmacMotorLimitControl and two new status clusters The VIs for the new panel are PmacMotorLimitControl Generate PMAC on line commands for controlling move limits and operation for Motor Number Command Executed Bool is TRUE when any button is clicked in Motor Limit Cluster Device Number i32 H T Motor Number 13 1 3 1 ne Command Executed Bool F PmacMotorStatJog Create a status indicator cluster for the PmacMotorStatJog indicator containing the status for Motor Number Device Number 132 0 Motor Motor Number i32 1 8 1 Jost Motor Status Jog Cluster PmacMotorStatLimit Create a status indicator cluster for the PmacMotorStatLimit indicator containing the status for Motor Number Device Humber 132 0 bd otor Motor Number i32 1 8 1 Limst Mo
152. er 2 Getting Started 7 Unpackmo and TSP CHOI russii E n E A T E ER N OM ee 7 PMA C Ge 6 001 of 1816 UN eee eR Re ne aE ERO eee 7 Customer F Ubinas Med Hardware osere ian Aiea trea E E E N E 7 Customer Purnmisbhed SOI WAL ueniat e a tea a e a a a nears 8 Detd TISON da e e oS E 8 National Tostromients SOLE WAN eedruntesia e e aa a a e a a a venders 8 Microso SOLE AN oa e a a e a e n a Nanna E E IE 9 PMAC OpHonsSTOCPMAC PINEN asteg n ae a e e E easels 9 Technical Documentatii onorarea a ae E te ace ae E EA E T tet 9 PMACpPanel and Your Computer s Display sseisss ssctecccieseeseeiiveede reste 10 Mas ed EMACPane a nr a alee Na E E VE A races an de EA 10 PMAC Pane Eee 0 0 0 ko norisi Dee aE E E AE E Dy ree ee ee wee eT ee 10 Conneunime the Device Drive ienris rate vest nanan ded enelaats eet dee h 11 Testne the Device Lr Vie ste gl ta e T A O A aele 13 Confieurine LabVIEW srera a T A E ATE 15 l stalline the Release ViGW acer eee eset ante eee tener ata 15 Creatine YoUr OWN Vie Wasesane tetas eis ee te tet 16 Mass Compilation sonera enan aa ote hese oe E EO 16 On Line Hel epee etre et es T a TET 16 Configuring PMAC Panel Communication escis nee iiei 17 Testing PIMA CPanel Communicati isani aaa aeei 18 PMAC Communication Vania ples osernigoinin ana a a ni 19 PComms 2 Communication BUCI S onesmo a aS 20 Trouble Shooting PMACPanel Communication cccccccseseseessseeesssssesssssssssssesssssesessseseaes 20 Table of Contents
153. er Output Bal F npu HeC Liuster cL Fsi Time Paole Output PLO Exec Cluster Recommended Terminal A PMACpPanel Datatype LabVIEW Datatype PMACPanel Tutorials If you understand the basic ideas covered in the previous section you can start developing PMACPanel applications The remainder of this chapter contains exercises that start with opening communication with PMAC and work up to the development of some very sophisticated capabilities The contents of these tutorials are necessary for all PMACPanel developers The on line Windows Help version of this document is a great way to display the contents of the tutorials and examples from within LabVIEW Tutorial VIs are located in the PmacTutor directory In this directory there are two base VIs that are used as a starting place for developing all the examples and PMACPanel VIs These are e PmacTutorApp Opens PMAC has an execution while loop and a Stop button e PmacTutorSub Has a predefined Device Number terminal The tutorial VIs are named PmacTutorl PmacTutor2 etc These should be opened examined and executed while working through the exercises You can save new copies of these and modify them as desired Depending on the exercise goals various panels diagrams and sub VI descriptions are used to illustrate PMACPanel concepts Numerous descriptions are provided on the panels and in the diagrams Good wiring PMACPanel Communication Tutorial The following ex
154. er or a file at any time As with the PmacTerminalMotors and PmacTerminalMotorsXY tools you can modify the plot attributes prior to running the tool to accommodate your expected scale PMACPanel has utilities to set the legend and plot colors to reflect your gather selections One issue you should consider when gathering data is that the gathered variables can and will as in the sample panel have widely varying ranges You can choose to stack the plots if you desire Chapter 5 Development Tools 1000 0 H1 Present Actual Posti o00 0 1 Present Desired Pos H Actual Velocity 600 0 400 0 200 0 0 0 P ie sR l l l l l l l l l l l l l 0 zii 100 150 200 250 300 350 400 450 500 550 00 650 l sajf M ao 1 Present Actual Position DAC Command Value wame I 1 Present Desired Position i Select New File Write Spreadsheet 1 Actual Yelocity Motor CS 1 w a peanae a 0 E Buffer Space oo Pym SEEN so ae MEENE Samples Custom Gather Specification ey Gathering Custom Gather 1 Peete P Ges joaop Servo Cycles To select Address Items use the controls contained in the PmacGatherSelect cluster on the bottom left PMAC lets you select up to 24 Address Items The following section covers methods for extending the PmacAddress selection VIs The PmacGatherSelect VI builds an array of Address Items containing a string description an address and a scale factor using the interactive commands from the
155. ercises introduce those VIs used to send commands to PMAC and access its data This includes special collections of VIs for e PComm32 access e Sending commands Chapter 4 Application Basics 41 42 e Querying PMAC and processing responses e Accessing PMAC memory mapped data and variables e Querying and Setting I Variables PmacTutor1 Accessing PComm32 PmacTutor1 covers the basic requirements for accessing PComm32 All PMACPanel applications must open access to PComm32 using PmacDevOpen This exercise demonstrates three steps for all PMACPanel applications Open the device do something close the device These VIs are e PmacDevOpen Open communication to PMAC using the PComm32 device driver Check type ROM date and ROM Version Provide Device Number for other VI s You can select the mode of communication using the Communication Mode drop down menu To make the selection permanent make your selection the default use the right mouse button and Data Operations Make Current Value Default option This MUST be done in conjunction with the options available on the PMAC control panel Device Number i32 0 pen e PmacDevClose Close the PComm32 device driver PMAC will continue running as programmed as long as power is applied Dey Device Number 132 0 Close All basic PMACPanel application diagram will open PMAC and pass the device number into a your application s main loop where your primary logic is executed Structu
156. erent in that there is no OK button to capture and process the line just entered Instead hitting lt RET gt in the screen puts a lt CR gt in the buffer The lt TAB gt will still rotate you through the controls This tool should be used to develop programs rather than PmacTerminal Program development is detailed in the PMAC User Manual and PMAC Software Reference Manual There are some added features to PMACPanel s processing of motion and PLC programs developed using this tool PMACPanel parses the motion program buffer for the PLC or motion program number and coordinate system prior to down loading This allows you to write a PLC or motion program and have PMACPanel keep track of this information without you having to do it It greatly simplifies your PMACPanel diagrams The program shown in the panel demonstrates what is required to do this USE CS amp 3 3 10 4310 open prog 10 clear Are a 4 tega tall normal k 1 lin goto 1 f2000 dwell 100 ma Buffer Space Close Bulfers The motion program coordinate system is specified by the comment line Chapter 5 Development Tools 115 USE CS amp 3 The down load compilation process ignores comments so this does not affect normal PMAC operation The comment can be any mix of upper and lower case For safety always use caps The program number is parsed from the line open prog 10 Again this can be a mix of upper and lower case When the progr
157. ert it into two unsigned integers and two 24 element Boolean arrays The Boolean array representations allow you to select individual status bits for your own use using LabVIEW index VIs The unsigned integers can be used for your own bit manipulation and testing using logical operators These VIs are e PmacMotor PmacMotorStat Query PMAC for the status of Motor Number Report the two status words as arrays of Booleans and unsigned 32 bit integers Device Number i32 0 Matar First Word 24 Element Bool Motor Number i32 1 8 1 Chat First Word Binary Status udaz Second Word 24 Element Bool Second ord Binary Status wie e PmacCoord PmacCoordStat Query PMAC for the status of the CS specified by Coord Number Report the two status words as arrays of Booleans and unsigned 32 bit integers Device Number i32 0 Coord First Word 24 Element Bool j First Word Binary Status us Coord Number 132 1 8 1 sash Second Word 24 Element Bool Second Word Binar Status wiz e PmacGlobal PmacGlobalStat Query PMAC for PMAC s global status Report the two status words as arrays of Booleans and unsigned 32 bit integers Glob First Word 24 Element Bool Device Number 132 0 To First Word Binary Status uaz Stat Second Word 4 Element Bool Second Word Binary Status wie Global status does not require a motor number or coordinate system number The Motor Number and Coord Number inputs coerce the range to protect you from mi
158. es access to the I Variables and memory variables required for defining homing criteria and determining home position offset PmacEncoder This collection provides VIs to access and control the encoder gate array for position capture and compare There are also tools for developing background PLC programs for generating Compare Equal outputs Chapter 3 PMACPanel Basics Program Development and Encapsulation Tools Developing PLC and motion programs that work seamlessly with PMACPanel requires four major components e Tools to edit and create programs e Tools to monitor the execution and debugging of programs e Tools to develop PMACPanel panels to communicate program specific data between the program and user e Tools to encapsulate programs their execution and monitoring into a single easy to use VI The purpose of these collections is to allow the integration of motion programs into a PMACPanel application Either Pewin32 or the PMACPanel application tools documented in Chapter 5 can be used for the development of the raw motion programs PmacTerminal Terminal application tools for interactively creating controlling and monitoring PMAC and your programs PmacFile Tools for maintaining ASCII program files LabVIEW datalog files and downloading files to PMAC PmacPQM PMAC program execution is parametrically specified using P Q and M variables For example the number of times a move is executed the increment of
159. escription VIs The client server architecture illustrated below works exceedingly well with LabVIEW s G Code data flow execution model and matches the model used to communicate with GPIB Industrial Automation networks etc PMACPanel applications place requests to PMAC to set motion characteristics run motion programs and configure and monitor PMAC status PMAC executes these requests without the assistance of the client application as long as power is applied Using this model PMACPanel applications can use data from other LabVIEW devices to control the motion and coordinate control of those devices with the execution of the motion PMACPanel Beason for Service Indicators Controls and VIs PMAC Other LabVIEW per and Results Digital Applications Utilites and Drivers Triggers sev view cards LabVIEW Cards The figure below illustrates a set of Query Response exchanges between the PMACPanel client application and PMAC Commands for service are sent by the application in response to e button clicks e events such as measurements made by other instruments Chapter 3 PMACPanel Basics e polling requirements In response to these requests PMAC responds with the requested operation or data Because of this architecture everything PMAC can do can be done under control of and in coordination with client applications Get Position Motor 1 Display Position E 138645 Run Program 32 in Cycle Start Coordinate S
160. ese routines support memory allocation file manipulation and data type conversion Detailed documentation on these topics can be found in the LabVIEW Code Interface Reference Manual Using a CIN with PComm32 Appendix A contains an application note available from www natinst com fully defining the process for creating a CIN and configuring Microsoft Visual C to edit compile and link the source code It s a bit involved but important information The next section details the configuration information required to add PComm32 support to the basic CIN described in the appendix Setting up a PMACPanel CIN Configuration 196 There are two ways to create a project file for the CIN source code created by the LabVIEW The information presented next is of general importance and leads to a much easier way to develop CINs for PMACPanel Adding PComm32 Include Path To access PComm32 you need to add the following directories to the Visual C development environment by selecting Tools Options to display a tab dialog Click the Directories tab and select Include files in the Select directories for drop down menu If you double click the outlined box in the directory list a dialog box appears allowing you to select a directory for the include path The dialog shown below already includes the directory D LabView PMAC Panel lib PmacInc If you happen to have PComm32 installed you can use this directory The result should look something like the fo
161. espStr 13 I O Handshake Control This parameter determines what characters if any PMAC uses to delimit a transmitted line and whether PMAC issues an acknowledgment handshake in response to a command The preferred setting is I3 2 l4 Communication Integrity Mode This parameter allows PMAC to compute checksums for the communication bytes sent between PComm32 and PMAC This value should be 14 0 because PMACPanel does not currently add or strip a checksum 19 I6 Error Reporting Mode This parameter specifies how PMAC reports command line errors The preferred setting is 16 1 In this mode PMAC errors are properly parsed by PMACPanel and reported to the user with a pop up dialog 158 DPRAM ASCII Communication Enable This parameter enables or disables the DPRAM ASCII communications function When I58 1 PMACPanel sends and receives communication through DPRAM When 158 0 communication is done via the Bus or Serial Port Enabling ASCH communication is not required to access DPRAM available using other PMACPanel capabilities Using DPRAM ASCII communication modifies I3 and will effectively disable PMACPanel s ability to properly parse error messages The preferred value is 158 0 This implies that Bus or Serial is the preferred Communication Mode to be specified for PmacDevOpen This has little impact on overall performance and does not preclude the use of DPRAM for memory mapped purposes PComm32 Communication Bu
162. ess for Motor x 1x03 152 Position Processing Software Position Extension 151 Position Scale Factor for Motor x 1x08 152 Position Capture Function 153 155 164 169 Setting the Trigger Condition 153 Using for Homing 153 Using in User Program 169 Position Compare Function PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Compare Control Bits 173 Querying 53 Directly Triggering External Action 175 VI Compilation 16 Preloading the Compare Position 173 Required M Variables 173 Position Compare Outputs L PMAC Lite 183 PMAC PC 183 PMAC STD 184 PMAC VME 183 PQM Variables VIs to access 31 Preloading the Compare Position 173 Programs VIs to access 31 PTalk 23 PTalk Active X 24 Homing 155 Zero Move Homing 155 S Safety Electrical 4 Motor Movement 4 Program download 3 Serial communication 43 Servo Interrupt Time Variable 110 14 Sinking Inputs 185 Sinking Outputs 185 Sourcing Inputs 185 Sourcing Outputs 185 Status Querying 55 Storing the Home Position 154 Supported PMAC Models 7 Synchronizing To External Events Position Capture 153 Position Compare 172 Synchronous M Variable Assignment 185 T Technical Support 5 Terminal Conventions 40 Triggering 30 Triggering External Action 175 Trouble Shooting Driver Communication 20 Tutorials 32 41 Accessing PMAC 42 Communicaiton logging 47 I Variable access 57 Numeric re
163. etti diagram doesn t know where the insert took place and would require a lot of work to track this type of operation If you enter lines that wrap to the next line on the screen list programs with lines that wrap or list the gather buffer guaranteed to wrap the screen may start to act a little strange You can solve this by clearing the window using the button below the screen Buffer Management PMACPanel applications especially their development requires the management of ASCII buffers containing command sequences I Variable configuration information and motion PLC programs To simplify this PMACPanel has a simple VI and associated cluster control to handle ASCII text buffers The control is located below the screen It is a copy of the PmacProgram PmacProgEdit control shown below The actual control on the PmacTerminal panel doesn t look like the raw control We ve moved things around to look better In fact most of the packaged PMACPanel clusters have been rearranged Be very careful when moving items in a cluster do NOT pull them out of the cluster boundaries by mistake This causes the remaining controls in the cluster to reorder their Panel Order The associated VI will not work as you expect because what was control 4 is now control 5 etc Program Edit Control sic Clear Down Show Window Load Log The cluster and VI implement six operations using the screen buffer e Load Load an ASCII file into the screen
164. ext This manual does not cover the internal operation or implementation of these VIs or members of these collections in detail They are involved and way beyond what most developers will want to know about PMACPanel Feel free to examine their contents and make changes as desired e PmacProgSelect Query PMAC for a description of all loaded motion programs by reading PMAC s internal buffers If First Time is TRUE Menu String Array contains a sorted list of all loaded programs by program number The VI maintains New Selection Index as a state from execution to execution Translation of Program Selection Index into Program Number occurs when First Time Strings is TRUE or Program Selection Index 1s not equal to New Selection Index New Output TRUE indicates that Program Number New Selection Index and Menu String Array contain new data New Output Bool F Frogram Number i32 New Selection Indes i2 Menu String Array Device Number 132 0 Program Selection Index First Time Bool F e PmacPLCSelect Query PMAC for a description of all loaded PLC programs by reading PMAC s internal buffers If First Time is TRUE Menu String Array contains a sorted list of all loaded PLC programs and their Chapter 5 Development Tools Chapter 5 Development Tools execution state by PLC number for the menu ring in PLC Select Cluster Button String Array contains information to change the description of the button in PLC Select Cluster so that it tog
165. ffer New Path is TRUE when a Load Save or Save As operation modifies the file path Load Load a file into Output Buffer Save Save Input Buffer to Input File Path Save As Query the user for a new file to save Input Buffer Clear Window Put an empty string in Output Buffer Down Load Compile and down load Input Buffer to PMAC Show Log Display the contents of the compile log Device Humber 132 0 prag eee New Butter Boal F Input Butter String paad E Aip Qutput Buffer String Input File Path Po i Mew Path Bool F Program Edit Control Output File Path Using these descriptions it 1s straightforward to use these VI s powerful capabilities Place the appropriate control or controls on the panel Where required create a writeable local variable copy of the control or the required items attribute node If the menu ring requires an attribute node to display the programs or the button requires an attribute node to change its Boolean text create the node and select the proper attribute For the PLC Select cluster you need to go to the panel and create the attribute node for each item in the cluster not the cluster itself 113 PmacTerminalJog 114 This tool is a modified version of PmacMotorMoveExamp and PmacTutor7 Its details won t be covered here Instead it is an excellent example for demonstrating the behavior of multiply executing tools and application VIs One note of importance is t
166. ffers PMAC handles commands and responses in a very simple manner PMAC commands that generate responses place the responses in an internal buffer that is transferred into the caller s buffer If the entire response does not fit in the caller s buffer the data is held in PMAC until the remainder of the buffer is fetched New commands sent to PMAC flush the response buffer prior to executing the new command Hence responses that are not fully retrieved are lost Communication with PMAC via PComm32 requires empty buffers into which responses are placed THIS IS VERY IMPORTANT The empty response buffers for PmacCommGetStr and PmacCommRespStr are created as 128 byte buffers If larger default buffers are desired the size of the buffer can be increased to 256 NO MORE PComm32 internals cannot handle buffers larger than this PMACPanel handles larger response buffers internally using PmacCommGetBuffer Trouble Shooting PMACPanel Communication 20 At this point it is assumed that the driver was successfully configured and tested as outlined in Configuring the Device Driver and Testing the Device Driver If you skipped these steps revisit them If you have Pewin32 or Pcomm32 and they work the problem is with your configuration of PmacDevOpen or the communication I Variables e Inthe event that LabVIEW crashes when running PmacDevOpen reboot the computer to eliminate any damage to the driver and memory caused by the crash e Verify the cor
167. fication is used Device Number 132 0 ama DER eaae Response Available Bool F EAE E Clutput Value i16 Offset P Inout Walue i16 The implementation of these VIs closely follows that used by PmacMemory and PmacIVar The VI will Get the specified value unless the Set Get input is TRUE in which case it does a set operation The diagram shown below demonstrates how this is done using a Call Library VI using the PmacDPRSetDWord function in PComm32 The FALSE case Get operation uses the PmacDPRGetDWord function Note that the offset supplied by your diagram is multiplied by 4 to get the actual memory offset of the M Variable in DPR as seen from the host sit j Gr Response Available Bool F Output Yalue 132 226 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual DPR Bits and Bit Fields The three VIs presented above only require the offset to determine the address of the desired data When accessing bits and bit fields the information contained in the PmacDPRNumericSpec cluster is required DPR Numeric Spec Cluster A cluster of items required to describe a DPR mapped PMAC M Variable for bit and field access Address i32 Hexadecimal integer specifying DPR address offset For example PMAC Addresses such as M445 gt F DE01 M446 gt DP DE02 M447 gt X DE03 8 1 Become E01 E02 and E03 respectively M446 gt DP DE02 X Y String A single character string X or Y defining t
168. figuring and Monitoring Coordinate SystemS 00008 94 dear dele aCe IOV Buereeene he eee eee Pee ence ety N meter ety mee ee eee ne er eee 97 PmacTutorl4 Machine Input and Output cc cccccccccccceceeeeeeeeeeeeeeeeeeeeeeeeeeees 97 PmacTutor15 ACC16D Control Panel cc cccccccceceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 99 Chapter 5 Development Tools 102 e TLC ae ee One ne een RN ES A ee ee I ee 102 TOOL MeNi een eee ee ne ee ne ee 103 Modine the MeNi essri enor ne ore ee 104 Modifying PmacTerminalMen cccccccccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 104 Basic Tool VI REGQuiremie mt se scs 5csaceccsasvcecanssaitecsaveesieasasiarssatecarascsaeeesarevaseess 105 Basic Tool Vi Comm Surat OM ese E N 106 Pmac Terminal orean me Me Rete We ete tf ete a OR te ee 107 Basie Terminal TOT escoi T bcad sous eters T eed 108 Basie Command Edt NE iee a xis buad sae RSRar ease da od SEN aad ee 109 B te Managemen aero ae ey ee ae er eee IO a ee EIR ce 109 Termal Indicators een o e ered asses E TOES 110 Termina kC onto sania aa a T Ta 110 Moplementanon Didera nen TETEN enna nea cate 111 Piae Lerma lJ oE rann aa a a a a a a E E EE 114 Pmacrenmina lE diio mre a E AE A EEA 115 Encapsulating Motion Programs iciccticceeccsseiadesbedeesdevlesastecsdecadsvondes eet nent ees 117 Piac FrerminalE SCU E mentosrionn n encase teat ea tea aa e me ache naka ene 118 Prac Terminal MOOS ie aa Sic ak ein od Se a
169. g Simply pass the PmacPQM clusters to PMAC PmacPQM Clusters There are four standard PmacPQM clusters provided for use on your applications panels Defining these clusters binds the PQM variable s name with the actual numerical value to be used with the variable These are based on variations of the cluster definition for PmacPQMLong PmacPQMLong Cluster for tying PQM variable definition with an 132 control indicator After inserting on your panel specify a PQM variable name for the Variable Item and make it the default using Right Mouse Button Data Operations Make Current Value Default Replace Control to reflect your requirements POH Long Cluster PQM Long Cluster Cluster for tying PQM variable definition with an 132 control indicator After inserting on your panel specify a PQM variable name for the Variable Item and make it the default using RightMouseButton Data Operations Make Current Value Default Replace Control to reflect your requirements Variable String defining PQM Variable name e g p34 Control Control for associated PQM Variable PQM Type Chapter 6 Encapsulated Motion Programs and PQMs e PmacPQMBool POM Bool Cluster e PmacPQMShort POM Short Cluster Pa 5 0 e PmacPQMDbI POH Double Cluster When you insert these on your panel feel free to move the items around replace the actual control change the format and range color Boolean text etc Remember to keep the clus
170. g controls indicators that access M444 M448 using PmacDPRNumeric VIs On the right are several controls that access the same data using the ASCH PQM collection of VIs Each of the M Variables can be accessed using either method From the top down are M444 an integer M445 a double M446 a bit field in a Y address M447a single bit in an X address and M448 another bit in a Y address Access to the M Variable data using DPR requires an address bit number or field specifier These are also shown on the left portion of the panel 222 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual At the very bottom are a few controls to enable and monitor an encapsulated PLC that generates M Variable data that is simultaneously available to the host and PMAC because it exists in DPR If you check the box labeled Enable then click the button labeled PLC Enable the PLC program will begin executing The indicators for each of the M Variables will immediately begin updating with the data being generated in PMAC s PLC If you check the box labeled PQM Disabled on the right these indicators will also begin updating with a noticeable increase in the interval timer This is because of the large overhead required to process the required ASCII commands aE r Krr CI0 ro Es STOP M Variables and VI Address Specification Before getting into the example deeper lets look at the PLC M Variable definitions show
171. g DIP switches SW1 5 to SW1 8 all OFF Be aware of the fact that J4 has 5 VDC on pin 10 General Purpose Digital Inputs and Outputs The PMAC JOPTO connector J5 on PMAC PC Lite and VME provides eight general purpose digital inputs and eight general purpose digital outputs Each input and each output has its own corresponding ground pin in the opposite row The 34 pin connector was designed for easy interface to OPTO 22 or equivalent optically isolated I O modules Delta Tau s Accessory 21F 1s a six foot cable for this purpose The PMAC STD has a different form of this connector from the other versions of PMAC Its JOPT connector J4 on the baseboard has 24 I O individually selectable in software as inputs or outputs The rest of this discussion does not pertain to the PMAC STD port unless specifically mentioned Refer to the PMAC STD Hardware Reference for details on its JOPT port Chapter 9 PMAC and NI DAQ Interfacing low Having Jumpers El and E2 set wrong can damage the IC aur Do not connect these outputs directly to the supply voltage or damage to the PMAC will result from excessive current draw snow Having Jumpers El and E2 set wrong can damage the IC Standard Sinking Outputs PMAC is shipped standard with a ULN2803A sinking open collector output IC for the eight outputs These outputs can sink up to 100 mA but must have a pull up resistor to go high The user can provide a high side voltage 5
172. g this exercise turn on Help by selecting Help Show Help As your cursor moves over the various indicator and control items in the clusters detailed help for each panel item is displayed The diagram for this panel is very simple because PMACPanel handles all the details for you There are two control clusters one PVE cluster and two status clusters each with its associated function VI Add two dials and you ve created Jog application You will note that the Coord Specify Cluster requires by PmacMotorPVE is constructed by PmacMotorJog 74 Chapter 4 Application Basics Open otor AJE Motor PYE Motor PVE Coord System System Motor Pe Hotor Motor Jog Control Control i Jog panne Motor 1 Motor Jog Stat Motor Number Jagt Motor Jog Stat a Motor Limit Stat Motor Motor Limit Control gt Limits og aa Hierarchical Encapsulation PMACPanel attempts to break panel clusters and function VIs into manageable chunks that group functionality Using this approach you can piece together those items you need to build your application Each VI builds on top of the capabilities provided by still lower levels until almost everything funnels through PmacCommSendStr and PmacCommRespStr In using proper program design the result is easier to maintain and modify for your own purposes The VI Hierarchy for this exercise is shown here to illustrate this point Chapter 4 Application Basics 75 Accessing Status Bit
173. gCreate 145 PmacFileDatalogRead 145 PmacGather 32 PmacGatherCollect 130 PmacGatherSelect 127 129 132 237 PmacGatherSetup 129 PmacGatherSpec 236 240 PmacGatherSpreadsheet 130 PmacGatherStart 130 PmacGatherStep 130 PmacGatherStop 130 PmacGlobal 30 PmacGlobalBufferSize 86 89 110 PmacGlobalControl 86 87 88 PmacGloballVarComm 86 PmacGlobalIl VarMove 87 PmacGlobalStat 55 PmacGlobalStatBuffer 87 PmacGlobalStatGather 87 PmacGlobalStatWord1 89 PmacGlobalStatWord2 90 PmacHome 30 PmacHomeComplete 156 162 PmacHomeExamp 155 PmacHomel Var 155 157 171 PmacHomePLCl1 164 165 PmacHomeState 162 Pmaclnce 32 PmaclInterrupt PmaclInterruptConfig 241 PmaclInterruptExamp 241 PmacIVar 29 PmaclVar Pmacl VarGetLong 59 PmacIVarBool 59 PmacIVarDbIl 59 PmacIVarGetBool 59 PmacIVarGetDbl 59 PmaclI VarGetLong 58 PmacIVarGetShort 59 PmacIVarLong 58 PmacIVarSetBool 59 PmacIVarSetDbl 59 Pmacl VarSetLong 58 PmacIVarSetShort 59 PmacIVarShort 59 PmacMemory 29 PmacMemoryGet 62 98 PmacMemoryGetBit 62 PmacMemoryGetBits 62 PmacMemoryRead 62 PmacMemoryReadDbI 63 PmacMemorySet 63 98 99 PmacMemorySetBit 63 PmacMemorySetBits 63 PmacMemory Write 62 PmacMemoryWriteDbl 63 64 PmacMotor 30 68 73 81 89 151 PmacMotorCurrent 112 PmacMotorError 69 PmacMotorIVarFlag 79 80 157 159 PmacMotorlVarMove 78 155 PmacMotorIVarPID
174. gles the selected PLC s execution state when clicked The VI maintains New Selection Index as a state from execution to execution Translation of menu ring selections in PLC Select Cluster into PLC Selected Cluster occurs when First Time Strings is TRUE or either control in PLC Select Cluster changes New Output TRUE indicates that PLC Selected Cluster Menu String Array and Button String Array contain new data Device Number 132 0 PLC Select Cluster First Time Bool F Ner Output Bool F f PLC Selected Cluster taa henu String Array Button String Aray PmacPLCExec This VI controls the execution of foreground and background PLC programs by modifying 15 using a PmacPLCExec control as both an indicator and a control When First Time is TRUE New Output is TRUE and Output PLC Exec Cluster indicates the state of foreground and background PLC program execution When either button in Input PLC Exec Cluster doesn t match the last Output PLC Exec Cluster contents the execution state of the foreground or background PLC programs is toggled Device Number 132 0 Input PLC Exec Cluster First Time Bool F New Output Bool F Output PLC Exec Cluster PmacProgEdit Manage common editing operations on Input Buffer String as specified by Program Edit Cluster Input File Path is the default file path to use for Load Save or Save As operations New Output Buffer is TRUE when a Load or Clear Window operation puts new data in Output Bu
175. h may be normally open or normally closed open is high 1 TRUE and closed is low 0 FALSE The polarity of the edge that causes the home position capture is programmable with Encoder I Variables 2 and 3 1902 and 1903 for HMFL1 Limit Flags Chapter 7 Homing Encoders and Position Capture 161 When assigned for the dedicated uses these signals provide important safety and accuracy functions LIMn and LIMn are direction sensitive over travel limits that must be actively held low sourcing current from the pins to ground to permit motion in their direction The direction sense of LIMn and LIMn is the opposite of what many people would consider intuitive That is LIMn should be placed at the negative end of travel and LIMn should be placed at the positive end of travel Fault Flag This flag takes a signal from the amplifier so PMAC knows when the amplifier is having problems and can shut down action The polarity is programmable with I variable x25 1125 for motor 1 and the return signal is analog ground AGND FAULT is pin 49 With the default setup this signal must actively be pulled low for a fault condition In this setup if nothing is wired into this input PMAC will consider the motor not to be in a fault condition As the homing move proceeds and triggers the physical switch the encoder will signal this using these status bits When the configured position capture trigger condition occurs the Positio
176. he limits on the numeric slider in the PmacMotorJogControl cluster You should change these to reflect the limits of your mechanical setup Start by opening and executing PmacTerminal As you address motors and coordinate systems the captions in the terminal tool indicators change If you execute PmacTerminalJog by opening and running it or by selecting PMACPanel Jog from the VI menu things start to behave strangely Lets say your last few PmacTerminal commands addressed motor 3 and coordinate system amp 2 Everything looks fine on the indicator bars When you run PmacTerminalJog the indicator bars suddenly reflect the status of motor 1 and coordinate system amp 1 Why You never sent a terminal command to do this did you The truth is you did There is only one PMAC and any commands that require a motor or coordinate system address change the addressed item Because PmacTerminal queries PMAC for the currently addressed motor and coordinate system it will use these values for its status queries If you replace these VIs with numeric controls this will no longer be a Chapter 5 Development Tools problem for PmacTerminal However it will not be possible to automatically have the indicators track the commands PmacTerminal sends to PMAC PmacTerminalEdit If you strip out all the fancy stuff from PmacTerminal and leave a screen edit control and program menu ring you get a program editor tool The terminal like interface is diff
177. he next move X20 Also notice that the assignment is synchronous with the commanded position not necessarily the actual position It is the responsibility of the servo loop to make the commanded and actual positions match closely In applications where PMAC is executing segmented moves I13 gt 0 the synchronous M variables are executed at the start of the first 113 spline segment after the start of blending into the programmed move Syntax There are four forms of synchronous M variable assignment statements M constant expr Straight equals assignment M constant amp expr AND eguals assignment M constant expr OR equals assignment M constant expr XOR eguals assignment In all of these forms the expression on the right side of the statement is evaluated when the line 1s encountered in the program ahead of the execution of the move The value of the expression the variable number and the operator are placed on a stack for execution at the proper time Position Capture FLAGs Chapter 9 PMAC and NI DAQ Interfacing Interfacing to the FLAG inputs required for position capture was covered in detail in Chapter 7 and 8 Because these inputs are so closely associates with HW limit switches you should refer to your PMAC HW and PMAC User Manual as well as any manuals supplied by your system integrator Many PMAC based systems for example X Y tables have already defined the operation of the limit switches and
178. he type of data Not for L or DP Mask Bit i32 A hexadecimal value used to define a bit number for single bit operations or a multi digit hexadecimal number defining a mask for multi bit operations The VI PmacDPRNumericSpec is embedded in the bit and bit field VIs covered next and converts the address specification into an actual DPR memory offset You can look at the actual diagram for this VI if you wish to understand how this is done Generally although these are named as DWord operators the individual bits are defined in a 24 bit X Y word The bit VIs are e PmacDPRNumericDWordBitTest This VI queries the DPR DWord bit specified by DPR Numeric Spec Cluster and returns the value in Bit Value Device Number 132 0 OFF DPR Numeric Gpec Cluster ceed DBRT E Eit Yalue Bol e PmacDPRNumericDWordBit This VI operates on the DPR DWord bit specified by DPR Numeric Spec Cluster When Set Get is FALSE the default state the value of the bit is queried and returned by Bit Value with Response Available TRUE When Set Get is TRUE the specified bit is set to the value of Bit State either TRUE or FALSE Device Number i32 0 IppR F e a Set Get Bool F A esponse Available Bool F DPR Humeric Spec Cluster aed eet eee Bit Value Bool Bit State Bool Bit field operations are a little more complex The following VI allows you to specify an entire X Y word and set or clear multiple bits in a single operation depending on th
179. he user changes the Motor Number the application logic generates a Boolean condition indicating this and re initializes the panel controls When the user clicks an update button the values contained in the controls are sent to PMAC Chapter 4 Application Basics Initialize the l Yars when Get the l Yars when the Motor Number changes button iz hit x30 Prop Gain w31 Deny Gain 3 3 k33 Integ Gain Generate an intialization condition when changing Motor Number ra Initial value of 1 guarantees generation when starting D e Get Get TRUE when Pmacl ar passes input value l setina FALSE ctherwike thru when setting No need to 2 TE eg ain nee test for Response Available Set Eas x30 Prop Gain Eas 30 Prop Gain Easy 132 a x31 Deny Gain Eas i w31 Dery Gain Easy G TTE Integ Gain Eas yi in Integ Gain Easy The use of PmacIVar as opposed to the PmacIVarSet and PmacIVarGet VIs groups the controls into sub units that are a little more manageable They are used extensively in the ICVs introduced later PmacTutor6b Accessing PMAC Memory PMAC makes extensive use of the Motorola 56K memory mapped architecture This includes various encoder registers DAC and ADC values digital I O ports etc Details of PMAC s memory organization can be found in the PMAC Software Reference Manual and should be consulted when accessing memory The PmacMemory collection of VIs simp
180. her one for each I O device and one to monitor a collection of miscellaneous items You can gather some of them as vectors some for indicator clusters and some for background computations The only limitation is that you don t declare more than 128 items between all of them The panel for the example shown below allows you to define two independent buffers The support clusters and such are collected into boxes in the bottom left quadrant Each buffer has a VBGB Status Cluster containing information about the individual buffer it location in DPR and the entire pool of buffers To the right of this are an Input Array and an Output Array The Output Array contains the data for the specified buffer The Input Array is provided but as noted not supported Below these items is a Write check box not supported an Enabled check box and to indicators On the far right are a few collections of buttons to control the associated PLC and motion program You have encountered these several times 236 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual 1 DAC Command Yalue fl Actual Yelocit fl Present Actual Position To run the example you need to specify a set of items to gather This is done using the PmacGatherSelect cluster on the top left The operation of this is detailed in the section on PmacTerminalGather As shown in the example there are three items defined To create a Variable
181. hich turns on the output Therefore using this technique the output will be turned on sooner than desired 186 Chapter 9 PMAC and NI DAQ Interfacing A With synchronous assignment the actual assignment is performed where the blending to the new move begins which is generally ahead of the programmed point In LINEAR and CIRCLE mode moves this blending occurs V TA 2 distance ahead of the specified intermediate point where V is the commanded velocity of the axis and TA is the acceleration blending time A Synchronous M variables after the last move or DWELL in the program do not execute when the program ends or temporarily stops Use a DWELL as the last statement of the program to execute these statements How They Work Synchronous M variable assignment statements were implemented as a solution to this problem When one of these statements 1s encountered in the program it is not executed immediately rather the action 1s put on a stack for execution at the start of the actual execution of the next move in the program This makes the output action properly synchronous with the motion action In the modified program segment X10 Move X axis to 10 M1 1 X20 Turn on Output 1 synchronously Move X axis to 20 the statement M1 1 the double equals indicates synchronous assignment is encountered at the beginning of the move to X10 but the action is not actually performed until the start of blending into t
182. his organization allows one to access the entire 48 bit long word or either of its two 24 bit words using the same address The long word at memory location 23F8 is accessed using D 23F8 or L 23F8 The upper word is designated X 23F8 and the lower word is designated Y 23F8 PMAC s firmware uses several data types depending on the quantity being represented 1 bit booleans 8 16 24 32 and 48 bit integers and 24 32 and 48 bit floating point numbers Of these most integers are 24 or 48 bits This presents an immediate issue that must be understood when developing your PMACPanel application LabVIEW s short integers are 16 bits too short for PMAC s 24 bit integers Its long integers are 32 bits too short for PMAC s 48 bit integers and too long for PMAC s 24 bit integers Furthermore LabVIEW does not support a 48 bit integer or 48 bit floating point number Fortunately because Query Response communication is conducted with ASCII strings the size of PMAC s data is somewhat hidden To simplify the interface between LabVIEW and PMAC PMACPanel supports the conversion of PMAC data into one of six LabVIEW data types Conversion into unsigned representations is easily done using LabVIEW s many conversion VIs The following table enumerates the representations and names supported in each domain The PMACPanel names Short Ushort Long and ULong are used in the names of many Query Interface VIs LabVIEW PMACPanel Boolean Boo
183. i e ea E a R E 176 Method r tPEC ODEON orian enh carton e N 179 Method 2 One Shot Operation s ccvcscancsassandcevs restini e a aa REA 180 Method 3 PMACPanel Interval Generation nnnnnnnnnnnenenenesrsssssrrrrrrerrrrrrrreeen 180 Pmac Encoder Regte areia ee nn nr ee 180 FncodemRe sister ACCESS naira cna e a a a a a a 180 Chapter 9 PMAC and NI DAQ Interfacing 182 Ba ICG re E A E O E EE E 182 Extend WAC SiG tal haea RA 182 Compare Equals Outputs JEQU cccccceeceeeseeeessssesesssesssssssssssssssssssssssseeseeaeaas 183 SNO COCK IRS 8 sass n a eae wae anda ened acne Tees eed 184 General Purpose Digital Inputs and Outputs ccc cceeeeeeeessessssssssssssesseeseeeeeees 184 Synchronous M Variables scat ds eee sicseae eia E thas baie T A E eee 185 Position Capture FELAGS aerario era o a las bale inedcavleeteitinteeee bakes 187 DAOS THAN a E eo Tg ae E eo De Bases asin ea ed aS 188 Pal OO Oi C Hannel enea a e a ee eal a a i 188 Trigger and Scan Clock Connection Ssenga an N 188 Pma DAOM OV Ganin a aa a a eeisSekise sun tances 188 PMAC and AT MI0 16 Signal Connections ccccccccccccccccceceeseeeeeeeeeeeeeeeeeeeeeeeees 189 Sine le Theger DA nee ee cee ore See re eee eee ee re eee ee 192 Multis cies lt 1 DAO rinore E ene en Meee ee eee ne eee eee Meee eee ee een 192 Multi Trigger DAQ with Servo Clock Sampling 0 0 0 0 ccccccccceeeeeeseeseeeseseeeeeeeeeeeeeeeeeeeeeees 193 Further samplin t Options piesa e O ON
184. iables are used to configure a motion or PLC program PMACPanel provides a collection of VIs to take values from panel controls and set associated P Q and M variables for use by your programs You can then start program execution The panel for the example shows a familiar set of indicators to monitor motor motions on the top left 140 Chapter 6 Encapsulated Motion Programs and PQMs 1 gt 10004 Encoder Encoder Encoder D LabView4 Pmac iew lb PmacPOQM4 Encoder 7 2 Encoder r Encoder F O3 Encoder Below this are four PmacPQM Cluster controls associated with the four P Variables used by the program P1 Acceleration in mS P2 X Move 1 in cm etc Each cluster contains a control for the value of the variable and a string control specifying which P Q or M variable At the bottom of the panel is a Cycle Read Write button to begin execution of the encapsulated program and an In Progress indicator to monitor the execution of the program The Show Program button will open the encapsulated program s interactive panel thereby allowing you to interactively modify the program and step through its execution PmacPQM provides the ability to log PQM variables to standard LabVIEW datalog files The logging process is controlled by the Datalog Control Cluster and Datalog Display Cluster in the upper right and is sequenced with the Cycle Read Write button If you click the Create Open button you are prompt
185. iate a command or action This doesn t violate the basic caution on using local copies of control clusters noted in this document in several places Grouping Multiple l Variables It should now be obvious why the PmacIVar VIs require an I Var Set Number It allows them to be grouped by motor and or coordinate system To accomplish this it is only necessary to extend the concept to a slightly higher level The diagram for PmacMotorIVarSafety is shown here You should note that when one I Variable is set they are all set whether or not they have changed Therefore the contents of the cluster should be refreshed by a Get operation prior to changing individual items and performing a Set operation Controls and indicators for your panels should have the appropriate type and range defined to prevent inadvertent user inputs Chapter 4 Application Basics Set Get Bool F esce Humber 33 T e r A E i War gt 11H Long ii War 12 ong Va EA Output Bool F R CTF Input Motor Safety C ra als J a l afety Cluster mmen pel Dect DEL Var BEL bey pH Dbl BEL Motor Number 132 1 PmacMotors ICVs This series of exercises introduce the PmacMotors collection of ICVs These allow your applications to monitor and plot the motion of multiple motors PmacTutor10 Requesting and Plotting Motor Motion This exercise introduces a number of indicators controls and VIs for requesting the motion of all motors The data can be d
186. ice PmacDevOpen vi The following panel should appear Chapter 2 Getting Started 17 Set the Device Number control not the indicator in the white box on the front panel to the device number specified for your PMAC during the configuration of the driver The default Device Number in a new PMACPanel package is 0 If this is your device no change is required Otherwise modify the control and make the value permanent using the right mouse button and the Data Operations Make Current Value Default option then saving the VI The device driver manager allows you to select Serial Port or In PC Bus as the desired communication mode The same selection should appear in the Communication Mode drop list on the front panel The default mode specifies the use of the Bus If this is your mode no change is required If the desired communication mode is DPR the device driver control panel should specify In PC Bus along with a valid DPR address The Communication Mode in this panel should display DPR As with the device number this should be made permanent by using the right mouse button and Data Operations Make Current Value Default option and saving the VI Testing PMACPanel Communication The final step in the installation of PMACPanel is to test its ability to communicate with the device driver After configuring PmacDevOpen and saving the default changes execute it using the run button on the menu bar The panel should change to reflect the Type
187. ier Fault Error Motor 1 i 2 C ALV95 U serhbPHAC PARG4Demogatl prg gt list prog 10 F000 TAIO NAME LIN GOTI Ne2D WE 1 M1 0 F000 D w E100 RET MHESD WwE Ho Program Running Program Hold Single Step Pre Jog Hove End Of Block Stop CS Dets Continuous Motion Reg Continuous Motion Mode Run Time Error Amplifier Fault CCCCEEC Warming Following Error Fatal Following Error CS 1 Mingus Kotor Positions W CS Units Program 1 v PLC 01 Enabled w Disable _ Load z A Clear Down Show No 34626 Close ga ave nE Window Load Log Open Buffs Buff Space Buffers Basic Terminal 101 108 The black screen is a multi line string with a scrollbar configured for normal operation Typed commands are sent to PMAC when you hit the lt RET gt key LabVIEW doesn t do this automatically To accomplish this there is a Boolean button named OK hidden behind the string control that has its Key Navigation set to capture the lt RET gt key If you select Project Find and locate OK you ll see it hidden there Setting the Key Navigation this way means that when you hit lt RE7 gt anytime your cursor is in the window the OK button is activated There is a lot of spaghetti diagram to keep track of the current line character position and other book keeping that fetches the line just entered from the mu
188. ify development of these CINs PmacDPR defines a set of macros that make life very easy Device Number 132 0 Set Get Bool F Response Available Bool F Output DPR Numeric Cluster Input DPR Numeric Cluster The code for the CIN is shown here To use the macros include the file PmacDPRNumericCINCluster h located in PmacDPR Finchude extcode h PmacDPRNumeric Macros include PmacDPRNumericCINCluster h include lt pmacu h gt include lt dprrealt h gt typedefs PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 231 typedef struct int32 M444 132 float64 M445 Dbl int32 M446 Mask 132 LVBoolean M446 XOR OR LVBoolean M447 Bit LVBoolean M448 Bit FORDE typedef struct int32 M444 132 float64 M445 Dbl int32 M446 Bit Field LVBoolean M447 Bit LVBoolean M448 Bit E EDZ CIN Mgkrr CINKRum inesz Devace Number 152 0 LVBooledan Boel Get BOOL Ey hVBoolean Response Avallable Bool Ty TDL Input DER Numeric Cluster ID FOUTCPpUE DPR Numeric Cluster int32 DevNum Device Number T32 0 3 Using the macros PmacDPRNumericDWord Set Get Bool F OREO Input DPR Numeric Cluster gt M444 132 Output DPR Numeric Cluster sM444 132 j PmacDPRNumericDouble Sev Get Bool Fy OXEL Input DPR Numeric Cluster gt M445 Dbl Outpuc DPR Numeric Cluster sM445 DDL PmacDPRNumericDWordMask Set Get Bool F OREO Input DPR Numeri
189. iguration Installing the Release View To facilitate your use of PMACPanel you should install the view contained in the release or create your own view so that the PMACPanel VIs and controls are easily accessible from the Controls and Functions palettes and do not clutter your User lib directory The procedure for doing this is outlined here e Run LabVIEW e Select Edit Select Palette Set gt PMACPanel This view is a modification of the default view Ifno PMACPanel selection appears check for a directory named PMACPanel in the directory LabVIEW Menus The Controls and Functions palettes will appear as Functions abe EH f Controls Access to the entire suite of PMACPanel controls and function VIs is now available using the Chapter 2 Getting Started 15 icon and its sub palettes PMACPanel icons are text based and indicate the PMACPanel lib subdirectory they are located in and their specific function Creating Your Own View If you did not install PMACPanel in PMACPanel lib or you already have a custom view to accommodate other LabVIEW packages refer to the LabVIEW manuals or Online Reference under the topic Palettes Editor to add PMACPanel to your palettes This can be done by using Edit Edit Control amp Function Palettes option creating a new view inserting a Submenu and linking it to a directory PMACPanel lib or your own name The icon PmacDocument PmacPanellcon bmp can be added during the palette
190. ill see a marked decrease in interaction application execution performance 26 Query Response Communication Query Response communication is the most basic form of communication with PMAC This mechanism allows your application to use the entire set of PMAC s on line Commands to interact with PMAC The quickest way to build a PMACPanel application to control and monitor PMAC is to locate the functionality you desire in the PMAC User Manual and PMAC Software Reference Manual You can then test it with Pewin32 or the PmacTerminal contained in PMACPanel When you are certain you know what you want you build a LabVIEW VI and select an appropriate PMACPanel VI to send that command and or data to PMAC Chapter 3 PMACPanel Basics LabVIEW and PMAC Numeric Data PMAC 1 bit binary 1 8 16 bit integers 16 24 32 bit integers 24 bit floating point 48 bit integers 48 bit floating point doubles LabVIEW supports a wide range of native data types that need to be communicated to PMAC This data must be formatted for transmission to PMAC and converted from PMAC responses into LabVIEW types PMAC returns numeric data as decimal or hexadecimal ASCII strings The query response VIs convert this ASCII data into native LabVIEW numbers for manipulation and display PMAC uses the Motorola 56K series of Digital Signal Processors for its computational engine The memory architecture is based on a 48 bit long word comprised of two 24 bit words T
191. ill see that the workspace shown below has 12 projects in it PmacDPRVarBack is the currently active project and will be compiled when the Build command is selected This figure is also instructive in that the project PmacDPRFixedBackVectors is open It shows that any LabVIEW CIN project requires cin obj labview lib lvsb lib and lvsbmain def For PMACPanel Pmac lib is also required The file PmacDPRFixedBackVectors c is the C source file created by LabVIEW for the CIN node and contains the actual code to accomplish the desired task Workspace Tl Workspace PmacDPR 12 project s H E PrmacDPRFixedBack files iI Eel ee PmacOPRFitedE ack Config files T rE za PracDPAFixedBackVectors files H E cin obj ea labview lib H E Ivsb lib Z Ivebmain det Prac lib PrmacDPAFizedBackVectors c External Dependencies e Tha aet he files ee ProacD PA Real ireMotor tiles eel PriacOPRReall imeMotore tiles eel PraclPRReall imevectors thes HES PmacDPR arBack files eel PriacDPAYarB ack Contig files Ee PriacOPRYarBackYectors files a Classview Z Fileview 2 InfoView 198 Chapter 10 PComm32 Code Interface Nodes Creating a CIN C Stub for PComm32 After placing the CIN VI in your diagram wiring your inputs and creating the C source file you get to edit the source The following code was created for the Code Interface Node in the VI PmacCIN Fx CIN source file 47 ringclude Texteode m CIN MET CUNRUM Ines2
192. indicates when a new compare position is being loaded into the encoder after a compare equal trigger occurs On the very bottom is a slider that specifies the interval between generated triggers This interval is used by the PLCs and by the SW interval generation Before you run this VI you should home the motors you are working with You can do this with the example covered in Chapter 7 or execute a home command from PmacTerminal Detailed descriptions for operating the three encoder handling methods are covered later At the top of the diagram are VIs to handle the Jog control and PVE indicator Below this PmacEncoderCompareConfig configures the encoder s compare control bits when the Configure Compare button on the panel is clicked Configuration can be done by the PLC e PmacEncoderCompareConfig Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the Input Compare Control bits for Chapter 8 Encoder Capture and Compare Operation 177 178 the specified Encoder Number are set Otherwise they are fetched from PMAC and provided by Output Compare Control Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 32 0 Encoder Number 132 1 16 0 Set Get Bool F Input Compare Control Cluster New Output Bool F Output Compare Control Cluste Motor AE Motor PVE Cluster Jog B Fee M otor PYE Cluster E Configure th
193. ing PMAC s global buffer status Device Number 132 0 ae SEE Global Butter Status Cluster e PmacGlobalStatGather Create a status indicator cluster for the PmacGlobalStatGather indicator containing PMAC s global gather status Device Number 132 0 ao EEE Global Gather Status Cluster The panel for this exercise is the basis for one of PMACPanel s terminal tools At the top is the PmacGlobalControl cluster It enables you to generate global commands for PLC and program control During your development you might want to Abort All Motion The Save Reset and Reinitialize buttons allow you to save PMAC s configuration to its onboard battery backed RAM or flash memory This way PMAC will always boot with the proper program and configuration information for your application The two status indicator clusters might be useful during development as will the ability to monitor PMAC s available buffer space The two I Variable clusters are useful when you are configuring communication or require specific program execution characteristics For example later exercises execute multi axis motion using circular interpolation This requires 113 gt 0 87 re ES Full All Motors The diagram for this exercise should begin looking familiar Most of the work is contained in the provided PMACPanel ICVs The control cluster provides the input for PmacGlobalControl Status VIs process requests for PMAC global status and create appropriat
194. ion Basics Dataflow and Recurring Execution LabVIEW loves to use while loops to execute VIs again and again and again If you want to continually send a Jog command to PMAC use the following example It will send the command again and again This wastes PMAC s time and slows your PMACPanel application To prevent this you as the developer must develop your program logic so that the commands are not repeatedly sent to PMAC Most of PMACPanel s architecture is designed to simplify this for you by encapsulating this logic at the lowest levels possible Giving Up Control Make sure that your PMAC VI s using concurrent execution loops use a wait timer to give the user interface and other VIs a fair shot at executing Otherwise you just may lock up the user interface while your PMACPanel program is waiting for a motion program to finish Worse yet other VI s that use double buffering to acquire data can overflow with nasty results Execution Speed LabVIEW is pretty fast at doing certain types of things and a little slower at others Writing complex VI s such as the terminal is tough on LabVIEW execution and the developer Don t expect the response time of visual C or Pewin32 You should realize that applications that repeatedly poll PMAC can slow your application This is especially true of systems that use serial communication at low baud rates On the other extreme are busy applications that use the DPR capabilities of PMACPa
195. iption of this computation see the reference section and the memory map contained in the PMAC Software Reference Manual Device Number 32 0 Input Select String Selection Indes 2 Motor Number 132 Selection Found Bool Address ltem Cluster seo Menu String Array PmacAddressAdd Check to see if the item specified by Address Item Cluster already exists in Input Address Item Array If it already exists do not add it If it does not exist add the cluster to Output Address Item Array Address Item Cluster Input Address Item Array Output Address ltem Array 131 132 16 e PmacAddressDelete Locate and remove the Address Item Cluster specified by Selection Index to Delete from the Input Address Item Array Selection Index to Delete 132 Input Address Item Array Output Address ltem Array The PmacAddressMotors panel contains an array of clusters that define a translation table You can manually add items to this table and set them as the defaults for the control transparently adding them to the menu ring in the PmacGatherSelect control A portion of the table provided with PMACPanel is Shown here Translation Table Private Encoder Phase Poston ps oe ft Each cluster item in the array consists of five items In order from left to right these are Name Textual description of the item to be gathered Used in conjunction with a motor or CS number to build a unique description for plot legends and spreadshee
196. is is useful when examining the examples and tutorials When LabVIEW starts the contents of this directory are parsed and any help files located in the directory are added to LabVIEW s pull down help menu The figure below shows both forms of help Note the entry in the pull down menu for On Line PMAC Reference We will add other on line help files as called for Many of these can be down loaded from Delta Tau s web site and copied into the LabVIEW Help directory Chapter 2 Getting Started 13pt Dialog Font Show Help Ctrl H Device Number 132 0 Gel Command String Stri PmacComm Lock Help Ctrl S hift L of Simple Help Online Reference Ctrl Online Help for Praclommbendstr i DAQ Example Navigator Explain Error Internet Links On Line PMAC Reference send Command Sting ta PMAL IF Co Online Tutorial nothing is sent The output Device Ae Number to allow sequencing of comma search Examples Search Examples Technical Support Form About Labview Configuring PMACPanel Communication PMACPanel communicates with PMAC using the PComm32 device driver configured previously To access the driver from PMACPanel the device number and communication mode defined for the driver must be defined for PMACPanel PMACPanel s primary device driver PmacDevOpen is configured with the following procedure e Run LabVIEW e Open the VI PmacDevOpen Select File Open and navigate to PMACPanel lib PmacDev
197. is the encoder to CS unit scale factor and Coord Definition is the definition e g 1 gt 16000X Device Number 32 0 Coord Number 132 1 8 1 Motor Number 132 1 81 11 Coord Definition String Coord Scale Dbl 1 0 Coord Detined Bool F e PmacCoordScale Query PMAC for the motors defined in Coord Number The Coordinate System Scale Cluster PmacCoordScale ctl contains three arrays with the motor definition scale factor and whether or not the motor is defined in Coord Number The actual query 1s only placed if Coord Number changes from a previous call Device Number 132 0 Coord Coord Number i32 1 8 1 TTS ates Coordinate System Scale Clu e PmacCoordDef Fetch the motor scaling definitions for the specified coordinate system and provide a cluster for the PmacCoordDef indicator Device Number 132 0 Coord Coord Number i32 1 8 1 del Coordinate System Definitio There are a few limitations you should be aware of when querying coordinate system definitions from PMACPanel A motor is generally assigned to a single coordinate axis as in the following definition 91 92 amp 1 Fl gt 1000X This specifies motor 1 as belonging to coordinate system amp 1 and that 1 X unit is 1000 encoder counts The scale factor would thus be 1000 The limitation arises when coordinate system axes are linear combinations of several motors as in this example that rotates the coordinate system 30 degrees from the me
198. isplayed on a PMACPanel cluster indicator plotted in a strip chart or analyzed using LabVIEW s extensive analysis capabilities VIs for setting plot legends and selecting which motors to plot can be used to create flexible interfaces The primary query VIs in the collection request PMAC position velocity and following errors for all motors They are not based on their counterparts in PmacMotor These are e PmacMotorsPositions Query PMAC for the positions for all motors PMAC reports the value of the actual position register plus the position bias register plus the compensation correction register and if bit 16 of Ix05 is 1 handwheel offset mode minus the master position register Chapter 4 Application Basics 81 82 This string has the Y Codes Display Assemble the measurements into PmacMotorsPVE Cluster If Convert To Coord is TRUE convert the measurements to CS units for those motors defined in the CS Otherwise leave them in encoder counts Device Number 132 0 Coord Number 132 1 4 1 Convert To Coord Bool Motors Position Cluster PmacMotorsVelocities Query PMAC for all motor s present actual motor velocity scaled in counts servo cycle rounded to the nearest tenth The raw response reports the contents of the motor actual velocity register divided by Ix09 32 This is converted to counts msec by multiplying by 8 388 608 and dividing by the I10 default 3 713 707 If 110 is changed modify this val
199. it Exceeded Mode 1 DPR Real Time Motor Cluster Enable Motor Numbers EE Servol imer i3 DPH Real Time Servo Cluster Eee EM Poer i BES Position Dh o Iteration Timer m EE Velocity Dbl Running Running Dwell Hove Follow Error Obl x0 Single Motor 4 3 Sample Period Motor Aray Motor Index 4 5 Block Data Block BO Master Pos Dbl Request ane o OO EL Comp Fists Tal Desired Home In Yelocity ero DAC 132 Progress i E Hove Time 132 Negative Positive HR l Ga Hoto Motion ulG Limit Exceeded Limit Exceeded C Enable Motors l a f Hand Wheel No Phase O Wait For Valid altd Output Enabled Commutation Negative Positive Integration Multiple Motors Limit Exceeded Limit Exceeded Hode To execute the example you should select how many motors you want PMAC to copy to DPR using the knob labeled Enable Motor Numbers Sample Period is the number of servo cycles between copies to DPR The default value of five indicates that PMAC will update the Real Time data buffer every five servo cycles With a default servo rate of 2 2 kHz this corresponds to a 400 Hz sample rate If you click Enable PMAC s Real Time data buffer will be enabled You should immediately see updates taking place in the DPR Real Time Motor Cluster and DPR Real Time Servo Cluster on top Most noticeably you will see the Servo Timer increment rapidly reflecting the servo time the sample was taken If you enabled four motors yo
200. ity of all motors Full card reset Reinitialize PMAC to factory default Report global status words Save current configuration to NOVRAM Variable access in numerous ways Disable a PLC program Enable a PLC program Read data from memory Write data to memory Chapter 4 Application Basics Chapter 4 Application Basics Coordinate System Commands Axis definition commands constant gt Buffer control commands LIST PC PE General CS commands igs Program control commands AA H Tw Motor Commands General motor commands HOME HOMEZ Jogging commands J J constant J J J constant Query PMAC for motor definition in CS List program at Program Execution Report coordinate system status words Abort program Begin program Hold program Quit program Run program Step program Reset motor Home Zero move home Kall output Jog positive Jog relative to actual position Jog stop Jog negative Jog to position 67 PmacMotor ICVs 68 PmacTutor Jogging Return to pre jog Reporting commands P Vv F Report addressed motor position Report addressed motor velocity Report addressed motor following error Report addressed motor status This series of exercises introduce the contents of the PmacMotor collection of ICVs These allow your applications to add configuration control and monitoring for individual motors to your applications Position
201. k TF aes a af HOPA Numeric Slave Cluster et ET a X SSE I pet M502 Dbl Close peA DPR Numenc Slave Cluster E aie Preah ot oan _ gt a eration Terms Eae e The query for motor positions used to update the plot is provided by PmacDPRRealTimeMotors The configuration of this capability is done outside the execution loop When the motor positions are fetched array is indexed the position are unbundled converted to CS units multiplied by 0 1 used to update the panel indicators and bundled into and X Y point for the X Y Chart buffer Remember that PmacDPRRealTimeMotors does not perform CS conversions We can also use the PmacDPRFixedBack VIs to obtain the motor position in CS units Target position generation for the move is handled by retrieving the position of Cursor 0 from a chart attribute node and updating the values in the DPR Numeric Slave Cluster These values will be written by PmacDPRNumericSlaveCluster as long as Enable Track is TRUE PmacDPRVarBack PMAC s Variable Background data buffer mechanism allows you to specify 128 memory addresses to copy from their native PMAC locations to DPR locations when requested Whereas the Fixed Background data buffer allows access to predefined registers and locations the Variable Background mechanism allows to you to access anything PComm32 supplies a set of routines to read the copied data from DPR and convert them into legitimate Intel fo
202. l PMACPanel Software Before installing PMACPanel read the license agreement included in this manual behind title page You should also check the release notes included with the manual and located in the Documentation directory on the CD for last minute changes Installation of PMACPanel is done in two steps First the drivers must be installed Next the PMACPanel SW must be installed Installation of the Driver Skip this step if you have already installed and tested PeWin32 PComm32 or PTalk If you have not purchased one of the tools locate the directory PMACPanel Drivers on the CD and run Setup The installation program will suggest a directory path where the program files should be copied The suggested directory location is c Program Files Delta Tau PMACPanel This will install the drivers and two applications MotionExe and PMACTest Installation of PMACPanel To install PMACPanel locate the directory PMACPanel on the CD and run Setup If you have properly installed LabVIEW the installation program will add several components to your LabVIEW installation If Setup cannot locate LabVIEW specify its location or exit the installation and install LabVIEW The primary PMACPanel component is the directory PMACPanel lib in your LabVIEW installation directory The library directory contains numerous sub directories to organize the VIs utilities and documentation Chapter 2 Getting Started Configuring the Device Driver You
203. l Instruments VIs Indicators and Controls that allow you to communicate with and control PMAC from LabVIEW It allows you to create a LabVIEW application that can monitor and control everything PMAC is doing using LabVIEW while at the same time preserving your understanding of the existing PMAC interface This manual explains how to install and use PMACPanel to develop custom applications It assumes the system integrator and PMACPanel developer has a basic understanding of the PMAC motion control board and LabVIEW It does not cover the hardware and electrical configuration of PMAC or the use of Pewin32 If questions about a particular aspect of the installation arise do not attempt the task until a thorough understanding is gained Feel free to contact Delta Tau Data Systems Inc technical support at any time during installation Refer to the Technical Support paragraph below for information on contacting our technical support department Organization Chapter 1 Overview The manual is comprised of 13 chapters that take you through PMACPanel s many capabilities with installation instructions architecture basic tutorials terminal tools motion program development homing capturing triggering interfacing and DPR Many of the chapters contain figures of the VI panels and diagrams to illustrate specific architectural approaches and VI implementations that you might need to modify to suit your purposes Not all VIs are covered in
204. l appear PHAC Motion Control Device Driv To remedy the situation check for resource conflicts with other devices in inconsistent hardware jumpers If the problem persists contact Delta Tau Technical support The Advanced button is used to configure DPR settings typically used with the Delta Tau NC for Windows software Testing the Device Driver Chapter 2 Getting Started Initial testing of PMAC and the device driver are done with the program PMACtTest included with PMACPanel or Pcomm32 drivers When PMACTest executes the following dialog appears requesting the preferred operational mode Ok File Editor Cancel dd Click OK and a terminal window will appear 13 te PmacTest PHAC 0 1 15G 01712795 File Edit View Configure Terminal DPR Features Window Help Delal e a x BE PHAC 0 1 15G 01712795 For Help press F1 Until proper HW PMACTest is now in terminal emulation mode allowing you to interact directly safeties have been with PMAC Although it is tempting to move motors when communication 1s installed configured AND tested first established in this step you should be thoroughly familiar with your extreme caution must be mechanical setup and be certain that commands executed from PMACTest will exercised when moving motors to not cause damage or injury prevent damage and possible injury Check to see if you get a response by typing I10 lt Enter gt PMAC should
205. l l l l l l l l i os 00 10 20 30 40 50 60 70 80 90 100 Hotor Encoder Encoder Counts i ae Encoder Position Transformations When you execute this example the position indicator in the PVE cluster will display the current motor position The current encoder position is displayed in the indicator labeled Raw Encoder Pos Expect these two values to be different as they are in the panel The most basic requirement for converting between encoder position and motor position and or CS units is the determination of the offset between a motor s zero position and the encoder s zero position The homing operation will generate the necessary data internally to PMAC The following VI fetches this data and computes an offset to transform between encoder position and motor position e PmacEncoderOffset Query PMAC for the encoder to motor offset captured during a home operation for Encoder Motor Number This assumes that encoder one is defined for motor 1 etc Encoder Motor Offset provides a reference for using the encoder position capture and position compare registers These registers are referenced to the encoder zero position which is the power up position not the home motor zero position This value is the difference between the two positions and the home offset Ix26 This value should be subtracted from encoder position usually from position capture to get motor position or added to motor position to get encoder position usually
206. ld be connected to the limit switch at the positive end of travel the LIMn input should be connected to the limit switch at the negative end of travel It is possible to use a limit switch as a home switch However you must first disable the limit function of the limit switch if you want the move to finish normally if you do not do this the limit function will abort the homing search move Even so the home position has been set a J 0 command can then be used to move the motor to the home position To disable the limit function of the switch you must set bit 17 of variable x25 for the motor to 1 For example if 1125 is normally C000 the default specifying the use of LIM1 for motor 1 setting 1125 to 2C000 disables the limit function It is a good idea to use the home offset parameter Ix26 to bring your home position out of the limit switch so you can re enable the limits immediately after the homing search move without being in the limit Homing from PLC and Motion Programs The PMAC User Manual has an extensive section on homing techniques using PLC and motion programs These are not covered in this manual However the programs for these are included in the PmacHome collection of ICVs PmacHomeExamp Having covered the basics of position capture and homing from a purely PMAC perspective we can now look at the ICVs available for use in your applications We ll start by examining the panel for PmacHomeExamp shown below
207. le Bool T muse ABnable M otor Numbers 132 b dy ITS 2 TOCO Peri 2322 L 2 4 When not currently enabled and Enable Bool T LVTRUE enable the Fixed buffer for the specified number of motors if Enabled Se Enable Bool T LVIRUE 4 PmacDPRSetMotors D evice Number 132 0 3 ENG DLE MOTOT Numbers 1 02 A G ay PrmacDPRRGal Tame De vice Number 132 0 7 OGO PErrod 132 L y 1 Enabled TRUE When currently enabled and Enable Bool T LVFALSE disable ALL background operations else if Enabled s Enable Bool T LVFALSE PrmacDPRReal Time Device Number 132 07 POOPY O Pet Lod moz dy 0 Enabled FALSE PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 207 Enable Bool T Enabled return noErr When first loaded make sure Enable flag is FALSE CIN MgErr CINLoad RsrcFile rf Enabled FALSE Indicate DPR Fixed Real Time disabled return noErr This particular CIN has two functions CINLoad and CINRun LabVIEW creates the function and data type declarations such as clusters and arrays required by CINRun The function CINRun is called when the VI containing the CIN is executed CINLoad is executed when the VI is first loaded In this sample you will note that two functions from PComm32 are used PmacDPRRealTime enables and disables the DPR Real Time data buffer and PmacDPRSetMotors sets the number of motors to copy
208. lean or Bool 16 bit integer 116 u16 Short 116 UShort u16 32 bit integer 132 u32 Long 132 ULong u32 64 bit floating point doubles Double or Dbl There are some situations depending on the value of 19 where PMAC s ASCII response strings are hexadecimal not decimal The conversion of these ASCII responses into equivalent native LabVIEW binary representations are handled by classes of VIs that use PComm32 s binary variable access capabilities Download Management Chapter 3 PMACPanel Basics Maintenance of PMAC programs is provided by a collection of VIs that directly access PComm32 s download functions These compile ASCII PMAC programs and download them to PMAC for execution 27 DPR Binary Data Buffers PR represents a unique PMAC capability that rapidly transfers binary numerical data between the host and PMAC This communication mode eliminates the string formatting and parsing required with ASCII communication It is however not the best solution for all problems Chapter 11 covers the use of these mechanisms fully PMACPanel Organization This brief explanation of PMACPanel s organization will help you to get the information you need quickly and painlessly as well as help you plan your application s architecture The PMACPanel library contained in the directory PMACPanel lib is divided into five basic categories as illustrated in the following figure These categories provide an increasing level of cap
209. lement Bool Arra second Word Binary Status 132 o Bt 23 Assigned to CS al o A Bit14 Amp Enabled s GF Bit 11 Stopped on 5 Pos Limit E Bit 10 Home Complete OF Bit 3 Amp Fault Error O Bit 2 Fatal Following Error Bit 1 Warning Following Error Bit O In Position G Extract bits of interest for display samme PmacTutor6 Accessing PMAC I Variables On PMAC I variables Initialization or Set up Variables determine the personality of the controller for a given application In general this 1s a supervisory task They are at fixed locations in memory and have pre defined meanings Most are integer values and their range varies depending on the particular variable There are 1024 I Variables from IO to 11023 and they are organized as follows I Variable Range Functional Group IO 175 General card setup global 176 199 Reserved for future use Chapter 4 Application Basics 57 1100 1186 Motor 1 setup 1187 1199 Coordinate System 1 setup 1200 1286 Motor 2 setup 287 1299 Coordinate System 2 setup I3xx I4xx Motor 3 Coordinate System 3 1800 886 Motor 8 setup 1887 1899 Coordinate System 8 setup 1900 1979 Encoder 1 16 setup in groups of 5 1980 11023 Reserved for future use To support this organization and facilitate access PMACPanel provides a special collection of VIs to manipulate and access them Each type of I Variable
210. lifies your access and manipulation of this architecture and its binary representation LabVIEW numerical controls and indicators can be configured to display this information as either hex or decimal data independent of the integer representation of the data Data is actually received from PMAC and sent to PMAC in this collection using ASCII hexadecimal strings Chapter 4 Application Basics 61 62 When defining a PMAC address to access the Address Spec String input to the following VIs can be in either hexadecimal or decimal form Both strings below access the same address Veo CUO Vs49152 Reading Memory Data There are two VIs to read and manipulate memory data in various forms Remember that PMAC s integers are 24 bit words e PmacMemoryRead Read a 24 bit quantity from the memory location specified by Address Spec String For example X 002B The result is output as both an 132 and a Boolean array Device Number 132 0 klem Output Value mz Address Spec String Read Output Boolean Array e PmacMemoryGet Output Value is the value of the bit field defined by Start Bit and Number of Bits at the specified memory address Output the field as both Output Value and Output Boolean Array Device Number 132 0 ker Output Value i32 Address Spec String Get Output Boolean Array Start Bit 132 Number of Bits 132 The data retrieved from PMAC can be manipulated using the following VIs e PmacMemoryGetBit Bit Value is the bit a
211. llector sinking outputs with a ULN2803A driver IC rated to 24V and 100mA each They may be changed to open emitter sourcing drivers by replacing this chip in U28 with a UDN2981A driver IC and changing jumpers E93 and E94 PMAC Lite On PMAC Lite these signals are brought out on connector J8 JEQU optically isolated from the digital circuitry referenced either to analog ground AGND or an external flag supply ground As shipped from the factory they are open collector sinking outputs with a ULN2803A driver IC rated to 24V and 100mA each They may be changed to open emitter sourcing drivers by replacing this chip in U54 with a UDN2981A driver IC and changing jumpers E101 and E102 Chapter 9 PMAC and NI DAQ Interfacing 183 184 PMAC STD On PMAC STD these signals are brought out on connector J6 JEQU on each of the piggyback boards They are open collector sinking outputs with internal 1 kQ pull up resistors rated to 5V On PMAC STD1 5 these signals are brought out on connector J8 JEQU optically isolated from the digital circuitry referenced either to analog ground AGND or an external flag supply ground As shipped from the factory they are open collector sinking outputs with a ULN2803A driver IC rated to 24V and 100mA each They may be changed to open emitter sourcing drivers by replacing this chip in U54 with a UDN2981A driver IC and changing jumpers E101 and E102 servo Clock JRS232 PMAC s
212. llowing Chapter 10 PComm32 Code Interface Nodes E ditor Tabs Debug Compatibility Build Directories Platform Show directories for win x Include files z Directories C Program Files DevStudion CN CLUDE C Program Filess OevStudio YCOMEC include C Program Files4 OeyvStudiohY CA T Lainclude D Labyiew PMACPanel lib Pmactnic Peer erererrr rrr eee Pee Tere t etre reer rere rrr rere terre rere rere rere Adding Pmac lib to Project To link the CIN to produce the lsb code resource you need to include Pmac lib located in PMACPanel lib PmaclIne or your PComm32 installation directory You can do by selecting Project gt gt Add To Project gt gt Files and selecting Pmac lib in the locations noted You can also add the file and add the path to the Library files selection in the Tool options the same way you added the include path Configuring the IDE Appendix A has detailed instructions one the steps required to configure a project so that it will successfully compile a C file into a loadable code resource for the CIN This is a bothersome process if you do it a number of times It may be necessary for you to do this the first time you create and compile a CIN After that you can use the techniques detailed next to duplicate the project file The Easy Way to Add New Projects The easy way to create new CIN projects is to create a copy of the PmacCIN dsp project file and workspace PmacCIN
213. lti line string and sends it to PMAC using PmacCommRespStr The terminal indicates it is expecting a command with a gt prompt on the screen This process puts the Key Focus on the OK button thereby removing your cursor from the screen indicator Focus is returned to the screen indicator by creating an attribute node for the screen indicator selecting Key Focus and setting it TRUE every time the OK case is executed Chapter 5 Development Tools Another issue that arises in a terminal like string control is LabVIEW s use of lt TAB gt to give Key Focus to other panel controls according to the Panel Order This can t be disabled so understand that hitting lt TAB gt throws your cursor out of the screen and onto the OK button then the Stop button etc as defined by the Panel Order Control character sequences work but don t display as you might expect If you type lt Ctrl A gt only the a appears on the screen Hitting return does indeed send the a eae to PMAC and all program motion will abort as expected Basic Command Editing You can use the standard cut copy and paste control sequences to manipulate text in the screen buffer You can copy a previous command and paste it at the end of the buffer and execute the command with a lt RET gt You can also copy PMAC responses to other applications or other LabVIEW string controls You cannot insert text into the middle of previously executed commands The spagh
214. luster and produces a VBGB Specification Cluster for the handler The VBGB Status Cluster is not required by other VIs but serves a useful diagnostic purpose e PmacDPRVarBackConfig This VI creates a set of Address Items specified by Gather Spec Cluster using the DPR Variable Background when Enable is TRUE The VI produces a VBGB Status Cluster with relevant information about this buffer and a VBGB Specification Cluster containing information required to actually fetch the data using PmacDPRVarBack and PmacDPRVarBackVectors Operation is disabled when Enable is FALSE Output Enable is TRUE when operation is enabled The state is maintained by the VI This VI can be used multiple times to create sets of VBGB Address Items See the documentation for limitations on how many sets can be created and their size Device Number 132 0 ppp be Output Enable Bool Enable Bool T pete VEE Specitication Cluster Diable All Bool F fom WAGE Status Cluster Gather Spec Cluster Variable Background buffers allow you to gather the contents of any memory location X Y DP etc To handle all data types the data fetched from DPR is all treated as a double This allows PmacDPRVarBack to treat the fetched items as an array rather than have VIs to handle each type or implement a complex typing mechanism If you need to access bits from a particular item index the array convert it to an integer and use it as you wish The Input Arra
215. m or coordinate system because these are already known by your encapsulation VI Refer to their documentation in Chapter 5 for details on using the capabilities of the two panel components Help Show Help will also provide detailed descriptions of the buttons and indicators Motion Program Sub Vi This window is for the listing E Motor Positions Coord Dets 2 This window will contain a motion program a Encoder Counts Mo Ho Program Running Program Single Hold Step Pre Jog End OF Block Hove Stop Continuous Continuous Hotion Reg Hotion Mode Run Time Amplifier Error Fault hlegiog Warming Fatal Hatt 0 Halt z Following Error Following Error Clear Down Show Hot Running Begin Run toot seve save Ae mw tsar ag eeren eos sro Feed Hold The implementation of the VI is quite a bit different from most of those already introduced This VI is embedded in your application s execution loop so that it can continuously monitor the attached motion program As such it is not wrapped in its own loop It utilizes several VI control and server concepts found in LabVIEW to control the display of the panel and selective execution of some of its components so that it doesn t consume a lot of execution time unless required There are four major pieces of the diagram On the far left is a case structure that controls and monitors the actual execution of the attached motion program Below this is a small case s
216. macAccMachinelnput8 98 PmacAddress 32 127 131 236 PmacAddressAdd 131 PmacAddressDelete 132 PmacAddressMotors 131 132 133 135 PmacButt PmacButtGetBool 53 PmacButtGetDbl 53 PmacButtGetLong 53 PmacButtGetShort 53 PmacButtGetStr 50 51 53 PmacButtGetULong 53 PmacButtGetUShort 53 PmacButtSendStr 50 51 53 72 PmacButton 50 53 PmacButtons 29 PmacCIN 32 PmacCINBase 197 PmacComm 29 44 PmacCommAppend 48 PmacCommBuffer 48 PmacCommGetBuffer 20 47 PmacCommGetStr 19 20 44 47 PmacCommGlobal 48 PmacCommRespStr 19 20 44 46 47 51 75 108 PmacCommSendsStr 19 44 75 PmacCommGetStr 46 PmacCoord 30 PmacCoordColor 70 94 PmacCoordCurrent 112 PmacCoordDef 84 91 PmacCoordIVar 94 PmacCoordMotor2Coord 69 PmacCoordMotorDef 91 PmacCoordMotorsToCoord 83 92 PmacCoordMotorToCoord 83 92 94 168 PmacCoordMotorToEncoder 92 PmacCoordScale 91 PmacCoordSpecify 93 PmacCoordStat 55 95 PmacCoordStatProg 95 PmacDAQ 32 PmacDAQMove 188 189 192 193 PmacDAQSync 191 192 PmacDAQSyncServo 191 193 PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual PmacDAQTrigger 191 192 PmacPosCompGen 190 PmacDevice 29 PmacDevClose 42 PmacDevOpen 17 18 20 21 26 42 43 112 201 PmacDocument 33 PmacDPR PmacDPR 32 PmacDPRVarBack 198 PmacDPRFixedBack 201 218 219 220 235 PmacDPRFixedBackConfig 220 PmacDPRFixedBack
217. mines the units of the axis usually inches millimeters degrees etc As introduced in Chapter 4 programmed moves for an axis are converted to motor positions using the scale factors from the Coordinate Definition statements It is important to realize that this conversion 1s for commanded positions only and that the conversion normally goes only one way from axis to motor PMAC never computes actual axis positions Position Capture PMAC s position capture function latches the current encoder position into a special register at the time of an external trigger The operation is set up and later serviced in software The actual latching 1s executed in hardware without the need for software intervention This means that the only delays in a position capture are the hardware gate delays less than 100 nsec thereby providing a very accurate capture function Trigger Condition Homing The position capture register can be used both automatically as in the firmware homing routines that handle the register directly and manually where your program handles the register Manual handling of the capture register will be covered in Chapter 8 During motor setup x25 specifies which set of flags associated with one of the encoder counters is used for that motor It is important that the flag number match the position encoder number for the motor If you use ENC1 for position loop feedback you should use Flags HMFL1 LIM1 FAULT1
218. motions executing in a 2 Axis Cartesian coordinate system Ninety five percent of this tool functions as introduced in PmacTerminalMotors See the documentation for this tool The difference is that motors selected in Plot Select are displayed in the pseudo real time X Y chart To display 2 Axis data you must select two motors 124 Chapter 5 Development Tools 40000 Ha Hd a 35000 Uaj eF 30000 ae EO 25000 20000 l 7 15000 50 10000 25 5000 o 0 l l l l l l l l 64 i 5000 10000 15000 20000 25000 30000 35000 40000 SY Buffer Velocity Following Error C S Defs Plot Select Motor 1 Motor 1 C Motor 2 Motor 3 Motor 3 Motor 4 Motor 4 Motor 5 Motor 5 Kotor 6 Motor 6 C Motor F Hotor The charting of 2 Axis motion uses a special chart buffer PmacMotorsPlotX YChartBuffer to fool the standard LabVIEW X Y plot control into behaving like a real time chart This is required because LabVIEW s X Y plot does not maintain a history buffer it plots sets of points The slider on the right of the plot specifies the length of the history buffer for PmacMotorsPlotX YChartBuffer Like a standard real time chart 2 Axis position history is displayed like a snake moving around the coordinate space The head is current position and the tail is the last position in the buffer This tool will definitely aid you in understanding what moves you are executing in a 2 Axis system The implementation
219. motor and coordinate system are fetched by the VIs e PmacMotorCurrent Query PMAC for the currently addressed motor It is most generally used in interactive development environments rather than a custom VI where you want to address a specific motor Device Number 132 0 Hey Motor Number i32 1 8 1 e PmacCoordCurrent Query PMAC for the currently addressed coordinate system Itis most generally used in interactive development environments rather than a custom VI where you want to address a specific CS Device Number i3 0 Coord Number i32 1 81 1 and provided to the six status VIs covered in Chapter 4 The Device Number they require is passed through the terminal bookkeeping sequence frame thereby causing these VIs to execute after terminal commands are processed If this isn t done addressing commands from the terminal get uncoordinated with the queries placed by the status VIs and the status displayed in the indicators might not be for the motor or coordinate system expected The VIs and spaghetti diagrams on the lower right implement the PmacProgEdit PmacProgSelect PmacPLCSelect and PmacPLCExecute operations These utilize the update architecture used in many of the earlier exercises The VIs accept control clusters containing Booleans and generate new output data for the controls when an output Boolean indicates it has new data Several of the clusters function as both controls and indicators using their color and Boolean t
220. must configure and test the driver installation before running PMACPanel for the first time If you have purchased and installed Pewin32 or PComm32 this step has already been completed Proceed to Configuring LabVIEW PMAC communication configuration has been centralized in your operating system making the setup of PMAC much like other devices in your computer i e video card sound card etc All setup is done through the MOTION CONTROLS applet accessible through your operating systems CONTROL PANEL or the included configuration program MotionExe Before running this application it is important that all applications that use Delta Tau s 32 bit communication driver PComm32 be shut down This includes Pewin32 NC for Windows or any applications developed with PComm32 or PTalk To configure PMAC communication click on the Motion Control gear icon or execute the program MotionExe created during the installation The following dialog box will appear Motion Controls Motion control devices Fmac 15 4 Pork 210 Int DPRAM OCO00 Add Remove Setup Done Chapter 2 Getting Started The Windows NT version of this dialog has extra buttons labeled Unload Load and Startup Load and Unload should only be used when trouble shooting the PMAC installation Startup may be used to tell Windows NT how to load the PComm32 communication driver If this is your first time running the
221. n Capture bit will become TRUE Home Position Transformations Monitoring the homing operation 1s already done in PMAC firmware When the home move completes the motor s zero position and its corresponding encoder s zero position will most probably not match PmacHomeComplete monitors the home operation and reports a number of I Variables and memory registers that both demonstrate what is going on and are used for capture and compare equal operations in the next chapter e PmacHomeComplete Create a PmacHomeStateCluster containing l Variables and memory registers for the specified Motor Encoder number The VI monitors the Home In Progress Home Complete and Desired Velocity Zero status bits for the motor to determine when to query PMAC for the required data A query can also be forced if Capture Home State 1s TRUE This assumes Motor N uses Encoder N Device Humber 132 0 HMotor Encoder Number 132 Capture Home State Bool F Home Complete Bool F Home State Cluster The contents of the Home State Cluster are discussed in detail here Again if you are developing PMACPanel application that uses PMAC s capture or compare equal capabilities you should understand these quantities e PmacHomeState 162 Chapter 7 Homing Encoders and Position Capture Home State Cluster T Present Encoder Position OxCO0 137 0 00 Present Commanded Motor Position 0x00276 Dbl 0 00 Present Actual Motor Position Ox0
222. n below These specify the addresses where PMAC will place the data during its writes to M Variables and fetch the data when it reads an M Variable The address modifier DP defines a 32 bit long integer in DPR handled as the lower 16 bits of both X and Y addresses The F modifier defines a 32 bit PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 223 floating point value in DPR also handled as the lower 16 bits of both X and Y addresses PMAC firmware and PComm32 handle the required bit and byte manipulations to convert the raw representation into Intel and Motorola formats M447 and M448 are single bits defined in simple 24 bit X Y words M444 gt DP SDEOO0 M445 gt F SDE01 M446 gt DP 8DE02 M447 gt X DE03 8 1 M448 gt Y DE04 8 1 To access these variables with the PmacDPRNumeric collection of VIs a truncated version of the memory address is required A PMAC M Variable defined at DE45 become 0xE45 to PMACPanel PComm32 handles the absolute memory mapping while the PmacDPRNumeric VIs compute the address offset required by PComm32 For M Variables defined as F and DP nothing more is required For M Variables defined as X Y or specific bit fields a cluster defining the base address modifier and field or bit number is required When looking at the panel only the address is required for M444 and M445 M446 M447 and M448 require the cluster These are covered in detail later The diagram fo
223. n this chapter In this Chapter we cover homing and position capture operations In the next chapter we will demonstrate how this same capability can be used to capture motor positions in response to external events generated by another National Instruments DAQ system or instrument Compare operations will also be covered in the next chapter and allow you to precisely synchronize data acquisition with motion Chapter 7 Homing Encoders and Position Capture 151 Position Basics As shown below PMAC takes position information from a 24 bit encoder register pointed to by Ix03 and extends it in software to a 48 bit register for the actual motor position In the process of extension it multiplies the encoder value by the position scale factor Ix08 Because the register in the encoder conversion table is in units of 1 32 of a count the actual motor position register is in units of 1 x08 32 of a count The extended motor position registers are set to zero on power up and reset unless there is an absolute position sensor and again at the end of a homing search move The encoder position registers are only set to zero on power up and reset Therefore after a motor is homed there is an offset between a motor s zero position and its encoder s zero position You must understand this offset because you will be using the encoder registers for position capture and compare not the motor registers Depending on your mechanical configuration
224. nd Query Response interfaces to PMAC They handle the details of sending commands and requests to PMAC and converting basic responses into LabVIEW data formats The exercises in this section introduce another level of PMACPanel capabilities that provide indicators controls and VIs for many of PMAC s most common on line commands These VIs e Handle queries for motor coordinate system and global commands e Define common indicator and control clusters for use on your panels e Implement function VIs for the indicators and controls Using these as is and modifying those that you desire allows you to create great looking panels for your applications quickly PMACPanel s ICV collections are organized into five categories e PmacAcc e PmacMotor e PmacMotors e PmacCoord e PmacGlobal Each of these categories has several exercises to introduce its capabilities You will also find similar examples in their respective sub directories Each tutorial introduces an example and then selectively drills its way into supporting VIs In doing so you as the developer will get a deeper understanding of PMACPanel internals so that you can address potential limitations in your design and enhance its capabilities to suit your specific requirements On line Commands PMAC provides a very large selection of on line commands for monitoring and control Any of these commands can be sent to PMAC using the VIs already introduced Not every command i
225. ndles the configuration of compare operations and monitoring of capture and compare flags The implementation of the VI is complex so it is not covered here However one of its pieces may be of use in your application The following VI is used by PmacEncoderTrigger to enable and configure compare operations e PmacEncoderCompare This VI reset Encoder Number s compare equal function and set the position register using Input Compare Position when Enable Compare is TRUE This value is interpreted as being in CS units if Covert is TRUE and Motor Number is defined in Coord Number Otherwise this value is interpreted as being motor position in encoder counts Home offsets are removed prior to setting the encoders actual register value Limitations associated with 24 bit rollover are not handled by this VI Output Compare Position is a persistent copy of Input Compare Position when Enable Compare was TRUE Device Number 132 0 Encoder Number i32 1 16 1 Fg pom siesta Coord Specify Cluster ew Output Bool F Enable Compare Bool F Input Compare Position Dbl Output Compare Position Dbl One last word on the use of PmacEncoderTrigger is needed If your application uses PLCs to handle the capture or compare triggers you should not service them with your PMACPanel application The chance of getting into trouble having two sets of handlers for a capture or compare operation 1s pretty large This does not prevent you configuring the ope
226. ned in the CS no conversion is applied If the motor is defined and Convert is TRUE Coord Defined is TRUE and Output Value is scaled from encoder counts to CS units Coord Definition is a string specifying Output Value units as Encoder or the CS definition of the motor Coord Defined Bool Output Value Double Coord Definition String Device Number 132 0 Coord Specify Cluster Input Yalue Double e PmacCoordMotorsToCoord Generate an indicator cluster for PmacMotorsPVE ctl Input Value Double is an array of positions velocities or following errors from VIs in the PmacMotors collection If Convert To Coord is TRUE fetch the CS definitions for the motors specified in Coord Number and scale them to CS units Motors not defined in Coord Number are not scaled Chapter 4 Application Basics Device Number 32 0 Input Yalue Double Array Coord Number 132 1 9 1 Convert To Coord Bool Motors PYE Cluster The panel shows two indicator clusters The CS Scale Cluster contains the definition of all motors in the specified coordinate system as a displayable string a numeric scale factor and a Boolean indicating whether that motor is defined in the coordinate system In the example motor 1 is defined in coordinate system 1 The orange text color indicates that the CS defined in CS Scale Cluster s caption is being addressed The CS Definition Cluster is a derivative of the larger cluster and can be used in conjunction with
227. nel for high speed data transfers VI Reentrancy In general most VIs are reentrant In LabVIEW terminology this means that a VI can be used simultaneously in multiple PMACPanel and application VIs with its own separate copy of data This has some benefits and some drawbacks It allows independent simultaneous execution of the reentrant VI The drawback is that it prevents each use of the VI from having a user accessible copy of the panel In the case of low level PMACPanel VIs this is not really an issue because the VIs have no user interface value It becomes more of an issue with the ICV VIs Issues can also arise when sending commands to PMAC If multiple VIs are busy sending commands it is not only possible but also probable that expected responses will not line up with the commands We will cover this later in the chapter 35 Persistent VI State LabVIEW VIs maintain their state from execution to execution within a loop as long as they are loaded in memory Sometimes this is desirable and in many instances is used by PMACPanel VIs Particularly those that are used to build configuration tables or attempt to minimize repetitive queries for data that will not change often The following diagram demonstrates the use of this technique ace Initialization State z 2 Initialization State Do your initialization Once In this example the default value for Initialization State is FALSE It is set to this value every time the VI 1s loa
228. ng Aun When Opened suspend When Called Reentrant Execution Priority M Surround Panel with Border hen Printing Page Margins Ee o_o F ee Seton era Prefered Execution System normal priority same as caller Cancel Generally the panel window should prevent users from doing too many things PMACPanel tools have a title bar and auto center When in edit mode the menu bar run button and abort button are shown When running these disappear and the user must use the menubar of the window you just installed Chapter 5 Development Tools Window Options Dialog Box show Scroll Bars W Window has Title Bar M Show Menu Bar Allow User to Close Window show Toolbar Allow User to Resize Window M Show Aun Button T Allow Run Time Pop up Menu M Show Continuous Run Button P Hilite Return Boolean M Show Abort Button Size to Screen 4llow Debugging Compile in debugging code M Auto Center Enable Log Print at Completion Auto handling of menus at launch PmacTerminal PmacTerminal is a poor man s command line terminal tool like Pewin32 The panel says a lot about its operation As the tool is explained we will cover many tricks that you can use to build better PMACPanel applications Chapter 5 Development Tools 107 Hegative Limit Exceeded ase i E L i Running Dwell Warming Following Error Fatal Following Error Amplif
229. ng PMAC with LabVIEW The PmacPQM collection of VIs carry this further by providing an architecture for tying controls and indicators to the P Q and M variables used by your PMAC motion programs and PLCs To illustrate how to do this we ll use PmacPQMExamp located in the directory PmacPQM To begin lets look at the sample motion program PmacPQMTest pmce that we want PMAC to run pmce is used by Delta Tau SW tools to indicate a motion program You should note the associated encapsulation VI PmacPQMTest vi created by PmacTerminalKEdit PmacPQMTest pmc USE CS amp 1 Parsed by PMACPanel during download Chapter 6 Encapsulated Motion Programs and PQMs 139 Close Always close any open buffers amp 1 Define the CS 1 gt 1000x nl gt Redefine M1 as standard output port Wi at SP OZ e D open prog 32 Parsed during download clear Otherwise appended to buffer linear Set move modes abs ta P1 set move Accel time is Pl tSe200 EmL300 ml 1 Z SHOW DIC On PORE Move x CO RZ x PZ DELAY P3 gt Delay for P3 mS ml 2 Update the port X P4 Move X to position P4 DELAY1500 taza New move parameters oe tm750 ml 4 Return home x0 dwell 100 ml 0 close This program uses four P Variables to define its execution and motion e P Acceleration time for first few moves e P2 First X position e P3 Delay time after move e P4 Second X position Because P Q and M var
230. nse If Response Available is TRUE Response contains a valid response Otherwise Response is 0 0 Chapter 4 Application Basics Response Available Bool F Response Double 0 0 Device Number 132 0 Command String The remaining five VIs operate the same and simply provide responses of the appropriate type e PmacRespGetBool e PmacRespGetShort PmacRespGetUShort PmacRespGetLong e PmacRespGetULong PmacButton PmacButton consists of six additional VIs beyond PmacButtGetStr and PmacButtSendStr introduced in PmacTutor3 These six additional VIs provide numerical responses PmacButtGetDbl is used to introduce the collection e PmacButtGetDbl Send Command String to PMAC and wait for a response when Button State is TRUE When Response Available is TRUE Response Double contains the response If Response Available is FALSE Response Double defaults to 0 0 Device Number 132 0 Command String Button State Bool Response Available Bool F Response Double 0 00 The remaining five VIs operate the same and simply provide responses of the appropriate type e PmacButtGetBool e PmacButtGetShort e PmacButtGetUShort PmacButtGetLong e PmacButtGetULong Step 1 of the exercise demonstrates that some response data 1s a little more than a numerical value Step 2 demonstrates how a single PmacResponse VI can be used to provide a useful piece of data for your panel When coupled with the button concept PMAC dat
231. o use PMACPanel VIs select the PMACPanel control sub palette attached to the PMACPanel lib directory Depending on the view you installed something like the following will appear Chapter 4 Application Basics File Edit Operate Project Windows Help H Tapt Application Font d d d F nnn gy I Pmac iew Controls Pmach otor DnS F ar are PLE 21H PmacMotor Pmachotonlog ctl on i ed Ka 5 on i ed Ka i es Mees icy i a Mees icy MovellMovel PYE Limits Motor Motor bitr Stat State Hiat i e PMACPanel sub palettes uses words rather than graphical icons to define their functionality just as their naming in the directory structure does To place a PMACPanel Control on your panel the icon is selected from the palette and placed on your VIs panel Clusters With an Associated Function VI Chapter 4 Application Basics PMACPanel controls exist on VI Panels To get the data for indicators or generate commands from controls they need a PMACPanel function VI To make it easier to link the two together the name of the associated function VI is the same as that of the control We will say more about using these in the next section The figure shown below shows the terminal for PmacMotorJogControl ctl and the function VI PmacMotorJogControl vi The similar names indicate that 39 they are paired together and the panel cluster is wired somewhere on the function VI icon ie Untitled
232. ock Before actually using these HW signals you must consult the PMAC User Manual and the HW manual for your particular PMAC model The signals are e EQU signals e Servo Clock e General Purpose Machine I O e Position Capture Flags We will not consider PMAC s encoder clock or ADC clocks If you wish to use these consult the PMAC User Manual the HW manual for your particular PMAC model or contact Delta Tau technical support The following sections are reproduced from various portions of the PMAC User Manual and describe the signals how to access them and potential limitations in their use Compare Equals Outputs JEQU The compare equals EQU outputs provide a signal edge when an encoder position reaches a pre loaded value PMAC PC PMAC PC doesn t have a dedicated connector for the EQU outputs Instead the signals may be accessed using a 26 pin IDC connector over E point pairs E53 E65 The outputs are TTL level with very low drive capability they must be buffered externally before they can drive any real devices ACC 27 normally used as an I O buffer for the thumbwheel multiplexer port can be used to drive several of these EQU lines The 26 pin cable provided with the ACC 27 fits over the 13 jumper pairs E53 E65 Contact Delta Tau technical support for details PMAC VME On PMAC VME these signals are brought out on connector J7 JEQU referenced to digital ground GND As shipped from the factory they are open co
233. of the CVs introduced in Chapter 4 and form an excellent introduction to the PMACPanel integration ICVs introduced later in Chapter 6 PmacTerminal A basic ASCII terminal with useful ICVs for monitoring coordinate system and motor status In addition several new ICVs for controlling programs and PLCs are introduced PmacTerminalEdit A simple editor for program development and downloading The tool also supports the creation of encapsulated motion and PLC program VI wrappers that hide the details involved in controlling and monitoring PMAC motion and PLC programs PmacTerminalExecute An interactive debugger for monitoring and controlling the execution of PMAC programs PmacTerminalJog A simple tool for jogging and controlling motors PmacTerminalMotors A graphical tool for monitoring and plotting the motion of multiple motors in a real time strip chart PmacTerminalMotorsX Y A tool for monitoring and plotting the motion of motors in a real time X Y chart PmacTerminalGather A tool for specifying and gathering PMAC motion data and exporting it to Microsoft Excel PmacTerminalMotorIVars A tool for configuring individual motor I Variables PmacTerminalCoordIVars A tool for configuring coordinate system I Variables and monitoring coordinate systems Chapter 5 Development Tools e PmacTerminalGlobal A tool for monitoring PMAC s state saving configurations and configuring important global I Variables
234. of the X Y charting is very similar to that used to implement the standard chart in PmacTerminalMotors and PmacTutor10 The main difference 1s that the chart has no history buffer Hence we have created a hidden control for the data provided to the chart named XY Chart Data Chapter 5 Development Tools 125 Upen Fi Coord System Mots fe ma Term E Menu Enable Menu Track Def Plot Select cn a aE UB Plot Select E C5 Defs S x Ere oe PmacPlotX YChartBuffer takes the two point X Y cluster terminal from PmacMotorsPlotSelect VI and buffers them to generate an array of clusters for the X Y Chart To update the plot legend create an attribute node for the chart select the two items shown and set them from the cluster provided by PmacMotorsPlotSelect PmacTerminalGather 126 This tool is a general purpose tool for synchronously gathering and plotting PMAC data and outputting the data to TAB delimited spreadsheet files for use by Microsoft Excel LabVIEW Matlab or other analysis and plotting applications It allows you to execute a step or an encapsulated motion program Encapsulated motion programs created by PmacTerminalEdit can easily be installed in the tool by replacing the existing PmacProgSubVI with one of your own The LabVIEW chart controls enable you to pan and zoom the plot You can select File Print Window from the menu bar to print the panel to the print
235. olute encoder position to either CS units or motor position in encoder counts Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Value from encoder position to CS units If the motor is not defined in the CS Output Value is motor position in encoder counts If the motor is defined and Convert is TRUE Coord Defined is TRUE and Output Value is in CS units Coord Definition is a string specifying Output Value units as Encoder or the CS definition of the motor Device Number 132 0 7 be Coord Defined Bool Coord Specify Cluster Output Value Double Capture Offset Bool F Coord Definition String Input Yalue Double To use this VI you must supply an optional Capture Offset that will fetch and compute the proper offsets Once the offset 1s captured and computed it 1s maintained by the VI s internal state PmacEncoderToCoord has a companion that takes positions specified in CS units or motor position and converts them to encoder position This VI is most often used to take a motor position in encoder counts or CS units to encoder position for compare equal operations e PmacEncoderToEncoder This VI converts Input Value in either CS units or motor position in encoder counts to an absolute encoder position for compare equal operations Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Value from CS units to encoder position If the motor is not
236. om buffer has a PmacGatherSpec cluster defined as constant containing entries for P44 and P45 Therefore you do not have to specify the Address Items Simply check its Enabled box The diagram is not presented for the same reasons lt 1 Actual Yelocity 173 Iteration Ti c Present Actual Position v H DAC Command Value eration imer m Hoto C3 1 v n Background Stop round Sto P ariable 0 ao Enable QVariable 0 1 BGDE u32 VBGB Last Buffer Enum 3 Hum entries 132 5 Total entries 3570 Data Offset u32 3554 Add Offset u32 DO53 Start Address ud Enabled gj Enabled Buffer Length 532 Velocity DAQ Position I ee AF Fe yi Walid Output __ P44 P45 2 YBGDE u32 YEGE Last Buffer Enum 2 Num entries 132 5 Total entries 3570 Data Offset u32 3550 Add Offset us DO53 Start Address ud i 84 QF IE agla Walid Output Enabled gj Enabled Buffer Length Ee 1376 1503 240 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 12 Interrupts Basics This Chapter documents an emerging interface to PMAC s interrupt system The information presented here is preliminary and not supported yet PmaclinterruptExamp To run this example check the Enable box Interrupt Mask defines which sources are enabled The default value of zero enable
237. omm32 Reference Manual In addition to the required SW manuals the following technical manuals are required to successfully configure installs and interface PMAC e Hardware manual specific to your PMAC model e Manuals for PMAC options such as Dual Ported RAM If any of these manuals are missing please contact Delta Tau for a replacement before attempting your development PMACPanel and Your Computer s Display PMACPanel s indicators and controls are configured for display on a computer with 1024x768 resolution or greater You should set your display s resolution to at least this size to use them PMACPanel VIs work at smaller display sizes but the panels will not fit within your display area You can choose to resize the panel controls or change the size of your display Installing PMACPanel 10 Because of the number of SW drivers and steps in the communication process it is extremely important that each step be done carefully and tested before proceeding to the next There are a few steps that must be taken prior to installing PMACPanel e Install configure and test LabVIEW 5 0 or greater and any patches e Install configure and test any National Instruments boards e Install configure and test your systems PMAC hardware Install configure and test PComm32 Pewin32 and or PTalk if purchased If these options were not purchased you will install a limited edition of the PComm32 device driver included with PMACPane
238. on for all motor between 1 and Enable Motor Numbers when Enable is TRUE Operation is disabled when Enable is FALSE Output Enable is TRUE when operation is enabled The state is maintained by the VI Operation of DPR Fixed Background buffers overlaps with DPR Real Time operation in that the number of motors enabled must be the same Device Number 132 0 Enable Enol T E E E lekedirawmnees Output Enable Bool Enable Motor Numbers 132 1 You will note that the PmacDPRFixedBack vector VI is wrapped in a Case structure that is only executed when the configuration VI is enabled the program is executing and the proper Enable on the panel is checked Hence when the program is started the gathering of the vectors can begin The samples are accumulated as fast as possible because the actual Vector VI is buried in a While structure that executes until the entire vector is accumulated and then the rest of the system gets a chance to run This structure 1s not required but demonstrates another way to organize a gather 220 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual E asa Hoetta 7 pein Program Running PQM1 EE EE EEEE _qasaaenacnaes sAadanannanannnaananarannaannaanaaans destitute ea E AA ETE RNI anand DEAE Bun len Extract a few of the returned ie vectors for displa LF Paneli SEDER Ra a Tue p Show PQM1 Panel Ba ede Ly aast Pos Dbl
239. on is disabled in the diagram and a default for PLC Number are provided for the PLC VI State Cluster The VI queries PMAC for the PLC s execution state every execution This is done whether the program is executing or not New Output is TRUE any time PLC Enable is TRUE New Output Bool F PLC Vl State Cluster Execute State Bool DeviceNumber 132 0 PLC Enable Bool F Using this new wrapper VI it is easy to create PLC programs and use them in your PMACPanel applications The indicator on the example panel displays the Execute State of the properly loaded PLC program every iteration of the VI The button Home PLC 1 Toggle on the example panel changes the state of the PLC when clicked For the purposes of this example if you click the button the PLC begins executing and the sequence of operations in PLC 10 begin executing thereby configuring and executing the specified home operation There is one important point to note about this example M133 and M145 are defined outside the actual definition of the PLC When the VI is first executed the entire program buffer including these statements is compiled and down loaded to PMAC If you also happen to set certain I Variable and memory locations before the OPEN PLC statement these are executed when the program is downloaded Not every time the PLC is enabled We will see a few more examples of encapsulated PLC s in the following chapters Chapter 7 Homing Encoders and P
240. ontaining VIs on line documentation and Microsoft Word 97 version of documentation e PMACPanel Technical Documentation Package PMAC Compatibility PMACPanel works with the following motion control boards e PMAC PC 4 or 8 axis e PMAC LITE 4 axis e PMAC2 4 or 8 axis e MiniPMAC Installation and configuration of PMAC amplifiers and motors may have been performed by your system integrator or must be performed by you Refer to the documentation provided by your integrator or with the purchase of your PMAC for details PMACPanel supports PMAC 2 with the exception of certain encoder specific capabilities such as encoder capture and compare Customer Furnished Hardware In order for the PMACPanel to operate the following customer furnished hardware is required Chapter 2 Getting Started 7 IBM or 100 compatible 486 66 MHz personal computer PC Pentium or equivalent recommended Minimum of 16MBof RAM 32MB recommended A minimum of 100MB of free hard disk space SVGA color monitor with minimum 1024x768 resolution In addition the following optional National Instruments or third party data acquisition equipment may exist Multi function data acquisition I O cards Signal conditioning equipment Image Acquisition GPIB Instrument Control Industrial Communication Customer Furnished Software PMACPanel requires Microsoft Windows 95 or Windows NT 4 0 to operate Delta Tau Software PMACPanel requires the
241. or details on interactive execution The panel is closed by clicking the Stop button on the panel When the latched input Program Run is TRUE Input PQM Variant Array is sent to PMAC to initialize a program s P Q or M variables The program is then started as long as there 1s no program executing in the associated CS When Program Running is TRUE this or another program 1s executing in the associated CS Chapter 6 Encapsulated Motion Programs and PQMs DevwiceNumber 132 0 Y Program Running Bool F Program Run Bool F f2 40 I Program W1 State Cluster Panel Show Bool F f i Wew Output Bool F Input PAM Warant Arap S A Output PUM Vanant Array Lt When PmacTerminalEdit saves your motion program to a file and makes a copy of PmacProgSubVI with the same name as your motion program you have encapsulated the program within a VI You should edit the icon of your new encapsulation or wrapper VI to represent your motion program We will use the terms encapsulation and wrapper interchangeably Before we look at how to use the encapsulation VI lets look at the new VIs panel and diagram If you open your new encapsulation VI you ll note that the panel is a combination of PmacTerminalEdit and PmacTerminalExecute with most of their capabilities The purpose of this panel is to allow you to edit the associated motion program and monitor its execution There is no need for buffer control or for selecting a motion progra
242. orError for details on how these individual values are produced Device Number 132 0 Coord Specify Cluster Motor PYE Cluster The indicator color is set using an attribute node created from the terminal Coord p Color fo Er Position aa le Motor PYE bundles all LE lt three Iis on the right into ae Pallawina d aise Motorla Following Ered assembles and Following Error Error ou can fetch any on line motor state ou wish with these three ls PmacCoordColor outputs a color constant of orange or blue depending on whether the response state is in C5 or encoder units Clustering CS Motor and Conyerszon together into Coordinate Specify type G eliminates two terminals qe el A Coordinate Specify Cluster is assembled from three controls on the panel Each of the individual Position Velocity and Error VIs receives the cluster The P V and E VI outputs are used to drive three individual numeric indicators In this example the indicators have an attribute node to set their color The color for the text is provided by PmacCoordColor The indicator color is Orange if the reported value is in CS units and Blue if it is in encoder counts Chapter 4 Application Basics The panel for this exercise shows the indicators and the Boolean used to specify the units for P V and E displays This decoration contains individual indicators for the display of common motion states Ea
243. ors to prevent sent to PMAC do not cause damage or injury damage and possible injury Keep Away From Live Circuits Do not replace components or make adjustments inside equipment with power applied Under certain conditions dangerous potentials may exist when power has been turned off due to charges retained by capacitors To avoid casualties always remove power and discharge and ground a circuit before touching it Live Circuit Contact Procedures Never attempt to remove a person from a live circuit with your bare hands To do so is to risk sure and sudden death If a person is connected to a live circuit the following steps should be taken e Call for help immediately e De energize the circuit if possible e Use a wood or fiberglass hot stick to pull the person free of the circuit e Apply cardiopulmonary resuscitation CPR if the person has stopped breathing or is in cardiac arrest e Obtain immediate medical assistance 4 Chapter 1 Overview Electrostatic Sensitive Devices Various circuit card assemblies and electronic components may be classified as Electrostatic Discharge ESD sensitive devices Equipment manufacturers recommend handling all such components in accordance with standard ESD procedures FAILURE TO DO SO MAY VOID YOUR WARRANTY HW Interfaces When interfacing PMAC signals with any other data acquisition equipment be extremely careful to avoid shorting signals to supply or ground potentials Furthermo
244. osition Capture 165 Chapter 8 Encoder Capture and Compare Operation Basics PMAC provides sophisticated and precise motion capabilities that can be easily accessed from PMACPanel applications When coupled with National Instruments data acquisition boards PMAC and PMACPanel can be used to build highly integrated and precise motion based data acquisition systems using GPIB SCXI VXI or DAQ boards The degree of integration is directly related to your particular system and performance requirements Loosely coupled systems with slow event or clock rates that can be handled by LabVIEW can be integrated primarily with PMACPanel VIs and PMAC PLC motion programs Tightly coupled systems with fast clock rates or tightly synchronized motion and data acquisition requirements are easily handled using a few terminal blocks and wires to couple the HW systems In this Chapter we will introduce a set of VIs for converting between encoder position and motor position This is followed by an example extending the position capture capabilities introduced in Chapter 7 demonstrating how you can capture positions in response to NI DAQ signals mechanical HW triggers and clocks and use the captured positions in your application Finally we will introduce PMAC s compare equal capabilities and demonstrate several approaches for generating SW and HW triggers at specific positions while PMAC is in motion PMAC generated position triggers and clocks can then be
245. panel cluster e PmacGatherSelect Maintains a PmacGatherSelect Cluster and builds a PmacGatherSpec cluster to define gather operations You can build a list in four ways Select an item and Motor CS number P Variable Q Variable or define a Custom Gather Specification Click the associated gt button to add the item to the list on the right The gather sample rate is defined as a number of Servo Cycles All items are gathered at the same sample rate Items selected in the list can be deleted using the Remove button New Output is TRUE when an item is added to the list with a gt button or removed from the list with Remove New selection identifies the selected item in the gather list Gather Selection Items String Array define the contents of the gather list Gather Spec Cluster is an internal data type used by other PmacGather VIs to setup PMAC and collect the gathered data New Output Bool F Mew Selection i32 J 222 Gather Selection lkerngs Stri Gather Spec Cluster Device Number 132 0 Gather Select Cluster There are four methods for specifying Address Items provided by this VI and its control indicator cluster e The top group of two Menu rings allows you to select one of 29 standard motor or CS variables and a motor or CS Using the gt button in this group you can add the selection to the Text ring on the right Chapter 5 Development Tools 127 e Ifyou specify a P Variable or Q Variable number and
246. programming practice to test Response Available before using Response String Chapter 4 Application Basics D Oper Command String 1 E AEE Send the command ONCE when the button ts hit True If there is a response and it is not fetched n Imost all Pmac iew Vis eae ica require the Device Number LTE f g Send the string Ho response expected by you the next time a command a i sent any wailing response is ns dumped BEFOREexecuting the ea ee Command String 2 eens 3 Gend commands p pipo popr po pipni ipnpn pips and fetch response If there is a response display it in the indicator ou can use PmacCommGetSt to retrieve unzolicted data or simply check for more data in a response This I first checks with PHAC to see if it has anything at all This ts not usually required Using these three basic VIs you could generate an entire albeit complex PMACPanel application The purpose of most of PMACPanel is to prevent you from having to do this PMAC and PComm32 limit basic responses to 256 characters PmacCommRespStr and PmacCommGetStr handle this internally using the VI PmacCommGetBuffer to retrieve longer responses Your applications will generally not make use of this VI e PmacCommGetBuffer Check if PMAC has data available When Response Available is TRUE Response String contains all available data When Response Available is FALSE Response String is the empty string Responses are not
247. r 1 PID Cluster Input Motor I PID Cluster PmacMotorIVarMove Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the movement I Variables for the specified Motor Number are set Otherwise they are fetched from PMAC and provided by Output Motor I Move Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Number 132 0 E Ad te peee Her Output Bool F Motor Number 132 1 a Set Get Bool F pa Output Motor Move Cluster Input Motor Move Cluster PmacMotorIVarSafety Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the safety I Variables for the specified Motor Number are set Otherwise they are fetched from PMAC and provided by Output Motor I Safety Cluster with New Output TRUE Set Get 1s not required and defaults to a Get operation Device Number 32 0 E A tea peee Her Output Bool F Motor Number i32 1 SethGet Bool F Output Motor Satety Cluster Input Motor Safety Cluster Chapter 4 Application Basics Chapter 4 Application Basics e PmacMotorIVarFlag Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the encoder flag I Variable Ix25 for the specified Coord Number are set Otherwise they are fetched from PMAC and provided by Output Coord I Flag Cluster with New Output TRUE Set Get is not required and defaults to a Get operation Device Numbe
248. r 132 0 Motor Number 132 1 8 1 Set Get Bool F Input Motor l Flaq Cluster diarii He Output B ool F Output Motor l Flag Cluster The panel for this exercise shows the three main PmacMotorIVar clusters PmacMotorIVarFlag is actually a sub cluster in PmacMotorIVarSafety To change the I Variables click the Change I Vars button Each item in the cluster has a full description that is accessible using Help Show Help Because we have defined each item in the clusters as referencing a specific I Variable we have specified the item units and appropriate data ranges for each item 79 The diagram for the exercise demonstrates why using these ICVs makes life easier The Boolean criteria for executing the case are the same as in PmacTutor6 Itis executed whenever Motor Number is changed or the button is clicked When the case is executed because of a change in Motor Number the VIs perform a get operation and refresh the cluster contents with the configuration of the new motor Motor Number PID vars eae pas blove ars eed S afe P Safety lars AVO Safety ars EERTE eee A A p e The observant reader will note that the VI makes use of local copies of the panel control indicator clusters Those clusters that contain Boolean controls like PmacMotorIVarPID and PmacMotorIVarFlag have their Booleans set for Pressed mechanical action not latched action They are not used to init
249. r flags When a trigger occurs the VI reads the capture register and transforms the captured position into motor position or CS units The VI does a lot of bookkeeping to make your job easier To use it for capture operations leave the Enable Compare and Input Compare Position terminals unwired In the next section on Compare operations we will see how this VI also handles compare triggers e PmacEncoderTrigger This VI maintains Encoder Number s compare equal and capture operations and monitors the encoder s status register Home offsets are removed or added during the processing of compare equal and capture register data Limitations associated with 24 bit rollover are not handled by this VI When Enable Compare is TRUE Encoder Number s compare equal function is reset and the compare equal register is set using Input Compare Position This value is interpreted as being in CS units if Covert is TRUE and Motor Number is defined in Coord Number Otherwise this value is interpreted as being motor position in encoder counts Output Compare Position is a persistent copy of Input Compare Position when Enable Compare was TRUE The occurrence of the compare equal condition is indicated by Chapter 8 Encoder Capture and Compare Operation 171 Compare Equal Bool being TRUE This does not reset the latched condition When Encoder Number captures a position Position Captured is TRUE and the encoder s capture register is queried and converted into
250. r limitation should be understood In general a cluster should not contain both indicators and controls This doesn t work well with LabVIEW s data flow execution model what happens if it sets an indicator item before it reads it as a control value This is especially true of PMACPanel clusters that use Booleans configured with latched mechanical action LabVIEW will not let this possible race condition go and generate an error PMACPanel has made some concessions for this The PmacMotorJogControl control cluster shown below can be used to jog a motor One would love to have a motor position indicator in the cluster Sorry but we created a separate position cluster Motor Jog Control Cluster pi Jog Relative se USE oe ergo waver an 4 00 10 20 30 40 50 60 70 80 90 100 Encoder Counts MEN Cluster Type Definitions LabVIEW allows you to define cluster controls and indicators as strict types that are linked to the root control definition PMACPanel has chosen not to use this capability Clusters can be used and modified independent of the base definition This means that if you change cluster definitions the changes are not propagated to the VIs using it You must replace all instances of the control by hand You can always choose to define the ctl controls as strict types before you use them Then every new instance of the control in your application will be linked to the raw control Accessing PMACPanel VIs T
251. r must be used with its associated function VI to generate jog commands for PMAC e PmacMotorJogControl Generate PMAC on line commands for controlling jogging Motor Number Command Executed Bool is TRUE when any button is clicked in Motor Jog Cluster The value in the numeric control specifies the position Jog To and Jog Relative jog the motor to This value is interpreted as either Encoder Counts Default or Coordinate Units in Coord Number as specified on the button The button state is provided as the output Convert To Coordinate This VI builds a Coord Specify Cluster using the various inputs to simplify the interface to PmacMotorPVE and other PMACPanel ICVs Device Number 132 0 bh Convert To Coordinate Bool Coordinate System 132 1 8 7 00 poor Command Executed Bool F Motor Humber 32 1 8 1 m m Coord Specify Cluster Kotor Jog Control Cluster Chapter 4 Application Basics 71 Motor H umber a2 1 8 ssemble a Coord Specif Cluster Coord Specify Cluster When buttons in the cluster are clicked the appropriate on line command 1s assembled and sent to PMAC The diagram for this VI illustrates the general architecture PMACPanel uses to generate on line commands from control clusters User ils might want to know when a command was executed siig Command Executed Bool F Assemble the appropriate command based on which button was hit Device Number i32 0 Butt Butt Butt
252. r than 20 or 30 Call Library Function VIs To simplify the code we have removed several lines from the actual source to demonstrate the basic ideas file extcode h lt pmacu lt dprrealt h gt h gt IRTA ServoOlImer 132 floated Comm d EOS DDL floated PosTEron DDL floated Velocity Db1 floato4 Follow Error Dbl floato4 Master Pos Dbl floato4 Comp Pos Dbl int32 DAC_ oz into Move Time 1252 ulntloe Motor Motion ule LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean LVBoolean Motor Activated Open Loop Neg Limit Exceeded Pos Limit Exceeded Home In PLOgvessy Block Request Desired Velociry Zero Date BLOCK Error Dwell In Progress Integration Mode Running Move Open Loop Phased Motor Hand Wheel Enabled Neg Limit Exceeded Pos Limit Exceeded Movor ACtl vated CIN Monier CINRUM LNCS Deveces Number 152 Q a INSZ InCo DevNum Device Number 132 014 IDL DPR Real Time Motor Cluster TH2 OPR Real Time er vo Clus ver LVBoolean ValidData Iinv3s2 MNum AMoOvOor Number 132 1 L Ly SERVOSTATUS ServoSsStatus Tell PMAC we re doing our thing PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual defined by LabVIEW when the stub was created Motor Number 132 1 0 ky Shorter dereferenced name Chapter 11 DPR
253. r the capture flag e Process the capture register e Youcan do this using a PLC or using PMACPanel directly PLC Capture Flag Processing If you use a PLC to handle the capture operation you need to monitor the position captured flag bit bit 17 of the encoder control status register using Mil T gt X t C000 1774 and the captured position using the M Variable Chapter 8 Encoder Capture and Compare Operation 169 MI03 gt xX2SC003 0 24 5 This status bit turns TRUE when the trigger condition turns TRUE It returns to a non triggered FALSE state when the capture register M103 is read As long as the status bit is TRUE the capture function is disabled you must read the capture register to re enable the capture function The example program MOVTRIG PMC in the PMAC User Manual shows how this capability can be used for precision registration In the example that follows we will show precisely how PMACPanel can be used to add capture capability to your application We will not cover an example of position capture handling using a PLC This is only required if multiple captures occur faster than PMACPanel can service them or your motion program is using them directly PmacEncoderCaptureExamp This example demonstrates how PMACPanel handles encoder capture operations This is important when you want to determine the position of a motor when a trigger occurs in your system The panel shown below has Motor Encoder and Coord System
254. r the example has a section at the bottom for handling the PQM controls and a case statement at the top for handling the encapsulated PLC The PLC encapsulation VI is wrapped inside the case statement so that it can be disabled and the impact of its execution on timing can be seen The PQM approach can be used to validate the results of bit field manipulation that are masked by the DPR mechanism The five VIs in the middle handle the transfer of data between the host and PMAC using the same read write architecture used for PmacIVar PmacMemory etc All that is required is the address for DWord or Double memory or a DPR Numeric Spec cluster for field and bit access 224 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual PLC Enabled M444 Address 732 Output Value i37 M445 Address aaa Dey Eer Output Yalue Dbl Open Inout alue 32 DPR Numeric Spec M446 aint he Qutout Value i37 SETZCLEAR FE DPR Numeric Spec M447 E Dbi SET CLEAR LTE CE Boolean Bit PmacDPRNumeric VIs are discussed in two groups The first group covers word double word and floating point DPR M Variables The second group covers the bit and bit field VIs In a later example we will demonstrate an approach for grouping collections of DPR M Variables into a cluster that can be handled using a CIN e PmacDPRNumericDWord This VI is used to Set or Get PMAC long M
255. rations using PMACPanel and servicing them with a PLC You should simply be aware of who is responsible for handling the encoder Method 1 PLC Operation The P101 slider specifies the interval the PLCs will use to generate compare equal triggers Changing this value sets P101 in PMAC and enables PmacPosCompSetup discussed earlier This PLC captures the current encoder position adds the interval to the position sets the compare equal register and resets the compare equal control bits The PLC enables the PmacPosCompGen PLC and disables itself Thus when you change P101 the Comp Setup LED briefly turns Green to indicate that the setup PLC is executing When it enables PmacPosCompGen the Comp Pulse LED turns Green to indicate that it 1s active then the Comp Setup LED turns Red to indicate that it has disabled itself This is all done using the encapsulated PLC Sub VIs If you now jog the motor the PmacPosCompGen PLC will generate compare equal pulses every P101 encoder counts It does this by monitoring the encoder Compare Equal flag for the TRUE condition setting the next position adding the increment for the next position and resetting the encoder s compare equal control bits Because the PLC handles the flags PMACPanel never almost never sees the compare equal condition because the PLC services the trigger so quickly Even if PmacEncoderTrigger sees the trigger condition it does not service it You can bring the trigger to the ex
256. re observe all signal load voltage and current limitations FAILURE TO DO SO MAY VOID YOUR WARRANTY Magnetic Media Motors and amplifiers may generate strong magnetic fields Do not place or store magnetic media tapes discs etc within ten feet of any magnetic field Technical Support Delta Tau is happy to respond to any questions or concerns you have regarding PMACPanel You can contact the Delta Tau Technical Support Staff by the following methods By Telephone For immediate service you can contact the Delta Tau Technical Support Staff by telephone Monday through Friday Our support line hours and telephone numbers are listed below By FAX and E Mail You can FAX or E Mail your request or problem to us overnight and we will deal with it the following business day Our FAX numbers and E Mail addresses are listed below Please supply all pertinent equipment set up information World Wide Web WWW Delta Tau maintains a complete website containing many manuals product updates help files application notes and programming examples We may be contacted at www deltatau com Bulletin Board Service BBS Chapter 1 Overview You can also leave messages on one of our Bulletin Board Services BBS The BBS is provided for our Customers Distributors Representatives Integrators et World Headquarters Delta Tau Data Systems Inc 21314 Lassen Street Chatsworth CA 91311 Support Hot Line Monday through Friday 8 30
257. re used to manipulate the data e PmacMemorySetBit Set Bit Number in Input Value using Bit Value The new word is Output Value Input Yalue 132 Bit Humber 132 Bit Yalue Bool Output Value 2 e PmacMemorySetBits Insert Field Value into Input Value at the field defined by Start Bit and Number of Bits Output Value is Input Value with Field Value inserted Output Boolean Array is the Boolean representation of Output Value Input alue 132 Outout value i32 Field Value i3 epee sete Start Bit 32 Bits Output Boolean Array Number of Bits 132 Reading and Writing 48 Bit Memory Data Double word 48 bit memory data is handled differently than single word 24 bit data PmacMemoryReadDblI and PmacMemoryWriteDbI provide two representations of the data native LabVIEW double and two 132 integers one for the Hi X word and one for the Lo Y word You should not attempt to access bits using logical bitwise operations such as Value amp 32 on the double representation You can test them using logical comparison operations such as Value 32 Bitwise operations on the Lo and Hi word are OK Specifying addresses for double words must be done using the following notation L2s002b Specifying the address as D p002 is not recognized by PMAC e PmacMemoryReadDbl Read a 48 bit quantity from the memory location specified by Address Spec String For example L 002B The result is output as both a double and a hi word and lo word 63
258. rect operation of the device driver by checking the configuration using MotionExe or the Control Panel Applet When you select OK from the setup dialog the driver attempts to contact PMAC and reports the success or failure of the attempt e Check the driver operation communication with PMACTest or Pewin32 Chapter 2 Getting Started Chapter 2 Getting Started e Revisit the driver configuration and make certain that the device number and communication modes specified match those specified for PmacDevOpen Make changes to the VI and retest the communication by running the VI again It is known that very early versions of Windows 95 do not work well with LabVIEW and the PComm32 device driver If the problem persists contact Delta Tau Technical support If the system continues to crash try to note any error messages in detail 21 Chapter 3 PMACPanel Basics PMACPanel and PMAC as Client and Server 22 Client Application PMACPanel is a powerful LabVIEW toolkit that allows you to develop GUI based clients requiring precision multi axis motion that integrate PMAC s unique capabilities with other LabVIEW devices PMACPanel is not intended to replace a thorough understanding of PMAC s powerful motion and PLC capabilities its architecture its command language or its programming language PMACPanel is not a Graphical Motion Language GML that allows you to write PMAC programs by stringing together a set of motion d
259. riant Cluster e PmacPQMVar2Long Convert a type neutral PQM Variant Cluster to a PQM Long Cluster POM Variant Cluster PUM Long Cluster The purpose of the 2Var and Var2 VIs is to convert clusters of specific types to and from neutral PmacPQMVariant types for building arrays that bundle PQM cluster controls into a single item e PmacPQMaArray Set or Get a collection PQM variables as defined by an array of PmacPQMVariant clusters Device Number 132 0 ory New Output Bool SebGet ernen Input Variant Aray CAAA Output Variant Array The use of arrays greatly simplifies the development of PQM configuration panels for your applications PmacProgSubVI VIs created by PmacTerminalEdit accepts the arrays as inputs and provide them as outputs This allows you to update program PQM variables prior to actually executing the program and monitor any PQM variable used by the program as it executes PmacPQM Datalogging PMACPanel supports data logging of PmacPQM clusters using the VIs in the PmacFile collection These can be modified to support record attributes such as time stamps in support of your particular needs e PmacFileDatalog Manage datalog operations for type neutral PmacPQMVariant Arrays Operations as specified by the radio buttons in Datalog Control Cluster are performed when Append Read is TRUE A file must be selected prior to executing the operation using the Create Open button or New File button in the cl
260. ric controls in your Coordinate Specify Cluster 93 The motor position is processed by PmacCoordMotorToCoord to produce three outputs that can be used to enhance the display of the data PmacCoordColor sets the color of the numeric indicators The Coordinate Definition String is used to set the indicator s caption after stripping the terminating lt CR gt The example shows the use of both named and unnamed unbundles to get the data required for the operation Again you will most likely not work with these VIs at this level Dey Upen Coord Number r oord eee Scale Cluster Scale E BmacloordScale checks only fetches L e the coordinate system definitions when nae Tear Sootainate number is changed a Definition Cluster ol Cole Coordinate Specify Cluster ee Motor Number i32 0 7 0 Heit Se Motor Number i32 0 7 0 i Motor Position A a reliant ae does the Set text color and e querying A a ena a the conversion for you Rell a a on CS Definition ed B A R TE E C i esp Dbl PmacTutor13 Configuring and Monitoring Coordinate Systems This exercise introduces ICVs for monitoring and configuring coordinate systems and program execution within coordinate systems These VIs follow the same I Variable and status architectures already introduced The VI s are e PmacCoord Var Follow PMACPanel s standard I Variable VI architecture When Set Get is TRUE the
261. ring the main loop this way establishes a dependency between the opening of the device and the execution of the rest of your application Chapter 4 Application Basics Open the Device If desired the default configuration of PmacDevOpen needs modification set as default and resayve Double click PmacDevOpen on the left and execute tt If you want to be careful close the device after you are done The I fetches the Pmac Type Rom Date and Rom Yersion thereby yvenfying the corect operation This is not required and Pmac iew operation of Plomm32 doesn t really care Heopening the device without closing it is not a problem If you don t close the device it Here is a stop button to remains open as long as the YI that opened gracefully halt application the device remains in memory This means execution Note the Mechanical ou can open the device and simply use Action is Latched Y the device number typically O without reopening Its a useful trick when you understand this PmacDevOpen should be executed ONCE in your application prefereably outside of any execution loop Once PHAC is opened the device number should be wired to all Is that need it this is most of them Several techniques to ease the development process noted in the diagram descriptions These should not be relied upon in your final application If you have more than PMACPanel was designed to be easy to use To avoid having to provide one PMAC or wish to
262. rmats This process hides the required handshaking between PMAC and the host to avoid collisions when accessing DPR PComm32 supports a limited ability to write to DPR from the host and copy this data to its native location PmacDPRVarBack provides hooks for this interface but does not currently implement this capability PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 235 To minimize your work as a developer and simplify the interface the PmacDPRVarBack collection of VIs provides three VIs One to configure one or more Variable Background buffers one to fetch its contents and one to buffer the data into vectors To aid you in specifying items the configuration VI uses the PmacGatherSpec cluster that forms the heart of the PmacAddress and PmacGather collections The gathering of Variable Background data is not controlled by the servo clock therefore the data items might be taken at slightly different servo times PMAC s Variable Background mechanism is very sophisticated and an integral part of PMAC We will cover some specific issues you will encounter and must be aware of when using it PmacDPRVarBackExample The following example demonstrates the configuration of two Variable Background data buffers This allows you to build buffers that support your specific requirements For instance you can declare one buffer for each motor and coordinate system in your system You can then declare anot
263. roduce a basic PmacCIN VI comprised of a VI C C source file Microsoft Visual C workspace and project file We show how to create the C file modify the existing workspace and project file compile the source file and load the object file into the VI s Code Interface Node LabVIEW 5 0 makes the process very easy IF you follow some simple procedures In the Chapter 11 we make extensive use of CINs to handle PMAC s DPR So if you intend to really understand what can be done and how to do it then this chapter is important to you LabVIEW Code Interface Node Basics What is a CIN Code Interface Nodes are VIs that call code written in C directly from a block diagram Many LabVIEW aficionados dislike CINs However there are instances where the logic required to implement an operation is much simpler to Chapter 10 PComm32 Code Interface Nodes 195 Enabled Boollf Enable Boal TET H ccsuntnnnnenenn iG Enabled Boal jp ee specify in C than LabVIEW s G Furthermore there are instances where the need for efficiency and speed suggest the use of CINs Accessing PMAC DPR has both requirements CINs can accept any LabVIEW data type including clusters and arrays as an input or output The following illustration shows a CIN in a simple diagram EEECECEECEET maaa ay a True re a ee Code Interface Node nmnnonnnnnnnnnnnannnn LabVIEW provides several routines that make working with G data types easier Th
264. roll Position Open Get py HE CS Def String Mtr Coordi Eu Close StatPr Ea Motor Positions _ ots ja _ BF TEJ L Baje Listing Program Select s Te di n a EEE a E S a The program controls implemented by the Program Exec cluster send on line program execution commands to PMAC A brief description of the button operations is given here For detailed descriptions of PMAC s implementation of the command see the associated documentation in the PMAC Software Reference Manual or the online help available through Help Show Help e Begin Point PMAC to the coordinate system and program number specified Load the actual program from PMAC The command sent to PMAC is amp CS b PROG where CS is the specified coordinate system number and PROG is the current program number e Run Execute the program from where it is If you pointed to the beginning with Begin then start there If you abort or halt motion using the associate buttons you can restart the program from its current location The command sent to PMAC is R e Step Execute a step to the next move or dwell in the program performing all the intervening computations The command sent to PMAC is R e Prog Hold Bring the coordinate system velocity to zero thereby holding moves where they are but allowing jogs You can restart the program with Run or Step The command sent to PMAC is Chapter 5 Development Tools 121
265. rom 1 8 address motors and coordinate system I Variables Device Number 132 0 Set Get Bool F Mar Set Number 132 0 9 0 Variable Number 132 0 99 Input alue 132 0 Response Available Bool F Response idz 0 Chapter 4 Application Basics The first two I Variable operations are obvious The Get Set VIs exists because when developing GUIs to configure I Variables you want to get them for display and set them for modification Grouping these operations together in a single VI simplifies your diagrams Note that the Set Get terminal is not required If it is not wired the default operation for the VI is to Get the I Variable This type of Set Get VI architecture is very common in PMACPanel Identical sets of VIs are provided for e PmaclVarDbl PmacIVarGetDbl PmaclVarSetDbl e PmaclVarBool PmaclVarGetBool PmacIVarSetBool e PmaclVarShort PmacIVarGetShort PmacIVarSetShort There are no string I Variables Many of the I Variables are bit mapped ICVs for collecting I Variables into functional groups and manipulating the bit mapped I Variables are introduced as required later To access an I Variable the I Variable Set Number and I Variable Number are used to compute the number of the requested I Variable as shown Mar Set Number 132 0 9 0 lW anable Number i32 0 99 0 Using this approach development of ICVs that manipulate collections of I Variables for a particular motor or coordinate system is
266. rovided by PmacDPRFixedBack A DPR Fixed Motor Cluster for the specified motor and a DPR Fixed Coordinate Cluster for the specified CS If you click the Run button the data in the clusters will update e PmacDPRFixedBack Once DPR Fixed Background buffer operation is enabled this VI can be used to fetch the data for a specific Motor Number and Coord Number The input Enabled can be used to enable and disable the actual fetch The Default un wired condition is TRUE Coord Axis Char is a string X Y Z A B C U V W indicating which axis in Coord Number Comm d Pos will represent When New Output is TRUE DPR PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 219 Fixed Motor Cluster and DPR Fixed Coordinate Cluster contain the most recent background data When Enabled is FALSE the two output clusters contain the last valid data even though New Output is FALSE Device Number 132 0 Enabled Bool T Motor Number 132 1 8 1 Coord Number 32 1 8 1 Coord Asis Char New Output Bool DPR Fired Motor Cluster e DPR Fired Coordinate Cluster You will notice that there is a CS knob and a Coordinate Axis string The values in the Coordinate cluster are for all motors in the CS while the Commanded Pos Comm d Pos is for a specific Axis in the CS In the example the X axis is specified If you change the axis to Y and click Run again you will notice that the Comm d Pos does
267. rt To C5 a I P Assemble a Coord Specify Cluster T gt isz lteration TimermS O OOOO Stop TY a gt ra Ore The vector fetch in the bottom half of the diagram unbundles the returned cluster of vectors and performs a CS conversion on the elements of the selected vectors using PmacDPRMotorVecToCoord This is a vector version of the standard PmacCoord VIs e PmacDPRMotorVecToCoord Coord Specify Cluster specifies a motor within a CS and an attempt to convert Input Array from encoder counts to CS units If the motor is not defined in the CS no conversion is applied If the motor is defined and Convert is TRUE Coord Defined is TRUE and Output Array is scaled from encoder counts to CS units Coord Definition is a string specifying Output Value units as Encoder or the CS definition of the motor Coord Defined Bool Output Array Double Coord Definition String Device Number 132 0 Coord Specify Cluster Input Array Double PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 213 Enabled Bool T CIN Source file 7 PmacDPRRealTimeVectors CIN The diagram for PmacDPRRealTimeVectors is shown below You will note that the Device Number Motor Number and Buffer Length are all passed to the CIN when Enable is TRUE The CIN fetches the DPR samples and builds the vectors on every execution of the CIN 99 of the time the CIN returns a FALSE value for New Outp
268. rvo Clusters A successful query of PMAC s DPR depends on whether PMAC is accessing the memory If Wait For Valid is TRUE the VI places queries to PMAC until a successful read at which time New Output is TRUE indicating valid output data If Wait For Valid is FALSE the query may or may not succeed Ifthe query fails New Output is FALSE and the output clusters contain the data fetched during the last read Device Number 132 0 fpp fe New Output Bool Enabled Bool T 4 a DPR Real Time Motor Cluster Wait For Valid Bool T OPA Real Time Servo Cluster Motor Number Array 132 1 8 PFF e PmacDPRRealTimePVE Extract position velocity and following error from DPR Real Time Motor Cluster assuming Motor Number operating in Coord Number Assemble the measurements into Motor PVE Cluster If Convert is TRUE convert the measurements to CS units Otherwise leave them in encoder counts Device Number 132 0 Coord Specify Cluster DPR Real Time Motor Cluster Motor PVE Cluster PmacDPRRealTimeConfig CIN We are not going to cover all PmacDPR CINs in the same detail we do here Once you understand the basics of these your understanding of the other collections will follow The very simple diagram for PmacDPRRealTimeConfig is shown below You will note that the Device Number Enable Motor Numbers and Servo Period are all passed to the CIN Even the Enable is passed The CIN returns an Output Enable signal
269. s To illustrate how PMACPanel handles status information the diagram for PmacMotorStatJog is shown here The VI calls the PmacMotorStat VI covered in PmacTutorS5 and the Boolean array for each status word is indexed to get the desired bit The individual bits are assembled into a cluster for use by the indicator Notice that a string is created indicating the associated motor in the status cluster It automatically updates the indicator cluster so that you don t have to If you don t want this simply eliminate it from the cluster and modify the panel cluster ll Motor Status Jog Cluster ee Device Number 2 0 T 4 Motor Stat mt FE Motor Number i32 1 8 1 a Bi al A i m t Fil g er m t Fil g peee m t oe i PEE Motor Status VIs For completeness PMACPanel provides indicator VI pairs to monitor all bits in both motor status words You can copy the individual cluster items into your own clusters to avoid creating them from scratch Each cluster LED has been carefully constructed to include detailed help labeling and Boolean text The icons along with the panel clusters are e PmacMotorStati Create a status indicator cluster for the PmacMotorStat1 indicator containing the status for Motor Number Device Number 132 0 blotar Motor Number i32 1 8 1 Stal Motor Status Word 1 Clusher Chapter 4 Application Basics Chapter 4 Application Basics e PmacMotorStat2 Create a status indic
270. s P V or E plot style and many other items If you want to change the range on the Y Axis click the minimum or maximum value on the axis enter a new value and disable the auto scaling Don t forget to save these changes if you want them to be permanent The diagram has a case structure to allow selection of positions velocities and following errors If you wish to plot a mix of these you should modify the diagram Pause is implemented with a case structure that prevents the update of the chart If you desire the VIs for querying position etc and the PmacMotorsPVE clusters can be moved into the pause case This way the indicator update will also pause Save and Clear use the chart attribute nodes to access the History data required to implement their operations You will find these pieces of the diagram useful in many other applications because their use is not obvious in the LabVIEW documentation Chapter 5 Development Tools 123 ee Pmac Motors Chart mac Motors Chart 3 _ a E E s T F E A Ron Faas a True Pf e EIHhotrs Bed Selec Pmac Motors Chart j EAT a PB r Plot aa i Plot Name Hame P La La A L La TF Plot Select Term Menu TF Enable Menu Track Active Plot Pmac Motors Chart Pmac Motors Chart PmacTerminalMotorX Y This tool is based on PmacTerminalMotors Its purpose is to allow you to monitor and plot selected motor
271. s all sources The In Position flag generates an interrupt and is a good test When an interrupt occurs the Interrupt Occurred LED 1s on and the count and source update PMAC Interrupts Interrupt Status Configuration J Enabled zi Interrupt Occured Enable o Interrupt Count Interrupt Masko0 ae nterrupt Source ALWAYS disable interrupts when you application halts e PmacInterruptConfig When Enable is TRUE enable interrupts Indicate the availability of a handler by the output Enabled When FALSE disable interrupts ALWAYS disable interrupts when you application is not executing Interrupt Occurred is TRUE whenever this VI checks the handler and determines an interrupt has occurred Interrupt Count indicates the number of interrupts since the last service Interrupt Source specifies which source See PMAC User Manuals for details PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 12 Interrupts e 241 Device Number 132 0 11 Enabled Bool Enable Bool 477 Interrupt Occured Interrupt Mask Interrupt Count Interrupt Source 242 e Chapter 12 Interrupts PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Glossary of Terms PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Glossary of Terms e 243 Index Position Capture Control Encoder I Variable 2 for Encoder n 1902 1907 153 Flag Select Control Encoder I Variable 3 for Encoder n 1903 1908 153 A Addres
272. s and Data Organization 00000000000000000000 PmacDPRNumericExample cccccccceeeeeeeeeeeeeeseeeeeeeees PmacDPRNumericClusterExample ccccccccceceeeeeeeeeeees PmacDPRNumericCINClusterExample PmacDPRNumericSlaveExample cccccccceeeeeeeeeeeeeeees Pac DP IRN Gis ACK ia a a s PmacDPRVarBackExample cccccceccceseeeeeeeeeeeeeeeeeeeeeees PmacDPRVarBackVectorExample ccccccceceeeeeeeeeeees Chapter 12 Interrupts JBE E Soe cca E N E en ace date E A EA A E E A ade Pac LAGE UUs X ANID ie a a a duedewancuds Glossary of Terms Index Table of Contents Chapter 1 Overview Introduction Manual Layout Congratulations on your selection of PMAC and PMACPanel for National Instruments LabVIEW Delta Tau s complete motion control and instrumentation package When you selected PMAC for the motion control portion of your DAQ application you gained far more than a simple positioning system You get an integrated precision motion programming system with incredible capabilities With PMACPanel an entirely new world of motion control applications and capabilities opens Motion that triggers acquisitions and responds to data gathered by SCXI VXI and industrial automation networks such as Device Net and Field Bus is now possible using LabVIEW s very popular and powerful graphical programming environment PMACPanel is an easily extensible set of more than 250 Virtua
273. s into a PmacEncoderRegisters Cluster Device Number i32 0 Encoder Number i32 1 16 1 Encoder Registers Cluster The remaining members of this collection will not generally be used in your application but are provided for completeness These are e PmacEncoderRegTime e PmacEncoderRegDAC e PmacEncoderRegCapture e PmacEncoderRegADC Chapter 8 Encoder Capture and Compare Operation 181 Chapter 9 PMAC and NI DAQ Interfacing Basics In Chapters 7 and 8 we introduced PMAC s position capture and compare capabilities PMACPanel provides a number of ICVs to configure monitor and operate these capabilities When coupled with National Instrument s data acquisition boards PMAC and PMACPanel can be used to build highly integrated and precise motion based data acquisition systems using GPIB SCX VXI or DAQ boards In this chapter we will demonstrate how to couple standard NI DAQ boards to PMAC to synchronously trigger data acquisition at specified positions and even use PMAC s servo clock as your DAQ sampling clock The examples presented here in no way limit the wide array of possibilities or approaches you can use to trigger synchronize and organize your motion based DAQ applications Your experience and requirements will define the approaches that best meet your needs The examples of PMAC DAQ interfacing assume that you have a basic understanding of LabVIEW s data acquisition capabilities and the acquisition boar
274. s not synchronized with a specific servo cycle To minimize your work as a developer and simplify the interface the PmacDPRFixedBack collection of VIs has three VIs that collect the 28 most useful items and bundle them into LabVIEW clusters The gathering of Fixed Background data is not controlled by the servo clock therefore the data items might indeed be taken at slightly different servo times PmacDPRFixedBackExample The following example demonstrates all three PmacDPRFixedBack VIs One to configure and enable the operation of Fixed Background data buffering one to fetch the data for a specific Motor CS and one to buffer a set of vectors PmacDPRFixedBack collects the data for a single motor operating in a CS PmacDPRFixedBackVectors buffers the data exactly as PmacDPRRealTimeVectors does The panel for the example is shown below The panel demonstrates the fetching of Fixed Background data for a single Motor CS on top and the fetching of vectors for charting on the bottom On the left are controls for selecting which motor and CS to use for the fetch and enabling the fetch from DPR The example is different from PmacDPRRealTimeExample in that because the Fixed Background data buffer handles motor CS and program information it has an encapsulated motion program that can be configured and run using the box of buttons in the middle 218 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Pmac D
275. s shown here Chapter 4 Application Basics 49 et on Gy Dey tring Response String Open en a j Processed Error String Good Bad Resp Carm en z String Ei aks Pmac Communication 23 Prac Comm Global Cluster E E If you desire to use logging in your application you need to develop logic to save the Log Buffer to a file You should also realize that the size of this buffer could grow VERY large if your application uses status monitoring ICVs and you don t save and empty the contents of the log buffer at reasonable intervals PmacTutor3 Sending Commands Using Buttons PMACPanel contains the PmacButton collection of VIs that send a command string to PMAC when an input button state is TRUE Your applications panels will make constant use of these capabilities e PmacButtGetStr Send Command String to PMAC and wait for a response when Button State is TRUE When Response Available is TRUE Response String contains the response If Response Available is FALSE Response String defaults to the empty string Device Number 132 0 Command String Button State Bool Response Available Bool F Reponse String e PmacButtSendStr Send Command String to PMAC when Button State is TRUE Response Available is TRUE when PMAC has processed the command Device Number 132 0 Command String Button State Bool Response 4yvallable Bool F 50 Chapter 4 Application Basics You should u
276. s supported or used by the ICVs introduced here Some are rarely used Some should really be used from Pewn32 Others are potentially dangerous O100 turns a motor on 100 Many would and some should never be used in a user application A complete listing of available commands and their use can be found in the PMAC Software Reference Manual The PMAC on line commands used by PMACPanel VIs are listed here Global Commands Addressing mode commands amp Report currently addressed CS Chapter 4 Application Basics 65 66 Buffer control commands CLOSE DELETE GATHER LIST PLC LIST PROG SIZE Control character commands lt CONTROL A gt lt CONTROL D gt lt CONTROL F gt lt CONTROL K gt lt CONTROL P gt lt CONTROL Q gt lt CONTROL R gt lt CONTROL S gt lt CONTROL V gt General global commands RR SAVE Global variable commands I P Q and M PLC control commands DISABLE PLC ENABLE PLC Register access commands R address W address Close an open program buffer Return gather buffer space List a PLC in memory List a program in memory Return available buffer space Abort all programs and moves Disable all PLC programs Report following errors for all motors Kill all motors Report position of all motors Quit all executing motion programs Begin execution of motion programs in all coordinate systems Step working motion programs in all coordinate systems Report veloc
277. se PmacButtGetStr for commands that expect responses and PmacButtSendStr for commands that do not expect responses PmacButtSendStr doesn t return a response so the input Button State is passed through to facilitate execution sequence dependencies The panel shown here demonstrates the use of these VIs the conversion of PMAC responses into numeric data for use in LabVIEW and the use of non latched mechanical action to enable polled status for real time Chapter 4 Application Basics You will note in the diagram for this VI that the sending of the command to PMAC is simplified by the use of the PmacButtGetStr The button is directly supplied to the VI rather than wrapping the PmacCommRespStr VI in your own case structure Sending commands in response to buttons is so common that this added capability makes application development significantly simpler 51 Open A 52 Command String is sent when the button is TRUE Itis important that the Mechanical Action is set to Latch When Pressed or some other action that resets the state when read The mechanical action of Send Latched requests Motor 1 s position H 1p as long as the switch ts achive The response ts fetched as a string and converted to a double for computation or display by reading the numeric value from the response string PmacTutor4 See LabVIEW and PMAC Numeric Data Types in Chapter 3 The second step in the diagram sends the command 1p to P
278. se harm to the controller by damaging components or causing electrical shorts When our products are used in an industrial environment install them into an industrial electrical cabinet or industrial PC to protect them from excessive or corrosive moisture abnormal ambient temperatures and conductive materials If Delta Tau Data Systems Inc products are exposed to hazardous or conductive materials and or environments we cannot guarantee their operation Contents Chapter 1 Overview 1 AAT OCT ON yah saree N A E N T E A E NA T E A E T A Mannal La OW arna A E T l DENZA Oe a R A exe ene ae l Conventions Used in This Manual ccccccccccccessssseseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 3 Use Caution When Running the Examples cccccccccccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 3 Sale Bas 08010 e E E T E ee 4 Motion Commands seines ee aan eE aaa a TA E a a tua EARS 4 keep Away From Live Circuits sci sacsiicsonadecensivcaspnaRugnaceadersdacdaastonaseinonaBataraeseeoaesees 4 Live Circuit Contact Procedures ecrire enne a a ae 4 Electrostatic Sensitive DEVICES essiri retenia ren e EEEa AEC TETEA 5 SAE ACCS TNE E E ATE E E E ATE AT 5 Macnee Medid oreas a E a T N EE 5 Tecmnicak Suppo eria ea a E E EE r E 5 BYT ERO ene a e e E E ere eee meen ereere re 5 BY TAX god E Mailen a e a i a a i 5 World Wide Web WWW hncrainisnaroini tereni e e A aS ENE testes 5 Bulletin Board Service BBS kuriniu nnee e a a a a 5 Chapt
279. servo clock defines the rate at which servo loops are updated and background computations are performed Using this clock for other timing is an excellent way to synchronize PMAC s movement with externally gathered data PMAC allows multiple cards to share a common servo clock over spare lines on the serial connector J4 The servo clock on J4 JRS232 is located on pin 8 and is referenced to ground on pin 9 If multiple PMACs are being used the clock signals can be shared simply by tying identical pins on the PMACs together Accessory 3D or 3L cables with extra PMAC connectors one Accessory 3E for each extra PMAC can be used to share the clock signals in either bus or serial communications applications and of course for actual serial communications In a standalone or bus communications application there is no need for a host drop on the cable As is the case for the communications lines you cannot tie the clock lines from the RS 422 port of a PMAC PC to the RS 232 port of a PMAC Lite With the RS 422 option on the PMAC Lite Opt 9L connection to a PMAC PC 1s possible but the connector pinouts are different If serial communication is not being used but the serial data lines are connected with the clock signals it may be desirable to deactivate the serial port to prevent noise on the lines from creating input command characters to PMAC On PMAC PC PMAC Lite and PMAC VME this is done by setting jumpers E44 E47 ON on PMAC STD by makin
280. sheet File Path Specifying Gather Addresses With PMAC you can gather data from any address This requires an address to gather from and a scale factor to apply to the data The PmacGather tools use a small collection of PmacAddress VIs to simplify the specification of PMAC addresses for gathering When you understand these tools you can modify them to suit your particular needs Chapter 5 Development Tools The purpose of the PmacAddress collection is to build arrays of Address Item Clusters as shown here to define an Address Item s text description address scale factor and type Address Item Cluster Specify a description address and scale factor for a Address Item Address Item Description Text description of Address Item Address Item Address Address of Address Item Address Item Scale Scale factor for Address Item Ae a R Address Item Type Enumerated type defining type of raw data The PmacAddress collection consists three VIs PmacAddressMotors This VI maintains a table defining 29 of the most common Address Items If Input Select String 1s the empty string the VI produces Menu String Array describing the defined Address Items This should be used to set the items in a Menu or Text ring control Selection Index and Motor Number are provided by rings and define the desired item and the motor number used to compute an address for the specified item The computed item is contained in Address Item Cluster For a descr
281. sing Coordinate Systems 52 Motors 52 Applications Sample 32 Axis Definition Statements 152 153 B Buffer length 44 limitations 47 C Clusters Limits and types 59 Code Interface Nodes 32 Communication Buffers Maximum length 20 Compare Control Bits 173 Connecting PMAC Digital Inputs and Outputs 184 CONTROL F Command 14 16 26 43 44 52 55 72 D Data gathering 32 Development Tools 31 Device configuration PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Special options for serial 43 Digital Inputs and Outputs Input Source Sink Control 185 Option for Sourcing Outputs 185 Software Access 185 Standard Sinking Outputs 185 Display Resolution 10 DPR Data Buffers 28 Requirements 9 VIs to access 32 E Encoder Flag I variables 153 Encoders 30 Error Automatic handling 46 Dialog box 46 H Help facilities LabVIEW On line help 16 Home Command 153 Home Flag 153 Home Speed for Motor x 1x23 153 Homing 30 Homing from a PLC Program 155 Homing Into a Limit Switch 155 Homing Search Move 152 153 Action on Trigger 153 Home Command 153 Homing from a PLC Program 155 Homing Into a Limit Switch 155 Storing the Home Position 154 Zero Move Homing 155 Homing Speed 153 I Input Output Compare Equals Outputs 183 Installation Configuring PMACPanel 17 Driver Configuration 11 LabVIEW Configuration 15 Required S
282. sition Capture 159 When you have configured your capture trigger conditions and move direction velocity acceleration etc set these in PMAC using the Configure I Vars button on the example panel Monitoring the Home Position Capture Homing is a firmware operation that uses the position capture and homing move characteristics just configured By clicking the Home button in the PmacMotorLimitControl cluster you actually start the movement and monitoring of the encoder status bits When the movement starts the Home Complete flag for the motor is set to FALSE and the Home In Progress flag is set TRUE You can see this in the PmacMotorStatLimit cluster on the example panel e PmacMotorStatLimit Hegative Limit Exceeded Positive Limit Exceeded Home In Progress Motor Status Limit Cluster At a fundamental level you can monitor the encoder s operation using the PmacEncoderStatFlags cluster and VI The five indicators on the bottom of the cluster simply reflect the state of their associated inputs Position Captured indicates that the configured trigger condition whether used for homing or some other purpose has occurred Count Error is used internally by PMAC Compare Equal will be covered in the next chapter A detailed description of these status bits along with their standard PMAC M Variable definitions follow e PmacEncoderStatFlags 160 Chapter 7 Homing Encoders and Position Capture Encoder Status Flags Cl
283. sponses 52 Query Response 44 Sending Commands 50 52 Status 55 yV Velocity PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Index e 249
284. ss these in PmacAcc Synchronous M Variables In a motion program when PMAC is blending or splining moves together it must be calculating in the program ahead of the actual point of movement This is necessary in order to be able to blend moves together and to be able to do reasonable velocity and acceleration limiting Depending on the mode of movement calculations can be one two or three moves ahead of the actual movement Why Synchronous M Variables are Needed When assigning values to variables 1s part of the calculation the variables will get their new values ahead of their place in the program when looking at actual move execution For P and Q variables this is generally not a problem because they exist only to aid further motion calculations However for M variables particularly outputs this can be a problem because with a normal variable value Chapter 9 PMAC and NI DAQ Interfacing 185 assignment statement the action will take place sooner than is expected looking at the statement s place in the program For example in the program segment X10 Move X axis to 10 Mi 7 Turn on Output i X20 Move X axis to 20 you might expect that Output 1 would be turned on at the time the X axis reached position 10 Because PMAC is calculating ahead at the beginning of the move to X10 it will have already calculated through the program to the next move working through all program statements in between including M1 1 w
285. st probably want the operation latched You can send the trigger to the external world using Output on EQU Line and configure whether the condition is TRUE High or TRUE Low When you ve done this click Configure Compare then Enable Reset Compare This will configure the flags and the compare equal value When you jog the motor the Compare Equal indicator will turn Green when the condition occurs You cannot read the compare equal register so you need to keep track of the last value you set Fortunately PmacEncoderTrigger does this for you Method 3 PMACPanel Interval Generation You can perform the same interval generation done by the PLC s using PMACPanel This works only when the interval rate is long relative to LabVIEW s service rate If you miss an interval and the motor is already beyond the next interval position the compare condition never occurs and you stop generating pulses If you disable the PmacPosCompGen PLC and check the SW Compare Interval box the trigger is handled by the 3 input AND case Be careful that you don t enable the PLC s by changing P101 before you get the SW version of the interval generation running PmacEncoder Registers Incorporating compare and capture capabilities into your own applications is facilitated by the PmacEncoder collection of ICVs These fall into three categories Basic encoder register access and control conversion of encoder positions into motor position or CS units and back and
286. stakes Status bit definitions can be found in the PMAC Software Reference Manual More status processing VIs are introduced in later exercises PMACPanel does not supply button versions of these VIs that fetch status when the button input is TRUE Status monitoring is generally not a user driven operation The panel for this exercise demonstrates the use of PmacMotorStat Use of the coordinate system and global status VIs is identical At the bottom of the panel are the raw status Boolean arrays You cannot specify Boolean text for individual array elements hence they are left unlabeled The contents of these arrays can be indexed using standard LabVIEW array function VIs to select specific bits for your needs In this example several common status bits are used to drive indicators 55 Depending on your needs the extraction of individual status bits is a tedious task Later exercises introduce PMACPanel ICVs that extract and display the most common status bits for you thereby eliminating the tedium The diagram for the example is shown here 56 Chapter 4 Application Basics o CTE Bit 23 Motor Activated CFF Bit 22 Neg End Limit Set CHF Bit 21 Pos End Limit Set CFF Bit 18 Open Loop OE Bit 17 Running Definite E Time Move a L Bit 15 Dwell In Progress First Word 24 Element Bool Arra First Word Binary Status 132 Open Ej Te mm Request Motor 1 Status Stat second Word 24 E
287. t Bit Number in Input Value Input Value i32 Get fo Bit Number i3 Bit Value Bool e PmacMemoryGetBits Fetch the field defined by Start Bit and Number of Bits from Input Value Return the field as Output Value 132 Output Boolean Array and Bit Number same as Output Value Bit Boolean Array can be used with sets of radio buttons If Output Value 3 then Bit Boolean Array is 0 0 0 1 Input Value i32 Get Output Value Bz Start Bit 132 Bits Output Boolean Array Humber of Bits 132 Bit Number i32 Bit Boolean Array Writing Memory Data There are two VIs to directly manipulate memory data in various forms The data is first read from PMAC modified then rewritten e PmacMemoryWrite Write a 24 bit quantity Input Value to the memory location specified by Address Spec String For example X 002B Pass Input Value to Output Value and Output Boolean Array Chapter 4 Application Basics Chapter 4 Application Basics Device Number 132 0 Men Output Value i32 Address Spec String write Output Boolean Array Input alue 132 e PmacMemorySet Write Input Value to a bit field defined by Start Bit and Number of Bits at the specified memory address Output Value and Output Boolean Array are the value of the entire memory location with the new field Device Number 132 0 sania Pane pS hem Output Value i32 t RT Bit 39 Set Qutput Boolean Array Number of Bits 132 To implement these VIs the following two VIs a
288. t For Valid is TRUE the VI places queries to PMAC until a successful read at which time New Output is TRUE indicating valid output data If Wait For Valid is FALSE the query may or may not succeed Ifthe query fails New Output is FALSE and the output clusters contain the data fetched during the last read Device Number 132 0 11 Mew Output Bool Enabled Bool T p Etap jem DPR Real Time Servo Cluster walt For Valid Bool T f DPR Real Time Motor Cluster Coord Specify Cluster boana Motor PYE Cluster The fetching of multiple motor data by PmacDPRRealTimeMotors requires an array of motors and produces an array of clusters This VI differs from PmacDPRRealTimeMotor in that it does not provide Coordinate System conversions This is not provided because it would require you to assemble an array of Coord Specify Clusters If you require the Coordinate System conversion of Real Time data for multiple motors you can use the PmacDPRRealTimePVE and apply the transformation to the individual cluster elements in the output arrays PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 205 e PmacDPRRealTimeMotors Query PMAC DPR Real Time Fixed buffer Motor and Servo data for the list of motors specified in Motor Number Array When Enabled is TRUE the Default state the data for the specified motors is fetched and used to build an array of DPR Real Time Motor Clusters and DPR Real Time Se
289. t files Chapter 5 Development Tools Chapter 5 Development Tools Address A string defining the size and interpretation of the data to be gathered Legitimate designators are X Y and DP Address Offset A hexadecimal string defining the offset address of the data to be gathered Address Stride A hexadecimal numerical value that defines a stride to be used in computing the final gather address The actual address is computed as Motor Number 1 Address Stride Address Offset Scale Factor A scale factor to apply to the collected data Some entries in this table compute this value depending on the item being gathered You should refer to the PMAC I O and Memory Map in the PMAC Software Reference Manual prior to modifying this table You will note in the table that Encoder Time Between Counts has an Address Stride of 4 and an Address Offset of C000 whereas most Address Strides are 3C Using the values the address for Motor 3 Encoder Time Between Counts is computed to be Y S COO00 Motor Number 1 4 Y SC008 As another example the DAC Commanded Output for motor 2 is X 0045 Motor Number 1 3C X 950072 Scale Factors are a little more complex Many Address Items in memory are scaled by one and already have the proper scaling The most interesting ones are scaled by some combination of factors and I Variables from internal units to encoder or coordinate system units For example Present Ac
290. t is FALSE the operation is disabled e PmacDPRRealTimeConfig DPR Real Time Fixed buffer is configured to update motor information every Servo Period for all motor between 1 and Enable Motor Numbers when Enable is TRUE Operation is disabled when Enable is FALSE Output Enable is TRUE when operation is enabled The state is maintained by the VI Operation of DPR Real Time buffers overlaps with DPR Fixed Background operation in that the number of motors enabled must be the same Device Number 32 0 Enable Bool T Servo Period 132 1 Enable Motor Numbers 132 1_ E AT B utput E nable E ool PmacDPRRealTimeMotor fetches DPR data for a single motor This has an optional enable signal in this case provided by the configuration VI It also has an optional Wait For Valid input and a Coord Specify Cluster that is used to specify the Motor Number and standard Coordinate System conversions for the production of the PVE cluster e PmacDPRRealTimeMotor Query PMAC DPR for the Real Time Fixed buffer Motor and Servo data When Enabled is TRUE the Default state the data for Motor Number is fetched and used to build DPR Real Time Motor Cluster and DPR Real Time Servo Cluster Motor PVE Cluster contains data in encoder counts or coordinate system units depending on the state of Coord Specify Cluster See PmacMotorPVE for details on how this is done A successful query of PMAC s DPR depends on whether PMAC is accessing the memory If Wai
291. teps 10 I Variable Numeric types 58 Organization 57 I Variables 153 Communication configuration 45 Required Communication Configuration 19 Specific Ix03 152 1x05 68 81 Index e 245 Ix07 163 Ix08 133 152 163 Ix09 69 82 134 135 220 Ixl0 154 Ix13 154 Ixl4 154 Ix19 153 Ix20 153 Ix21 153 Ix22 193 Ix23 153 Ix25 59 79 153 155 157 159 162 Ix26 153 155 164 167 Ix30 163 Ix60 134 135 VIs to access 29 J Jogging and Homing Acceleration Time for Motor x 1x20 153 Jogging and Homing S Curve Time for Motor x Ix21 153 Jogging Moves 153 JOPTO Port 184 L LabVIEW Clusters 37 Dataflow 34 General Techniques 34 Installing PMACPanel View 15 Persistent VI State 36 Reentrancy 35 Sequences 34 35 Supported versions 24 Switch action 36 M Manual Layout 1 Maximum Permitted Motor Jog Acceleration for Motor x 1x19 153 Memory VIs to access 29 Microsoft Visual C 5 0 9 Multi threading 43 M Variable Definitions 185 M Variables 173 185 N Naming Conventions 39 NI DAQ 32 Numeric conversions 246 e Index VIs to support 52 Numeric Data Types 27 29 P P Report Motor Position 14 PComm32 10 32 PMACPanel Interfaces See PMACPanel Organization Pewin32 23 PLC VIs to access 31 Plotting VIs to access 32 PmacAcc 30 PmacAccMachinelnput8 98 99 PmacAccMachineOutput 98 99 146 P
292. ter order as indicated When you define the name of the Variable item in the cluster it is a string 1 e P34 You need to set this as the default for each control in your panel and save the VI using the cluster not the original cluster itself PmacPQMVariant functions as a neutral or void type of PQM cluster e PmacPQMVariant Cluster for tying PQM variable definition with a PQM type neutral string This cluster is generally not used on application panels POM Yariant Cluster _P34 PmacPQM Conversions There are three types of PQM VI for processing PQM clusters The examples given here are for the PmacPQMLong collection Similar collections exist for PmacPQMBool PmacPQMShort and PmacPQMDDbI e PmacPQMLong If Set Get is FALSE or not wired get the Long PQM Variable specified by PQM Variable String Response Available will be TRUE to indicate Response contains the new value If Set Get is TRUE set the Long PQM Variable using Input Value Response Available will be FALSE and Response defaults to Input Value Chapter 6 Encapsulated Motion Programs and PQMs 143 144 If you specify an M Variable it must be defined using Pewin32 PmacTerminal or PmacCommSendString Device Number 132 0 J ppop h Response Available Bool F SeaetEee IF Response idz POM Yarable String P Input alue 132 e PmacPQMLong2Var Convert the PQM Long Cluster to a type neutral PQM Variant Cluster POM Long Cluster PUM Va
293. ternal world by clicking the Output on EQU Line button and then clicking Configure Compare You should do this before starting the Jog or enabling PmacPosCompSetup so that you don t interfere with PmacPosCompGen s handling of the encoder flags If you configure the Chapter 8 Encoder Capture and Compare Operation 179 external EQU signal you can connect an oscilloscope to the appropriate pins on JEQU or the E Point jumpers documented in the PMAC Users Manual and see the generation of the interval pulses In Chapter 9 we will demonstrate how to use these pulses to synchronize your DAQ systems with your system s motion As you increase P101 the time between the pulses increases When you stop the jog the pulse interval increases as the motor slows and eventually ceases because the motor stops When you begin a jog the pulse interval decreases until the motor reaches a steady state velocity Method 2 One Shot Operation If you disable the PmacPosCompGen PLC by clicking the Disable Comp Pulse PLC button the corresponding indicator turns RED You can now manually configure compare equal operations by entering a position in the numeric control above the Enable Reset Compare button The value you enter in motor position or CS units as specified by the Encoder Counts button in the Jog cluster 1s used to configure a one time compare trigger Select the conditions for the operation using the buttons in the configuration cluster You will mo
294. that indicates whether the configuration and enable operation succeeded The only unique characteristic of this VI is the compare operation between the Output Enable and Input Enable When these values are not equal the TRUE case executes enabling or disabling the operation as defined by the input Enable Output Enable Bool gl Enable Bool T9 CTE h i E l Device Number 132 0 Enable Motor Numbers 132 1 8 1 irr i N utout Enable Bool Servo Pernod 132 1 Many things can be done with a CIN You should have a copy of the LabVIEW CIN Reference Manual when working with these until you get familiar with how 206 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual LabVIEW passes parameters This 1s especially true for clusters and arrays Things get more interesting when looking at the actual C code that implements this CIN This is shown below IE GIN Source file include extcode h include lt pmacu h gt include lt dprrealt h gt stubs for advanced CIN functions 7 UseDefaultCINInit UseDefaultCINDispose UseDefaultCINAbort UseDefaultCINLoad UseDefaultCINUnload UseDefaultCINSave This a GLOBAL variable BOOLEAN Enabled FALSE i CIN Mgkrre CINRun ant32 Device Number 132 0 LVBoolean Enable Bool T Ines Enable Motor Numbers 132 d od y IMG Servo POr OT aLa il oy CIN MgErr CINRun int32 Device Number 132 0 LVBoolean Enab
295. the home complete bit during the move it is TRUE until the trigger is found then FALSE immediately after Therefore the monitoring should also look for the desired velocity zero status bit to become TRUE which will indicate the end of the move Home Position Offset A Prior to V1 14 firmware this value could be obtained by using the PLC program HOMOFFST PMC shown in the Examples section of the PMAC User Manual Starting in V1 14 PMAC stores this value automatically 154 PMAC automatically stores the encoder position captured during the homing search move for the motor This value is kept in the Motor Encoder Position Offset Register Y 0815 Motor 1 Y 08D5 Motor 2 etc which is set to zero On power up reset for motors without absolute power on positioning If Ix10 gt 0 to specify an absolute power on position read from a resolver so no homing 1s necessary this register holds the negative of the power on resolver position In either case it contains the difference between the encoder counter Zero position power on position and the motor zero home position scaled in counts There are two main uses for this register First it provides a reference for using the encoder position capture and position compare registers These registers are referenced to the encoder zero position which is the power up position not the home motor zero position This register holds the difference between the two positions This value
296. the flag loads the next compare position and calculates the next position to be used PmacPosCompSetup pmc close Define encoder registers mlQl sSx2Sc001 0 24 sS Actual position mEOS gt x250003 0 24 8 Compare register MNOS sxes07 EO 0724s e eraten register ror rollover Define encoder compare equal register control bits MeL CI OO el heel Compare equal latch control We 2 Ree Oe 2k Compare equal output enable Mil S gt x2se000 1341 Compare equal output invert miLo gt xts00 OU 16 a Compare equal flag plOl 50 Count intecrement Configure the compare pulse open plc 18 clear Chapter 8 Encoder Capture and Compare Operation 175 p e Setup Compare equal mios ml1l01 p101 Save Increment actual position mO m Copy next pos into compare reg mugs m LOS oL gt Update next compare position mis Q gt NO invert on Output bit enable plc 19 disable plc 18 close PmacPosCompGen pmc close Service routine to service encoder register open plc 19 clear if mll1l6 1 m03 mLl05 Update next compare position MLO MLOUS prO mid 0 Reset control bit mL S endif close The PLCs can be downloaded and executed using PmacTerminalEdit and PmacTerminal or as we will show in a moment encapsulated with a wrapper VI and controlled from an application panel PmacEncoderCompareExamp 176 This example demonstrates three methods for using PMACPanel to handle enco
297. the host at a specified servo rate 2 Fixed background Data Buffer Automatic copying of limited motion program data to the host on an as requested basis 3 Variable Background Data Buffer Automatic copying of user specified data to the host 4 General Numeric Access Bi directional transfer of numeric data between the host and PMAC using any DPR addresses not dedicated to another operation 5 Control Panel Emulation of PMAC s HW control panel 6 Binary Rotary Buffer Execution of motion programs loaded by the host on an as requested basis 7 Real Time Data Gathering Automatic copying of user specified data to the host Of these seven mechanisms through 4 are completely supported by the PmacDPR collection of VIs Mechanism 5 is not really required in that the 200 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual same capabilities albeit slightly slower are provided using the existing VIs Mechanism 6 is way beyond the requirements of anything a developer should attempt with PMACPanel PMAC users generally do not use mechanism 7 In this Chapter we introduce four collections of VIs in PmacDPR that provide the capabilities required for mechanisms 1 4 These are e PmacDPRFixedBack Fixed Background data buffer e PmacDPRNumeric General numeric access to unallocated DPR memory e PmacDPRRealTime Fixed Real Time data buffer e PmacDPRVarBack Vari
298. then the coordinate system has a warning error The diagram also has a familiar architecture Chapter 4 Application Basics 95 Coord Yar Cluster Coord Status Cluster oo ee Ee Pet 1G sas Coordinate System Status ICVs There are as expected indicators for both coordinate system status words and a few miscellaneous VIs that will be introduced in later exercises e PmacCoordStat1 Create a status indicator cluster for the PmacCoordStat1 indicator containing the status for Coord Number Device Number 132 0 Coord Coord Number i3 1 erate Coordinate System Status Wo aun nT e PmacCoordStat2 Create a status indicator cluster for the PmacCoordStat2 indicator containing the status for Coord Number Device Number 132 0 Coord Coord Number i3 1 et Coordinate Systern Status Wo 96 Chapter 4 Application Basics PmacAcc ICVs This series of exercises introduce the PmacAcc collection of ICVs These form templates that combine PmacMemory s direct access of memory with PmaclIVar s Set Get architecture that access PMAC s memory mapped devices Using this approach you can hide the bit field and address specifications in your VIs This collection of VIs will grow as Delta Tau adds support for its numerous accessories At present we will demonstrate the Machine Input Output VIs and a simple example of the ACC16D control panel PmacTutor14 Machine Input and Output This tutori
299. to 24V into Pin 33 of the JOPTO connector and allow this to pull up the outputs by connecting pins 1 and 2 of Jumper El Jumper E2 must also connect pins 1 and 2 fora ULN2803A sinking output Option for Sourcing Outputs It is possible for these outputs to be sourcing drivers by substituting a UDN2981A IC for the ULN2803A This IC U3 on the PMAC PC U26 on the PMAC Lite U33 on the PMAC VME is socketed and so may easily be replaced For this driver pull down resistors should be used With a UDN2981A driver IC Jumper E1 must connect pins 2 and 3 and Jumper E2 must connect pins 2 and 3 Input Source Sink Control Jumper E7 controls the configuration of the eight inputs If it connects pins 1 and 2 the default setting the inputs are biased to 5V for the OFF state and they must be pulled low for the ON state If E7 connects pins 2 and 3 the inputs are biased to ground for the OFF state and must be pulled high for the ON state In either case a high voltage is interpreted as a 0 by the PMAC software and a low voltage is interpreted as a l Memory Mapped Access to I O These inputs and outputs are typically accessed with M variables In the suggested set of M variable definitions variables M1 through M8 are used to access outputs through 8 respectively and M11 through M18 to access inputs 1 through 8 respectively This port maps into PMAC memory space at Y address FFC2 You can also find a collection of VIs to acce
300. tor Limit Status Cluster 73 Chapter 4 Application Basics Motor Move Example Status Indicators can be modified to meet your needs using the Edit E dtContral option Priacview controls are not tipedets Resize and move them around as you wish Hotor 1 2 D 7 Stop lt Jog To Make Pre Jog i 2 J 7 oo 10 20 30 40 50 60 7 0 80 90 100 ra Coordinate Units MEE ay Motor Number tome one Zo Aon ea Indicator and Control clusters are often clusters of clusters This hierarchy sub divides capability into smaller functional groups For example you may not want your users to have the ability to home the motor so don t use tt This panel captured while actually running demonstrates how useful these new capabilities are The jog control indicates a move to a position of 23 4 defined in Coordinate Units not motor encoder counts The PVE indicator has an Orange LED indicating that the displayed position velocity and following errors are in CS units Furthermore because the Coord System dial is set to 1 that motor 1 is defined as 1 gt 1000X in CS 1 The status indicators show that Motor 1 is Assigned to a CS Enabled and in Closed Loop mode Furthermore that it is Not In Position and there is a Warning Following Error You will note that the position in the Jog Control 1s specified as 23 4 CS Units and the PVE indicator shows an actual position of 24 6 CS Units If you are actually runnin
301. trate their use The examples will have the word Examp or Example at the end of their name The remaining chapters cover numerous tutorial exercises and examples to demonstrate their use Device Management and Communication At the lowest level of the architecture are VIs that configure and manage PMACPanel communication with PMAC using PComm32 PmacDevice Configure and manage access to PMAC using PComm32 Configuration of this access must match the driver configuration set using the control panel applet or MotionExe application PmacComm Provide the ability to send on line ASCII command strings and data to PMAC and receive ASCII responses from PMAC Error handling and the ability to buffer communication for analysis and future reference are provided at this level PmaclIVar Provide direct binary access to PMAC I Variables This collection of VIs provides an easy to use architecture for accessing I Variables and avoids formatting problems that can arise when querying PMAC I Variables that might be returned as hexadecimal values PmacMemory Access to PMAC s memory mapped variables and registers are simplified with this group of VIs Query Response Interface PMAC s client server interaction model works by sending requests to PMAC and awaiting responses Interaction with PMAC at this level removes much of the tedium involved in sending commands and formatting responses PmacResponse Send formatted command strings to PMAC
302. trol Panel port at Y FFCO Y FFC1 and Y FFC2 These registers allow the ACCI16D accessory to control the operation of motors and programs from an operator control panel The panel for the example responds to the physical panel by mimicking the switch operation If you have an ACC16D and run this example you will see the various switches on this panel respond in kind 99 The diagram shows that PMAC is queried for the contents of the three locations and the converted into appropriate types for processing The selector field is extracted as are the individual control status bits If you want to make this panel control PMAC you can use the same control layout and generate the appropriate commands by borrowing portions of PmacMotorJog etc We have not done this here 100 Chapter 4 Application Basics ee Dev fia f tae y Upen a jeee 3 Send seer oe ee EEFI 8 zing P SELECTOR ee oO gt RF z Eh oldi E amp z Resp w fiica Long jeta a e E Chapter 4 Application Basics 101 Chapter 5 Development Tools Basics 102 Serious PMAC configuration tuning and setup requires the use of Pewin32 Once this step 1s completed development of your PMACPanel application can begin PMACPanel supplies a number of tools and application VIs to aid in this process and provides an architecture for adding more There are 10 standalone development tools covered in this chapter They make extensive use
303. tructure that opens and displays the panel in response Chapter 6 Encapsulated Motion Programs and PQMs 137 to the Boolean input Panel Show The very large case structure on the right is only executed when the program is not running Within this case there are two major operations The top case structure checks the Program VI State Cluster down loads the motion program the first time the VI is executed and parses the program for a program number and coordinate system This is why you don t have to keep track of the program number of its CS The large case structure below executes only when the panel is Open and Active and enables status monitoring editing and interactive execution from the panel FALSE case executes when the program is HOT running There ts a bug in L 5 0 regarding local variables and persistence oo fe E Make this TRUE to disable this TRUE to disable fa F ajeg pet ETS ETEEN Program 1 State Cluster Jautomatic down load Program File Path a a a on iT ra mi PEPE E E E E ea DE rr Bl e Get d DeviceNumber 132 0 Check for errors eRe a a E Fa a Fn Ta Fa Fn Ts Ta Fn Ts Ta Fn Ta Fa Fn Ta Fa Fon Ta Fa Fon Ta Ta Fon a Ta Fon Ts Ta Fon Tn Fa s a Fe Faran Te Fa Ts Ta Fe fa Te Fe Ts Fe Fa Ts Fe Fa Ts Te Fa Ta Te Fa Fs Ta Fe Fs Fa Fafe Ta Fa Ts Te Fn Ts Ta F Fa Ta F Fa Te F ee Fs Fa Fa Fa Ta F Te Te Fa Ta Ea Fa Te
304. tual Position DP 002B is reported in units of 1 7 FROS 32 counts To make your life easier PmacAddressMotors computes this scale factor when building the Address Item Cluster If you add items to the table remember to make them the default for the table and save the VI When you add the item you must add a little wiring to the diagram for PmacAddressMotors shown here 133 Selection Found Bool 2 4 SPM eM MMMM MMMM a A MR A A A I al Tree ara aera aaa aaa ta rata area aaa aa i A EE fa True ane z MANN E Input Select String 2 Create gather description PEE Gather Item Cluster uel Selection Index 1327 Device Number 137 0 PeT Te e Te F e Fe e Te Te Te Tae Ta Ts Ta Tn Te Fe e Fe Fe Ta F Ia Te a Fe To Fe e Te Fe a Fe Te Fe e Ta Fe Fn Te Fon e Fe Fe Foe Fe Ta Fe a Fe Ee Te Ts Te T Compute scale factors for each table ent A J RSE RGR RGR E OK ERO B BEB E BE B E E RS AR E E AL RRR e bS BE bS e E EE ES aoe oe k r meneg an anatasa asg atg aeg aeg asg atg aSa ne aeg atg asg atg aey aeg mg atg aSa mig meg aeg acg aSa we aeg meg ey atg Sn eg aa atg acg aeg aeg aeg ag atg a5 nig ng atg aSa aSa ae aeg ey acg atg seyret atg aSa sea ae atg acg atg oeg wi meg atg aSa mig eo ey acg acg a5 Seg ee aca atg ry sea aeg wig acg aig Oea neg ag atg aSa nia meg atg acg grec ry mg acg ey Sg ni aeg atg aSa gree ety ag sey ee At the
305. ture performs two sequential operations First the PmacPQMArray VI is executed This will set specified PMAC P Q or M variables using Input PQM Variant Array when Program Run is TRUE If Program Run is FALSE the specified P Q or M variables are retrieved from PMAC and output in Output PQM Variant Array with New Output TRUE The second operation is to monitor the associated motion program using PmacProgRun If Program Run is TRUE the program is running and can use the newly loaded P Q or M variables The Program Running output will be TRUE indicating that the program is running If Program Run is FALSE no program is executing and Program Running will indicate whether another motion program is running in the associated coordinate system PmacProgRun is covered in detail here e PmacProgRun Control and monitor the execution of Program Number in Coord Number The specified program is started when Program Start is TRUE and no program is currently running in Coord Number Program Running indicates that some program maybe not Program Number is running in Coord Number Output Program Start is a copy of Program Start and can be used to sequence program execution with other operations Device Number 132 0 Program Start Bool F Program Number 132 Coord Number 132 aoe Pag pe Program Running Bool F anit Output Program Start Bool F PmacPQMExamp The encapsulation of a motion program with a wrapper is a huge step toward integrati
306. two to fetch the data PmacDPRRealTimeMotor collects the data for a single motor PmacDPRRealTimeMotors collects the data for a set of motors Grouping the fetch of data for multiple motors into a single VI ensures that the data for each motor will be from the same servo cycle The panel for the example is shown below The panel demonstrates the operation for a single motor on the top and multiple motors on the bottom On the right are two clusters for displaying the data fetched from DPR On the right are controls for selecting which motor or motors and controlling the fetch from DPR On the left in between the two is a small block of controls to enable DPR Real Time data buffering 202 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual PmacHealTimeExample DPR Real Time Motor Cluster BE Servolimer i32 E Comm d Pos Dbl BE Position Dbl BE Yelocity Dbl BE Follow Error Dbl BE Master Pos Dbl DPA Real Time Servo Cluster a ne Running Running Dwell Hove Block Data Block Request Error Desired Home In Velocity ero Progress Hegative Positive Limit Exceeded Limit Exceeded 4 5 4 5 J P E A J of he 1 g 1 5 Coord System Motor Number A L Convert to CS Valid Output Wait For Valid i EE Hove Time 132 Be H oto Hotion ulG o oea O B Hand Wheel Ho Phase Enabled Commutation E Negative Positive Integration j 5 Limit Exceeded Lim
307. u can use the Motor Number knob in the Single Motor box to fetch and display the data for the corresponding motor You will note the familiar PmacMotorPVE cluster on the top left displays the PVE as a subset of the data contained in the DPR Real Time Motor Cluster If PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 203 you check the Convert to CS box the same conversion to coordinate system units covered in several earlier chapters is applied to the PVE data gathered from DPR Below this collection of controls is an indicator labeled Iteration Timer that display the time in mS for each loop iteration On average the fetch and display update of DPR Real Time data for a single motor takes 1 2mS You will notice the Green LED in the Single Motor box flickering on and off When PMAC copies data to DPR it sets a Busy Bit indicating that it is accessing DPR During this time the host running this VI cannot access DPR To avoid possible problems the VI simply indicates that it did not perform a successful fetch If you check the box labeled Wait For Valid the VI will continue placing calls to the associated CIN until it performs a successful read The demonstration on the bottom of the panel is for multiple motors To fetch the data for multiple motors you supply an array of motor numbers and enable the fetch The VI then fetches the data for the specified motors and returns an array of
308. ue in the diagram Device Number 132 0 Coord Number 132 1 4 1 Convert To Coord Bool Motors Velocity Cluster PmacMotorsErrors Query PMAC for the following errors for all motors Following error is the difference between a motor s desired and measured position at any instant When a motor is open loop killed or enabled following error does not exist and PMAC reports a value of 0 Device Number 132 0 Coord Number 132 1 8 1 Convert To Coord Bool Motor Error Cluster The diagram for PmacMotorsPositions shows that a command string is sent requesting the position This command is a control code and requires the proper option be set for the string constant The response will have as many positions as there are motors in PMAC The responses are converted into an array and processed by PmacCoordMotors2Coord Which assembles the results into a cluster for display on a PmacMotorsPVE cluster This is different from a PmacMotorPVE cluster Convert positions to Coord Number 132 1 8 1 CS unte i enabled Convert To Coord Bool The PmacMotorsPVE cluster is comprised of an array of values a Boolean array to indicate which motors have been converted to C S units and a text Chapter 4 Application Basics Chapter 4 Application Basics label for the cluster indicating which C S the display is using for those motors displayed in C S units Motors PVE Cluster The indicator cluster displays an arra
309. un and monitor the program If your application does not need to be downloaded every time your system is turned on changing the labeled Boolean constant on the top to TRUE with the mouse will disable automatic down load This prevents the down load but doesn t provide the program number or coordinate system number To provide this information set the constants in the case containing the Default Program and Default CS and save the VI 138 Chapter 6 Encapsulated Motion Programs and PQMs After the down load is complete repeated executions of this VI embedded in your application loop allow you to display the interactive panel or control and monitor the execution of your motion program The VI provides its Program VI State Cluster as an output so you have access to this information for building tools that are more sophisticated If your application provides a latched TRUE input to Panel Show the panel is opened and activated The sub case within the large case can now execute and update the panel s display This approach eliminates a fair amount of execution overhead in maintaining a panel when not displayed The structure of this part of the diagram is obvious 1f you ve followed the documentation so far The one difference is that the Stop button has no loop to halt Instead it closes the panel and allows continued execution of the other operations in the VI Once the program is loaded the case on the far left can execute This struc
310. ure Motor Status Limit Cluster Monitor the encoder status flags Encoder Status Cluster Monitor for home operation ERES and fetch Home State when complete 3 4 a a i Dev Home Oper Com fff Configure l ars a e a e a a P ine Typical l ar Motor Home ar Cluster F rchitecture ENNIE EENAA RAT A RA RA A RCT RA RR Home PLC 1 Toggle Suk Home PLC 1 LED Tuu EE Use of an encapsulated PLC program i for homing Configuring the Position Capture Trigger Earlier we discussed position capture and homing Homing is a firmware operation that uses the encoder hardware position capture capabilities to establish the relationship between a motor s zero position and the encoder s zero position To perform a homing operation three things are required 1 One of PMAC s four HW trigger flags HOME LIM LIM or FAULT must be selected 2 A trigger condition specifying the rising or falling edge of the flag possibly combined with the encoder index channel C must be selected 3 Ifa FAULT or LIM flag is used the limit or amplifier disable capabilities must be disabled If you are using these PMACPanel can perform the necessary steps but you must consult the PMAC User Manual for details so that you really understand what you are doing The PmacHomelIVar cluster on the example panel handles the configuration of Ix25 and encoder I Variables 2 and 3 PmacMotorIVarFlag controlling Ix25 is
311. use these inputs you should first Update the controls from PMAC Output PQM Variant Array maintains any changes made using the controls from execution to execution If the user clicks OK New Output Bool reflects this Otherwise Output PQM Variant Array contains the current state of the cluster controls New Output Bool Output PUM Warant Array The VI forms a basis for generating your own pop up PQM panels The diagram is shown here and has pieces of PmacProgSubVI and PmacPQMExanpp in it 148 Chapter 6 Encapsulated Motion Programs and PQMs n Indicate acceptance with OF pens ai Panel Show Bool F E Dee le 2 The Output Yariant Cluster will 3 EHe E S a always reflect the state of the pase ihe panelj Z controls Open the VI E E E e Fen Dupa oa oa a a gr Fg aae aea ae aaa aa al O hp E Init we Input Yarant Bool F D r E z device Number Input PQM Yariant Arra Determine Fetch New Data fetch Non Darl RE yar p u j the state of Tre a a the I panel Acceleration in mS beee ta Fetch r new POM data h Output POM Variant Array POM Wariant Array al Output POM Variant Aray Ps Output PAM Variant Arra Handle the bug in 5 0 As with PmacProgSubVI there is no execution loop If Panel Show is TRUE the panel is opened by the case structure on the top left If the panel is Open and Active the large case structure is enabled and the controls on
312. use it is involved in the gear ratio of the position following function the ratio is x07 Ix08 this might be changed usually raised to get a more precise ratio The second reason to change this parameter usually lowering it 1s to prevent internal saturation at very high gains or count rates velocity PMAC s filter will saturate when the velocity in counts sec multiplied by Ix08 exceeds 256M 268 435 456 This only happens in very rare applications the count rate must exceed 2 8 million counts per second before the default value of Ix08 gives a problem When changing this parameter make sure the motor is killed disabled Otherwise a sudden jump will occur because the internal position registers will have changed This means that this parameter should not be changed in the middle of an application Ifa real time change in the position following gear ratio is desired Ix07 should be changed In most practical cases Ix08 should not be set above 1000 because higher values can make the servo filter saturate too easily If Ix08 is changed x30 Chapter 7 Homing Encoders and Position Capture 163 should be changed inversely to keep the same servo performance e g if x08 is doubled x30 should be halved Motor Home Offset 1x26 132 This is the relative position of the end of the homing cycle to the position at which the home trigger was made That is the motor will command a stop at this distance from where it foun
313. used by your NI DAQ boards to control and synchronize acquisition In all cases PMACPanel simplifies the required tasks by allowing you to work in CS units motor position or raw encoder units In the Chapter 9 we show how to couple standard NI DAQ boards to PMAC to synchronously trigger data acquisition at specified positions and even use PMAC s servo clock as your DAQ sampling clock PmacEncoderPositionExamp 166 This example demonstrates how PMACPanel handles encoder positions This is important for transforming captured positions into motor position and translating compare positions specified in motor or CS units into encoder position The panel shown below Motor Encoder and Coord System knobs Motor PVE and a Jog cluster At the top right of the panel are two indicators that display the Chapter 8 Encoder Capture and Compare Operation encoder position as the raw encoder position and the encoder position converted into motor position or CS units using VIs in the PmacEncoder collection Before you run this VI you should home the motors you are working with You can do this with the example covered in Chapter 7 or execute a home command from PmacTerminal Encoder Servo Position Example P O OB 26132 Raw Encoder Pos 4 5 W i O E aa 2 T 11 00 formed Encoder Pos 3 E Capture Encoder Home Offset g Coord Syst oord system a Jog Relative 7 JogTo __ Make Pre Joo 2 T J l l l
314. uster Compare E qual Pos Captured Ho Count Error Ho C Channel Flag Ho Home Flag Ho Limit Flag Ho Limit Flag Ho Fault Flag Compare Equal M116 gt X C000 16 1 Compare equals flag for encoder 1 PIAL This compare equal signal is always copied into the compare equal flag M116 here that is available for PMAC internal use If you are using this flag internally make sure that the signal is latched M111 1 or you will probably miss it For interrupting the host edge triggered you will probably want the signal transparent Position Captured M103 gt X C003 0 24 S Encoder 1 24 bit position capture register M117 gt X C000 17 Encoder 1 position capture flag This bit goes TRUE when the trigger condition has gone TRUE it goes FALSE when the capture register is read when M103 is used in an expression As long as the bit is true the capture function is disabled you must read the capture register to re enable the capture function Count Error M118 gt X C000 18 1 Count error flag for encoder 1 If an illegal encoder transition both channels changing on the same SCLK cycle does get through or around if bypassed the delay filter and to the decoder a count error flag M118 here is set noting a loss of position information C Channel Status Quadrature encoders provide an index channel to indicate revolutions of the encoder This flag is TRUE when the channel is TRUE Home Flag A home switc
315. uster The file is opened and closed on every transaction After an operation New Datalog Display is TRUE and Output Datalog Display Cluster contains updated operation status for your application s cluster Append operations write Input PQM Variant Array to the end of the file specified in Input Datalog Display Cluster and update Current Record and Chapter 6 Encapsulated Motion Programs and PQMs Num Records in the output cluster The contents of the Note window are appended with the record Read operations read the record specified by Current Record in Input Datalog Display Cluster from the specified file and generate a new Output PQM Variant Array The availability of new data is indicated by New PQM Variant Array TRUE Output Datalog Display Cluster increments Current Record and displays the Note if any attached to the record Read operations cannot read past the end of the file and simply read the last record in the file To change the data logged by this VI simply change Input and Output PQM Variant Array to your own data type Similar modifications to PmacFileDatalogAppend Create and Read are also required Datalog Control Cluster pa eo New Datalog Display Bool F Input Datalog Display Cluster eee Output Catalog Display Cluster Append Head Bool F i e Pew POM Yarant Array Bool F Input POM Variant Aray 2 Output POM Variant Array e PmacFileDatalogAppend When Append Record is TRUE append Input PQM V
316. ut 143 0 3 can E 123727 0 ae 0 0 E i 235727 0 1 g 92 E Sample Perio Position 55 Sample Pernod Enabled Velocity Follow Error Wel eF We esl ia Walid Output Coord System 256 4 5 Buff Length 3 4 Iteration Timer mS Motor Number g To execute the example you should select how many motors you want PMAC to copy to DPR using the knob labeled Enable Motor Numbers Sample Period defines the servo sampling interval You can then click Enable to start the DPR Real Time data buffer As with PmacDPRRealTimeExamp you can select a motor to fetch and check the Enable box for the top or bottom chart The PmacDPRRealTimeVectors VI that actually processes the request for a fetch does a little more book keeping and buffers the data in arrays prior to passing it back to the caller It returns a PmacDPRRealTimeVectors cluster from which the desired items can be selected and plotted as shown here This cluster differs from PmacDPRRealTimeMotor and PmacDPRRealTimeServo Many of the items in the clusters would not generally be of interest in a time vector If you desire these you can modify PmacDPRRealTimeVectors to support them PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 211 The demonstration on the bottom panel is different from that on top in that it has a longer buffer 256 samples vs 128 samples and a CS transformation can be applied e PmacD
317. ut Good luck starting this VI then starting the motor The default servo clock has a 442uS 2262 Hz update rate As can be seen in the chart the EQU signal is active LOW If you check the PmacDAQMove panel shown above you will see that indeed the operation is configured for EQU Low TRUE Hence the initial trigger that started this acquisition started on the falling edge or leading edge of this pulse For instructions select Show YI Info from the Windows device transposed waveform graph at 10 0 Sig channels i 0 1 2 J ial Comp l F O Serva scan rate tigger edge T 10000 00 s Falling a buffer size time limit sec n 4000 5 0000 7 O scans to read 75 at a time 1000 can backlog ae 100 moo Lo 136 1 35 EA ia Bit time out sa sty 0 oye fpi n a E o nE d Multi Trigger DAQ 192 PmacDAQSync is a LabVIEW example that performs repeated acquisitions synchronized by the external trigger supplied by EQU1 at the specified sample rate In our default version of the example channels 0 1 and 2 are sampled at 20KHz The waveform chart in the panel below shows a triangle signal the EQU trigger pulse and the servo clock You can run the run this VI selecting Trigger Only in the menu ring and clicking the Run DAQ button on Chapter 9 PMAC and NI DAQ Interfacing PmacDAQMove AFTER the PLC 1s configured and enabled AND the motor is jogging If the motor is not jogging the VI will
318. ut because it still has more samples to accumulate When it has accumulated Buffer Length of samples it copies them to DPR Real Time Vector Cluster and returns a TRUE for New Output DPR Real Time Yector Cluster New Output Bool The CIN code for this type of VI is a bit more complex than those presented already It requires a data buffer for storing the accumulated samples and it requires some manipulation of the vectors in the returned cluster As defined the data buffers are global thereby making them accessible to any reentrant copy of the VI The topic of handling arrays in CINs is thoroughly covered in the LabVIEW CIN Reference Manual To simplify the code several lines have been removed from the source to demonstrate the basic ideas STANDARD INCLUDES and DEFINITIONS See actual Source File i32 vector typedef struct int32 GimsSize int32 Value 1l gt TD23 typedef TD2 TD2Hd1 float64 vector typedef struct INCSZ dimSize floato4 Value 1 ETO typedef TD3 TD3Hdl Cluster of arrays typedef struct TD2Hd1l Servo Timer 132 TDSHCL Position DEL TD3HG1l Velocity DOL TD3Hdl Commanded Pos Dbl 214 e Chapter 11 DPR Dual Ported RAM PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual TEO HGL Followang Error Dbl TD3hdL Master Postion Dbl IDSHGI Comp Pos Db Ly TD2Hd1 DAC i32 TDZHdGL Move Time 132 eae hl Ue GLOBAL buffers for handling motor data
319. vailable is TRUE Response String contains all available data When Response Available is FALSE Response String is the empty string Responses are parsed for PMAC ERR codes and flagged with a modal dialog Response Available Bool F Device Number 132 0 piecconee ting e PmacCommSendsStr Send Command String to PMAC If Command String is the empty string nothing is sent The output Device Number is a copy of input Device Number to allow sequencing of commands to PMAC Device Number 132 0 Send Command String String Device Number 132 0 e PmacCommRespStr Send Command String to PMAC and wait for a response If Command String is the empty string nothing is sent Response Available is TRUE when Response String contains response data When Response Available is FALSE Response String is the empty string Responses are parsed for PMAC ERR codes and flagged with a modal dialog Device Number 132 0 Command String Response Available Bool F Response String All the PMAC on line commands described in the PMAC User Manual and PMAC Software Reference Manual are valid commands See the appropriate manual for detailed command usage and syntax PMAC will accept multiple commands in a command string Those commands that generate a response will put the data into PMAC s output buffer whether or not you retrieve it Ifa command generates a response you should use PmacCommRespStr PMAC responses are generally single lines Th
320. wait 5 seconds for the trigger and then time out The EQU signal is configured to be active LOW Hence the first EQU pulse on the far left starts with the falling edge of the signal The default motor Jog rate configured by x22 is 32 counts mS With a position interval of 500 counts as configured by PmacDAQMove this results in a pulse every 15 625 mS Sure enough the next pulse occurs right around 15 mS in the chart device choose trigger type For instructions select Show Wl Into from the Windows menu 1 START OR STOP transposed waveform graph TRIGGER 30d channels i Sig E Bia n Pas Comp z 5 0 Servo number of scans pretrigger to acquire scans 2a 1000 0 0 0 scan rate trigger edge 2 3 2000000 balling 5 0 fF 5 input limits time limit sec 40 0 l l 7 5 00 0 000000 0 020000 0 040000 0 049950 ER gea ri time out a e Bere Multi Trigger DAQ with Servo Clock Sampling PmacDAQSyncServo is a LabVIEW example that performs repeated acquisitions synchronized by the external trigger supplied by EQU1 using PMAC s servo clock as the scan clock In our default version of the example channels 0 1 and 2 will be sampled at PMAC s default servo clock of 2262 Hz The waveform chart in the panel below shows a triangle signal the EQU trigger pulse and the servo clock You can run this VI by selecting Trigger Servo in the menu ring and clicking the Run DAQ button on PmacDAQMove AFTER the PLC
321. will be TRUE to indicate the Outputs contain the value If Set Get is TRUE set the Machine Output Port using Input Value Response Available will be FALSE and the outputs default to Input Value Device Number 132 0 a n perenes Response Avallable Bool F SetGet Bool F 147777 Output Value us 0 Input Value 2 w utpat Bool Aray amp The diagram for PmacAccMachinelInput8 is shown here to make a point about the PmacMemory VIs The VI fetches the machine input port data located at Y FFC2 bits 0 8 using PmacMemoryGet simple enough The issue you need to watch involves the Set case using PmacMemorySet i Response Available Bool F i EER Output Yalue ug 0 i Output Bool Array amp 98 Chapter 4 Application Basics This case illustrates an important behavior associated with PmacMemorySet This VI sets the contents of the bit field and provides as its output the entire 24 bit word This was done so that multiple copies of the VI can be chained together to handle multiple bit fields If you take the output of PmacMemorySet and wire this to Output Value for PmacAccMachineInput8 Output Value will not be what you expect This is obvious when running PmacAccMachineOutput8 To remedy this you need to use the Input Value that is used to set the field as Output Value PmacTutor15 ACC16D Control Panel Chapter 4 Application Basics This example fetches the contents of the several memory locations for the Con
322. wish to resize these because of memory limitations or you want larger buffers you need to change these values recompile the CIN and reload it into the CIN in PmacDPRRealTimeVectors It is possible to allocate these buffers dynamically using various CIN utilities However this introduces more complexity to the process such as allocating the buffers in the function CINLoad and deleting the buffers in CINUnLoad For this release of PMACPanel this approach was not utilized A Note About Vector CINs To avoid unnecessary complication we have not provided bullet proof PmacDPR VIs with error diagnosis and such You should be aware of the fact PComm32 handles a lot of book keeping issues associated with DPR As an example the order in which you configure and enable DPR operations 1s important If you enable a Variable Background buffer after you enable a Fixed Background buffer then disable the Fixed Background buffer the Variable Background buffer may move Hence those VIs accessing it will not return the correct data A similar issue arises when using the Vector VIs Once you have enabled a particular Vector buffer for a specific number of samples DO NOT change the length If you do you should unload the VIs that use the Vector VIs and reload them so that the buffer management can be reinitialized Otherwise it is highly probable that buffer bookkeeping will become garbled and strange things will happen A Note About Vector CIN Reentrancy M
323. y of values for all PMAC motors The array may be positions velocities or following errors The array of Boolean indicators indicate which values are in CS units The caption specifies the displayed values as being in encoder counts or a specific CS See the documentation for PmacMotor s Position PmacMotor s Velocity and PmacMotor s Error for details on how these individual values are produced peL Motor Value Array Array of numerics for positions velocities or following errors for each motor See the documentation for PmacMotor s Position PmacMotor s Velocity and PmacMotor s Error for details on how these individual values are produced TF C S Defined Array of Booleans indicating which motors are displayed in CS Units C S Applied Caption indicating the currently addressed coordinate system or that the displayed values are in Encode Counts The conversion of motor states from encoder counts to CS Units operates similar to PmacCoordMotorToCoord introduced in PmacTutor7 It is PmacCoordMotorsToCoord Generate an indicator cluster for PmacMotorsPVE Input Value Double is an array of positions velocities or following errors from VIs in the PmacMotors collection If Convert To Coord is TRUE fetch the CS definitions for the motors specified in Coord Number and scale them to CS units Motors not defined in Coord Number are not scaled Device Number 32 0 Input Yalue Double Array Coord Number 132 1 9 1 Convert
324. y and R W inputs are not supported yet e PmacDPRVarBack DPR Variable Background buffer operation is enabled this VI can be used to fetch the data specified during the configuration The input Enabled can be used to enable and disable the actual fetch The Default un wired condition is TRUE When New Output is TRUE Output Value Array contains the most recent background data When Enabled is FALSE Output Value Array contains the last valid data even though New Output is FALSE The Write Read and Input Value Array inputs are not currently functional Future releases may implement this capability Device Number 132 0 Enabled Bool T crf p op Jee New Dutput Bool VEGE Specification Cluster poe Write T Read F Boal Inout Value Array Output Value Array Note on Supporting PmacDPRVarBack CINs The CINs to support this collection of VIs are significantly more involved than the previous collections We will not cover these in the manual If you understand those presented earlier and understand the information covered here you can examine the C code for yourself The comments provide enough information if you desire to tackle changes yourself PMAC Motion Control for LabVIEW 5 0 PMACPanel User Manual Chapter 11 DPR Dual Ported RAM e 239 PmacDPRVarBackVectorExample This example replaces PmacDPRVarBack with PmacDPRVarBackVectors It use is almost identical to PmacDPRVarBackExample The only difference is that the bott
325. you can use anything above the end of this space up to DFFF for any purpose There is no easy way to automatically allocate and addresses for DPR Numeric access until you have allocated all other automatic features In the next section on DPR Variable Background buffers we will tell you how to determine the end of this allocated space For now assume that we will be working with DPR memory between amp DE00 and amp DFFF To the host computer DPR appears as 8K 16 bit words of memory Each 24 bit PMAC X or Y word thus takes two 16 bit memory addresses A PMAC long or float 48 bits thus takes four memory addresses Fortunately PComm32 handles the host computer memory mapping and PMAC handles the required bit and byte manipulations to map Motorola 56K data formats to Intel data formats PmacDPRNumericExample The following example demonstrates the use of DPR for communicating numeric data between the host and PMAC PMAC executes a PLC that generates and responds to the register data accessed using M Variables that are mapped to DPR The data is also accessed using the PQM collection of VIs to demonstrate the differences in access speed and bypass the mechanisms that field access introduces Unlike the previous PmacDPR examples that required a configuration step prior to accessing the data PmacDPRNumeric requires no configuration other than assignment of memory addresses The panel for the example is shown below On the left is a box containin
326. ystem amp 3 Button Clicked A Get Coordinate System amp 3 Status Update Status __ Running In Position EMAG Get Program 34 Program Counter Update Program NL Window _ P34 23 X5Y30 Get Machine Input X 0034 If Input 00110101110010 ES Start GPIB Acquisition E Client Application 00110101110011 Application Development Components Depending on your motion requirements system integration requirements and performance needs there are three methods for developing your PMACPanel applications The following figure shows the three primary components available from Delta Tau for your system development Chapter 3 PMACPanel Basics 23 24 Developer User eY a LabView Visual C GUI Visual Basic Data Analysis Graphical Tools Custom devices Custom drivers Data Acquisition PMAC Application packages Industrial Communication Executive Ta av PMAC Pewin32 PMAC Executive PMAC system setup and configuration operations such as motion program development motor tuning limit and safety configuration etc are best accomplished using the executive Once a set of sample motion programs is available a PMACPanel application can be developed PMAC can still operate as a standalone controller When you wish to interact with PMAC your PMACPanel applications are available to change the operation of PMAC PTalk ActiveX Controls for Visual C an
327. ystem number for the VIs is obtained from the encapsulated motion program VI 146 Chapter 6 Encapsulated Motion Programs and PQMs PmacTestExamp Development of your interactive application framework can get involved If you ve followed everything up to this point you understand how PMACPanel cooperates with PMAC how to use the various ICV s in your applications and how to encapsulate motion programs using PMACPanel This section discusses one framework for controlling and configuring multiple motion programs The example PmacTestExamp located in the PmacTest directory has four encapsulated motion programs e PmacTestPQM1 pmc in CS 1 e PmacTestPQM2 pmc in CS 2 e PmacTestCircle pmce in CS 3 e PmacTestCircles pme in CS 3 PmacProgSubVI s were created for each program by running PmacTerminalEdit loading the programs one at a time and clicking the Create Prog VI This takes 2 minutes to do PmacTestPQM1 and PmacTestPQM2 are similar to PmacPQMExamp and use P Variables to configure their motion Motor Position Chart 24000 0 22500 0 Motor 1 20000 0 Motor 2 17500 0 Motor 3 15000 0 pale S 12500 0 aa 2 10000 0 poa Paua Motor 5000 0 2500 0 0 0 2000 0 I I I I I l I I I l 21 30 40 50 60 70 80 90 100 110 120 30000 40000 a XY Buffer l l l 0 50 100 22 The panel for PmacTestExamp is shown above The panel shows four sets of controls one for each
Download Pdf Manuals
Related Search
Related Contents
APart RJ45SPLIT cable splitter or combiner Série LECP7 HP LaserJet M1522n MFP Getting Started Guide Guide Rapide FD75 FlexDraper® avec Adaptateur CA25 取扱説明書(PDF : 632KB) Hampton Direct H200 User's Manual Untitled - Instrumart Page protocolo assistencial da enfermeira obstetra no estado da bahia 15 The CPP2SDL Tool Copyright © All rights reserved.
Failed to retrieve file