Back to top

How to trigger data recording from a BASIC program (AKD-T00606)

0 votes
+ vote
Vote up!

Hello,

I am using an  AKD BASIC (AKD-T00606-ICAN-E000) to control an AKM22G-ANDNC-00 servomotor. In Workbench 1.17.0.2215, I have written a simple BASIC program to move the motor and everything works fine. Now I would simply like to record position feedback (PL.FB) and analog input (AIN.VALUE) data while the motor is moving, display it on the Workbench scope and then save it as a .CSV file. In the Scope Time-base and Trigger Tab I have set:

Trigger Source: Immediate; Sampling Frequency: 500 Hz; Number of Samples: 5000 -> It records for 10s

In my program I tried to use the REC commands (REC.TRIG and REC.OFF) as follows:

                REC.TRIG
                MOVE.TARGETPOS = mlToPosition(volume)
                MOVE.RUNSPEED = linearSpeedToRPM(speed)
                MOVE.GOABS
                Print "Moving..."
                While MOVE.MOVING
                    Cls
                    Print "Pressure "; voltsToPressure(AIN.VALUE); " atm"
                    If voltsToPressure(AIN.VALUE) > 4.5 Then
                        MOVE.ABORT
                        Print "Inner absolute pressure exceeded safety limits (4.5 atm)"
                        Pause(1)
                        GoTo Main_Menu
                    End If
                Wend
                Print "Motion Complete"
                REC.OFF

Although the scope starts recording according to the REC.TRIG command and stops according to the REC.OFF, at the end I get an error message stating that data cannot be retrieved. If I remove the REC.OFF command, as expected the recording continues when the motor stops,  when I try to display the data on the Scope using the Refresh button, Workbench crashes triggering the error included in the attached .txt file. 

Everything works fine if trigger data recording directly from the GUI.

Did anyone else experience this issue? Am I using the wrong BASIC commands to control data recording?

Thank you very much in advance,

 

Andrea 

 

Attachment 
0 Comments

1 Answer

0 votes
+ vote
Vote up!

Hello,

I would recommend to test the required command sequence for what you would like to record outside of the BASIC program in the workbench terminal window.
You can enter the "REC." commands step by step in the terminal window and check how it works and how it interact with the workbench scope function.
The using of the "scope commands" in parallel with the implemented scope functions of the workbench might cause a crash.

Regards,

0 Comments
ANSWER THIS QUESTION
You may login with either your assigned username or your e-mail address.
The password field is case sensitive.

If you do not have an account, click here to register.