Difference between revisions of "AXY:Rec2Pext feature"
m |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Replaying a previously recorded pext signal. | Replaying a previously recorded pext signal. | ||
− | + | To simulate an external input, you can record it in a "*.rec" file and replay it later in a simulated mode. | |
− | This feature was implemented in firmware Version 4.5.26 and | + | This feature was implemented in firmware Version 4.5.26 and is an internal feature (i.e., the code is in the form of user functions). |
− | |||
− | |||
− | |||
+ | First you must add this segment into your proto.pro file: | ||
<pre> | <pre> | ||
− | |||
import_c MOT_GET_RECORD(byval as long, as string) as long | import_c MOT_GET_RECORD(byval as long, as string) as long | ||
import_c MOT_GET_RECDATA(byval as long, byval as long,byval as long) as double | import_c MOT_GET_RECDATA(byval as long, byval as long,byval as long) as double | ||
Line 17: | Line 14: | ||
import_c MOT_REC_MASTER(byval as long,byval as long) as long | import_c MOT_REC_MASTER(byval as long,byval as long) as long | ||
import_c MOT_REC_VER()as long | import_c MOT_REC_VER()as long | ||
− | |||
</pre> | </pre> | ||
− | + | The feature is then started as shown in the following example: | |
− | |||
− | |||
<pre> | <pre> | ||
− | dim shared fname as string = "CYCREC.DAT" ' | + | dim shared fname as string = "CYCREC.DAT" ' Original file was CYCREC.REC and I renamed it to *.dat so that do not have to send it each time. |
dim shared master_axis as generic axis | dim shared master_axis as generic axis | ||
dim shared column as long = 2 | dim shared column as long = 2 | ||
Line 68: | Line 62: | ||
− | The above program will generate | + | The above program will generate exactly the same signal as was recorded in the CYCREC.REC file, knowing that PEXT is in column 2. |
The program printout will be: | The program printout will be: | ||
− | |||
<pre> | <pre> | ||
1 set. | 1 set. | ||
Line 84: | Line 77: | ||
</pre> | </pre> | ||
− | + | ||
+ | <font color="red"> | ||
+ | On telnet, the content of the REC file: | ||
+ | </font> | ||
+ | |||
<pre> | <pre> | ||
− | |||
AMCS-> File name = CYCREC.DAT | AMCS-> File name = CYCREC.DAT | ||
n = 6 m = 18002 gap = 1 | n = 6 m = 18002 gap = 1 | ||
Recdata = PCDRYIN.PCMD,PCDRYIN.PEXT,PCDRYIN.DSTATSHR13,PCDRYIN.DCONSHR13,PCDRYIN.SLAVE,PCDRYIN.ISMOVING | Recdata = PCDRYIN.PCMD,PCDRYIN.PEXT,PCDRYIN.DSTATSHR13,PCDRYIN.DCONSHR13,PCDRYIN.SLAVE,PCDRYIN.ISMOVING | ||
108012 bytes read. size = 108012 | 108012 bytes read. size = 108012 | ||
− | |||
</pre> | </pre> | ||
− | [[Category | + | [[Category:Motion Control]] |
--[[User:Miborich|Mirko]] 11:16, 5 October 2010 (CEST) | --[[User:Miborich|Mirko]] 11:16, 5 October 2010 (CEST) |
Latest revision as of 09:19, 22 May 2014
Replaying a previously recorded pext signal.
To simulate an external input, you can record it in a "*.rec" file and replay it later in a simulated mode. This feature was implemented in firmware Version 4.5.26 and is an internal feature (i.e., the code is in the form of user functions).
First you must add this segment into your proto.pro file:
import_c MOT_GET_RECORD(byval as long, as string) as long import_c MOT_GET_RECDATA(byval as long, byval as long,byval as long) as double import_c MOT_GET_RECRUN(byval as long,byval as long) as double import_c MOT_GET_RUNINDEX(byval as long) as long import_c MOT_REC_START(byval as long,byval as long) as long import_c MOT_SET_REC_OFFSET(byval as long,byval as double) as double import_c MOT_REC_MASTER(byval as long,byval as long) as long import_c MOT_REC_VER()as long
The feature is then started as shown in the following example:
dim shared fname as string = "CYCREC.DAT" ' Original file was CYCREC.REC and I renamed it to *.dat so that do not have to send it each time. dim shared master_axis as generic axis dim shared column as long = 2 program ?VesExecute("sys.Motion = 1") call SetAxis(a1) call SetAxis(a2) attach a2 attach a1 a1.En = 0 a2.En = 0 master_axis = a1 Print "Recorder version :",MOT_REC_VER() Print "Opening file ", fname, "on axis", master_axis.elementname, ":";MOT_GET_RECORD(master_axis.elementid, fname) Print "See telnet output for details." Print "Offset = ", MOT_SET_REC_OFFSET(master_axis.elementid,17*(2^32)) Print "Hook PEXT of the axis:"; master_axis.elementname;" :"; MOT_REC_MASTER(master_axis.elementid,column); " on column:";column; " of the file" a2.MasterSource = a1.Pext attach a2 attach a1 record test.rec 500000 gap = 1 recdata = a1.Pext, a2.PCmd, a2.slave recordon Print "Go:", MOT_REC_START(master_axis.elementid,on) a2.En = 1 a1.En = 1 sleep 100 a2.Slave = 1 while MOT_GET_RUNINDEX(master_axis.elementid) < 17990 ' sleep 1 end while a2.Slave =0 sleep 1000 detach a1 detach a2 a1.En = 0 a2.En = 0 Print "Done" recordclose end program
The above program will generate exactly the same signal as was recorded in the CYCREC.REC file, knowing that PEXT is in column 2.
The program printout will be:
1 set. A2 set. Recorder version : 2 Opening file CYCREC.DAT on axis A1 :0 See telnet output for details. Offset = 7.30144e+10 Hook PEXT of the axis:A1 :0 on column:2 of the file Go: 1 Done
On telnet, the content of the REC file:
AMCS-> File name = CYCREC.DAT n = 6 m = 18002 gap = 1 Recdata = PCDRYIN.PCMD,PCDRYIN.PEXT,PCDRYIN.DSTATSHR13,PCDRYIN.DCONSHR13,PCDRYIN.SLAVE,PCDRYIN.ISMOVING 108012 bytes read. size = 108012
--Mirko 11:16, 5 October 2010 (CEST)