Browse
 
Tools
Rss Categories

How to use the Logger from TML

Author: AM Reference Number: AA-15438 Views: 3364 Created: 18-05-2018 16:48 Last Updated: 23-08-2018 14:50 0 Rating/ Voters

The Logger is an evaluation tool, included in the EasyMotion Studio / Easy SetUp software, that starts automatically, when the "Run" button is pressed or when the "Start Logger" button is manually pressed.
Sometimes these two starting modes are not enough because the Logger needs to be started at a specific point in the program or on an event, that happens too fast to allow a manually start of the Logger.
In these cases, the Logger starting procedure can be implemented in a function. This way the Logger can be started from the TML application, by calling the respective function.

The first step to implement this feature, is to set the Logger to save the needed variable and make sure that the acquisition settings met the measurements requirements.

Remark: The Logger menu can be opened by pressing the mouse right button while the cursor is over the Logger surface.

The next step is to build the Logger starting function or to import it from the attached project (see the download section in the end of this article).

Remark: The attached project can be restored by using the "Restore" option in EasyMotion Studio (see this link).

Once the function is implemented / imported, it needs to be parameterized according to the Logger settings.
A detailed description of the "Start_Logger" function is presented below.

The logger starts automatically when the "Run" button is pressed, so in order to implement the manually Logger start functionality, the logger must be stopped.
That is the purpose of the first two lines in the "Start_Logger" function.

  temp_log = 0x0365;
  (temp_log),dm = 0x0000; //Set data located in DATA memory at address contained in temp_log


Remark: The "temp_long" variable is an internal 32 bits, long type, variable used to write 0x0000 at the address 0x0365 (the logger pointer address), to set the logger to the "inactive" state (to stop the logger).

The bits 15-3, inside the logger pointer address (0x0365), represent the start address of logger buffer (this can be seen it in the "Variables" window of the Logger), while the bits 2-0 represents the logger status:
- 01 - the Logger is active in the Position/Speed control loop;
- 10 - the logger is active in the Current control loop;
- 00 - the logger is inactive;
- 11 - invalid combination.

After the logger was stopped (set to inactive), the "temp_long" variable is set to the starting address of the reserved memory for the Logger points acquisition.

  temp_log = 0xc040;

This address is available in the "Memory Settings" dialog (see the picture below).



In this location needs to be written the no. of points that needs to be saved. This is the hex value that corresponds to the decimal value that needs to be inserted in the "Setup Logger Variables" dialog (see the picture below).



In case of the attached demo project, the value is 1482. Converted to hex, it becomes 0x05CA. So, the value 0x05CA will be write at the address 0xC040 (the logger starting address) and then the the pointer (temp_long) will be incremented with 1, to move to the next memory location.

  (temp_log+),dm = 0x05CA; //Set data located in DATA memory at address contained in temp_log, then increment temp_log by 1

The next RAM memory location, 0xC041, represents the sampling multiplier countdown (data logging method settings). In the attached project, it is set to 1 and then the pointer is incremented with 1, to move to the next memory location.

  (temp_log+),dm = 0x0001; //Set data located in DATA memory at address contained in temp_log, then increment temp_log by 1

The third memory location (from the logger starting address) ,0xC042, represents the sampling multiplier value (data logging method settings). In this case it is 1 because the logger was set to save a point at each slow loop (this can be seen in the "Setup Logger Variables" dialog -- see the picture above).

  (temp_log+),dm = 0x0001; //Set data located in DATA memory at address contained in temp_log, then increment temp_log by 1

The address above (0xC042) was also incremented with one. The address 0xC043, to which the pointer is moved (the third memory location from the logger starting address) contain the the address where the next acquisition point will be saved. As can be seen in the code below, it was set to 0xC04E

  (temp_log+),dm = 0xC04E; //Set data located in DATA memory at address contained in temp_log, then increment temp_log by 1

Why 0xC04E? ... Because:
- at 0xC040 was inserted the no. of acquitted points;
- at  0xC041 was inserted the sampling multiplier countdown;
- at 0xC042 was insert the sampling multiplier value;
- at 0xC043 was insert the address where the next acquisition point will be saved;
- the values inside the 0xC044 and 0xC045 memory locations, are automatically filled (when the RUN button is pressed) with the address of the "Load_Position" variable, that was set to be plotted in this example. The "Load_Position" variable requires 2 memory locations because it is 32 bits variable and a memory location has only 16 bits;
- the value inside the address 0xC046 is automatically filled (when the RUN button is pressed) with the address of the "Motor_Current" variable (16 bits, integer type variable) that was set to be plotted in this example. The "Motor_Current" is a 16 bits variable, so it needs only 1 memory location;
- the value inside the address 0xC047 is automatically filled (when the RUN button is pressed) with the address of the "Current_Reference" variable (16 bits, integer type variable) that was set to be plotted in this example;
- the values inside the addresses 0xC048 and 0xC049 are automatically filled (when the RUN button is pressed) with the address of the "Target_Position" variable (32 bits, long type variable) that was set to be plotted in this example;
- the value inside the address 0xC04A is automatically filled (when the RUN button is pressed) with the address of the "Position_Error" variable that you want to plot;
- the value inside the addresses 0xC04B and 0xC04C are automatically filled (when the RUN button is pressed) with the address of the "Load_Speed" variable (32 bits, fixed point variable) that was set to be plotted in this example;
 - inside the address 0xC04D needs to be write 0x0000, to mark the end of the variable’s addresses list. This is mandatory

Remark: To check what type are the variable set to be plotted, they can be interrogated in the "Command Interpreter" dialog.



As is mentioned above, the value 0x0000 needs to be write to the address 0xC04D, to mark the end of the variable’s addresses list.

  temp_log = 0xC04D;
  (temp_log+),dm = 0x0000; //Set data located in DATA memory at address contained in temp_log, then increment temp_log by 1


Now, the logger is prepared. It can be started. For that, the logger pointer (0x0365) is set to 0xC041.
As it was mentioned above the bits 15 - 3, in the logger pointer, represent the start address of the logger buffer (0xC040) and the bits 2-0 the logger command (01 =  start the logger, in this case).

  temp_log = 0x0365;
  (temp_log),dm = 0xC041; //Set data located in DATA memory at address contained in temp_log
  RET; //Return from function


Remark: The logger buffer starting address is shown in the "Setup Logger Variables" dialog.



After the "Start_Logger" function is built, the program can be executed (press the "Run" button). Once the TML application runs and call the logger starting fucntion, the user can press the "Upload Logger" button to plot the saved point and build the graphic.

Attachments
Demo - Start the logger manually - by function call.m.zip 97.2 Kb Download File
Rss Comments
  • There are no comments for this article.