GC_READ_LINE (173)
GC_READ_LINE (173)
ID 173
Application: |
PLC |
Group: MOTION
Short description:
Function that reads the selected line from the G-Code file from the SD card or from the RAM memory.
Inputs (5):
no. |
type |
impulse |
mark |
notes |
1 |
B |
yes ( 0->1 ) |
Table |
Change from 0 to 1 - reading data from the GCodeTable |
2 |
I |
- |
Table_Line_No |
G-code line number as an index of the GCodeLineAddress table in which there are pointers to the beginning of the line in the GCodeTable table |
3 |
B |
yes ( 0->1 ) |
OperTable |
Change from 0 to 1 - reading data from the GCodeOperTable |
4 |
I |
- |
Oper_Line_No |
G-code line number as an index of the GCodeOperLineAddress table in which there are pointers to the beginning of the line in the GCodeOperTable table |
5 |
I |
- |
Oper_No |
Operation file number |
Outputs (3) :
no. |
type |
impulse |
mark |
notes |
1 |
B |
yes ( 0->1->0 ) |
Done |
The line read signaling is turned on for one program cycle |
2 |
B |
no |
Error |
Error signal |
3 |
I |
- |
Error_ID |
|
Err_id |
Opis |
0 | No errors |
1 | unknown error |
2 | - |
3 | files on SD card are incorrect |
4 | no G-Code files |
5 | error reading files from the SD card |
6 | - |
7 | - |
8 | - |
9 | set line is incorrect |
10 | set G-Code is incorrect |
11 | invalid operating table ID |
Function operation:
After changing the signal on one of the inputs (Table or OperTable), the function starts downloading data from the appropriate table (GCodeTable or GCodeOperTable1 to GCodeOperTable10) depending on the activated input. The line with the number indicated by the appropriate zone is read. The values from the Table_Line_No and Oper_Line_No inputs are indexes to the tables (GCodeLineAddress or GCodeOperLineAddress) that contain the addresses of the following lines of G-codes. For Table_Line_No and Oper_Line_No inputs, the number of the G-code lines of the source files should be given, that is usually after each executed G-code this number is increased by 1. Line numbering starts from zero.
information about the previously executed G-code type is transferred to appropriate registers according to the table below
source register | target register |
R3071 ( _G_Code_G) | R3098 (_Last_G) |
R3091 ( _G_Code_MG) | R3099 (_Last_MG) |
Data read from G-codes are inserted into appropriate special registers (point 4.6.5). The user does not have direct access to the GCodeTable, GCodeLineAddress, GCodeOperTable, and GCodeOperLineAddress tables. In one cycle, one line of the source file is downloaded, i.e. G-codes are downloaded until it reaches code 13 (go to the next line).
If M1008 = 1 then: The function also checks the next G-code and if it is a G-code G1 (VECTOR movement), G2 (circular movement clockwise) or G3 (circular movement counterclockwise) clock), it transfers the data of the next movement to the appropriate registers according to the table below:
saved register | inserted into registers for the G-code |
R3092 (_G_Code_Next_X) | G1, G2, G3 |
R3093 (_G_Code_Next_Y) | G1, G2, G3 |
R3094 (_G_Code_Next_Z) | G1, G2, G3 |
R3095 (_G_Code_Next_I) | G2, G3 |
R3096 (_G_Code_Next_J) | G2, G3 |
R3097 (_Next_G) | G1, G2, G3 |
It should be ensured that the activity signals on the binary inputs do not appear simultaneously in one program cycle.
After reading the G-code line, the signal at the Done output is turned on for one cycle of the controller program.
R registers and M markers used:
no. |
name |
description |
R-read, W-write |
R3065 |
_G_Code_A |
values taken from G-codes |
W |
R3066 |
_G_Code_B |
values taken from G-codes |
W |
R3067 |
_G_Code_C |
values taken from G-codes |
W |
R3068 |
_G_Code_D |
values taken from G-codes |
W |
R3069 |
_G_Code_E |
values taken from G-codes |
W |
R3070 |
_G_Code_F |
values taken from G-codes |
W |
R3071 |
_G_Code_G |
values taken from G-codes |
W |
R3072 |
_G_Code_H |
values taken from G-codes |
W |
R3073 |
_G_Code_I |
values taken from G-codes |
W |
R3074 |
_G_Code_J |
values taken from G-codes |
W |
R3075 |
_G_Code_K |
values taken from G-codes |
W |
R3076 |
_G_Code_L |
values taken from G-codes |
W |
R3077 |
_G_Code_M |
values taken from G-codes |
W |
R3078 |
_G_Code_N |
values taken from G-codes |
W |
R3079 |
_G_Code_O |
values taken from G-codes |
W |
R3080 |
_G_Code_P |
values taken from G-codes |
W |
R3081 |
_G_Code_Q |
values taken from G-codes |
W |
R3082 |
_G_Code_R |
values taken from G-codes |
W |
R3083 |
_G_Code_S |
values taken from G-codes |
W |
R3084 |
_G_Code_T |
values taken from G-codes |
W |
R3085 |
_G_Code_U |
values taken from G-codes |
W |
R3086 |
_G_Code_V |
values taken from G-codes |
W |
R3087 |
_G_Code_W |
values taken from G-codes |
W |
R3088 |
_G_Code_X |
values taken from G-codes |
W |
R3089 |
_G_Code_Y |
values taken from G-codes |
W |
R3090 |
_G_Code_Z |
values taken from G-codes |
W |
R3091 |
_G_Code_MG |
1=G, 2=M |
W |
R3092 | _G_Code_Next_X | X coordinate of the next motion position from G-codes | W |
R3093 | _G_Code_Next_Y | Y coordinate of the next motion position from G-codes | W |
R3094 | _G_Code_Next_Z | Z coordinate of the next motion position from G-codes | W |
R3095 | _G_Code_Next_I | I coordinate of the next motion position from G-codes | W |
R3096 | _G_Code_Next_J | J coordinate of the next motion position from G-codes | W |
R3097 | _Next_G | designation of the next G-code, if it is a G1, G2 or G3 movement. Otherwise R3097 = 0 | W |
R3098 | _Last_G | variable remembering the value of the last G-code, modified from the GC_READ_LINE block, R3098 = 1 if G1, R3098 = 2 if G2, R3098 = 3 if G3, R3098 = 0 for other G or M values | W |
R3099 | _Last_MG | a variable that remembers whether the last G-code is an M or a G, modified from the GC_READ_LINE block | W |
M1005 |
_YZ_circle |
Plane for the circle YZ |
W |
M1006 |
_XZ_circle |
Plane for the circle XZ |
W |
M1007 |
_XY_circle |
Plane for the circle XY |
W |
M1008 | _Smooth_Mode | 1 - turn on trajectory smoothing, 0 - turn off trajectory smoothing | W |
Notes.
- Operational G-codes are written to the internal memory of the controller and are also read from it by the GC_READ_LINE block.
- User G-codes are stored on the SD card
- When the GC_READ_LINE block is turned on for the first time, the buffers are full, which may cause several cycles of delay in relation to the block being turned on
- it is not recommended to change the G-code line number by a value exceeding the buffer, it may cause incorrect operation of the controller
- the controller buffer in the 4s2a version is 16384 G-codes
- the 4s2a controller version supports one user G-code and 10 operating G-codes
- it is recommended to format the SD card to FAT32 file systems with any allocation size
- the maximum number of lines in the user G-code is 268,000,000
- the maximum number of user G-codes is 536,000,000 - number of lines