Questions and answers from the MC4 tech support archives are gathered and catagorized here for everyone's benefit. The most up-to-date copy of this FAQ will be found online at www.MotionCommander.com.
Topics:
Pmac.P100={this.ValueA%d*20}
The {this.ValueA} is replaced by the contents of the TEXT ENTRY object. The "%d*20" format code tells MC4 to interpret the text as a decimal number and multiply it by 20. See the "Format Codes for Curly-Bracket Queries" section of the "Command Properties" chapter for more info.
Use the query command
Pmac.P100%d/20
The "Format Codes for Curly-Bracket Queries" section of the "Command Properties" chapter. Look up "printf" in Wikipedia or a C Language programming book for additional details.
There are three ways to locate the lamp where it will query all the time. Put it on a "navigation/status" panel that is always on the screen, put it on a panel that has "Z Order=Allow Overlap" so that the panel remains "shown" even when other panels are on top of it, or put it on the station background (which is actually a panel that cannot be hidden).
Objects on hidden panels do not respond to commands. If an object on panel2 is trying to query a property of an object on hidden panel1 then nothing will be returned. You can either place the object on the station background or change its panel's "Z Order" property to "Allow Overlap" and then it will always stay un-hidden.
Use the "Release Command" instead of the "Press Command" for all of your navigation buttons. This will eliminate the issue of a button not releasing correctly when its panel is hidden.
Specify the number of historical data points you want displayed in the "Buffer Size" property and add "this.Redraw" to any one of your trace query commands. NOTE: This will result in MC4 having to redraw the plot field every update cycle, so you will see your CPU useage increase when you make this change.
Another possibility is to have an object send the "Clear" command to the XY PLOT at a specified interval.
You can't. A "rotation" property for labels is on our ToDo list.
IF ({Pmac.P100} = 1)
Pmac.P100 = 0 ; one-shot to display the msg only once
TD_Log.Value += "\nMessage text"
RETSTR "Message text"
ENDIF
The line in the above example would append the message text to a second text display object (named TD_Log) which would be the log. Note the "\n" newline code. Alternatively, you can use the "g.LogWin" global commands to add the message to MC4's Message Log window.
MC4 is a completely new and modern Motion Commander HMI. Unfortunately there is no migration tool. It would be a huge development effort for a hand-full of customers. Most MC3 customers are still using MC3 for duplicating older machines, but using MC4 for their new projects.
The "g.LogFile=filename,message" command appends a line of text to a file. Use it as a query command, and use the curly-bracket queries and % format commands to write any data you want. Here are some LogFile examples:
g.LogFile=C:\MC4\Stations\FName.txt,{Pmac.P1}
g.LogFile=C:\MC4\Stations\FName.txt,{s.TimerM},{Pmac.P1},{Pmac.P2}
g.LogFile=C:\MC4\Stations\FName.txt,{Pmac.P1%f*12.34}
g.LogFile=C:\MC4\Stations\FName.txt,{Pmac.P1%d&$1000}
g.LogFile=C:\MC4\Stations\FName.txt,{g.Time} P1={Pmac.P1}
Use the MC4 command "g.WinExec=shutdown.exe". Read all about the Shutdown utility program and its command line options at "http://support.microsoft.com/?kbid=317371". For example, "g.WinExec=shutdown -s -t 0" would force an immediate system shutdown.
The station's "Open" and "Close" commands are on the "Design" tab of Station Settings - under the "Edit..." button. Sorry. They are NOT easy to find. Put "s.TimerStart" in the station's "Open Command".
There are no data tables in MC4. Instead, right-click on any object and add one or more "User Properties" to it. For example, if you add the user property "CalcResult" to an object named "MyButton" then any object can set or query the value of "MyButton.CalcResult".
A file of mixed commands can be downloaded to the station using the "s.Down=filename" station command. Every command line must be of the form "object.command" such as "Button1.Color=0,0,128" or "Pmac.P100=1".
Read "Determining the Tab Order" near the end of the "Designing a Station" chapter.
MC4 has both "View|Full Screen" and "View|Always On Top" menu options. MC4 cannot prevent the user from using the Windows key and getting to the Start Menu however.
Yes. A case-sensitive hotkey can be assigned to each button. The button stays down as long as the hotkey is down. Sliders can be adjusted with the standard tab, arrows and page keys as well.
Try "Border View" for complex selection operations. It's for exactly this purpose!
MC4 and MC4R do not use command line options. The global options "re-open stations from last run" and "restore window positions" are for this purpose.
The MS-Word document "MCL Reference.doc" is now included in the MC4 Help system. This chapter from the old Motion Commander III user's manual has been updated for MC4. It describes each MCL keyword in detail and provides plenty of example code.
NUMERIC and STRING variables declared in MCL programs are "local", meaning that they only live as long as that instance of the program is running. You want a "global" variable that will persist from run to run. Using a PMAC variable works, but wastes valuable comms. What you want to do is right-click on the MC4 object and add a "User Property" to it. User properties can be accessed from MCL programs just like regular object properties, and make great global variables.
NUMERIC's start out zero and STRING's start out empty - but good programming practice is always to initialize.
NUMERIC i=0, j=0, k=123.456
NUMERIC i=1, array(10)
WHILE (i <= 10)
array(i)=0
i=i+1
ENDWHILE
In general, background programs should ONLY be used to perform LONG processes (perhaps controlling some very slow homing maneuver) which would otherwise completely halt the normal MC4 update cycle.
A MCL program cannot send any commands that will cause another MCL program to run. This is what is happening since the buttons that show the panels are using little MCL programs to decide whether to show or not. When the panel is shown then all its display objects execute their query commands to display current data. These MCL query commands fail because the button's MCL program is still running. Change these buttons to simple show commands or rewrite this function in JScript and your problem will go away.
The '%' character signals the start of format codes in MC4 commands. However, TWO percent characters will be converted to a single one and sent out. For example, "Pmac.%%100" will be sent out as "Pmac.%100".
Pmac.$$$***
Pmac.!Close
g.Sleep(2000) ; or maybe more
Pmac.!Open
Use a series of "g.LogFile" commands like this:
g.DOS=ERASE C:\MC4\Stations\FName.pmc
g.LogFile=C:\MC4\Stations\FName.pmc,P30={Pmac.p30}
g.LogFile=C:\MC4\Stations\FName.pmc,P31={Pmac.p31}
(etc)
The "PMAC Devices" html help page tells all about the three new download commands:
Pmac.!Download=fname
Pmac.!DownContinue=fname
Pmac.!DownSilent=fname
"!Download" displays a progress/cancel dialog and post-download report. "!DownContinue" closes the progress/cancel dialog immediately after the download is complete. "!DownSilent" does not display a progress dialog and should not be used for larger files. "fname" should be a fully-qualified path. A pick-file dialog is opened if the filename is not specified.
"Pmac.Ctrl+A" command (as an example) sends a control 'A' character to PMAC. Refer to the "PMAC Devices" chapter for more info.
Let's say that you have an absolute position in a text entry object "TE1". Then send "Pmac.J={TE1.Value}". You can add scaling with format commands like "Pmac.J={TE1.Value%d*100}".
After MC4's 30-day free trial has expired then the program will no longer recognize PMAC or OPC devices.
Yes. A station created by MC4 in demo mode cannot be opened by another demo mode MC4. A licensed copy of MC4 can open any station.
Yes. The site code changes after each licensing status change. Otherwise, a user could move the license to another computer and then re-enter the same license code to obtain a second license.
If a hard drive crashes, then a replacement license key must be issued by G&M, UNLESS a backup hard drive had been prepared that ALSO has a licensed install of MC4 on it. The licensing library utilizes the hard drive serial number, so a 2nd MC4 license must be purchased for the backup drive. (We can discuss special pricing for backup copies.)
Delete the MC4 subdirectory with the long number for a name. This will delete the licensing files that are specific to the other computer. MC4 will then start in demo mode, and you can use the "Help|Move License" menu option to transfer the license.
In the future, use the MC4 installation archive (downloaded from the website) to install MC4, and just copy the station ".mc4" file to the "Stations" subdirectory.
Delete the MC4 subdirectory with the long number for a name. This will delete the licensing files. MC4 will then start in demo mode, and you can email me the new site code.
In the future, use "Help|Move License" to transfer the MC4 license to a temporary machine, upgrade your hardware, and then move the license back.
Change the time zone back and then follow these steps:
- Transfer the license from the system computer to a temporary computer.
- Close MC4 on the system computer.
- Delete the license subdirectory on the system computer (the one with the long number).
- Change the system computer to correct time zone.
- Run MC4 on the system computer. It will start in demo mode.
- Transfer the license back.
Yes. MC4 uses a software licensing system instead of a hardware key. You can definitely demo MC4 on a machine with MC3 installed.