SimpleCode » History » Revision 1
This simple coding scheme allows us to control the laser system, without having to implement a complete GCode interpreter.
It is based on simple integer numbers that are communicated over a line (RS232, USB or TCP/IP).
|0||MoveXY <x> <y>||Absolute move to (x,y), laser OFF|
|1||LineXY <x> <y>||Absolute move to (x,y), laser ON|
|2||MoveZ <z>||Absolute move to (z), asynchronous|
|4||SetPosition <x> <y> <z>||set current position|
|6||HomeXY||Move to end switches and set zero position|
|7||Set parameter <index> <value>||Set the requested parameter to a value. (100=Speed, 101=Power, 102=Frequency)|
|8||Get parameter <index>||Report the value of parameter nr <index>|
|9||Bitmap data <bpp> <width> <data-0> .. <data-n>||Load bitmap data line of <width> pixels with each <bpp> bits per pixel. This is followed by [n] 32-bits datawords. Where [n] is rounded up to 32 bits using n = ceil(bpp*npixels/32). These pixels are clocked out during the next mark command (1). Pixel 1 is located at the LSB of the first dataword.|
|10||Drill mark <time>||Turn laser on for <time> msec on the current location.|
Note: Command 1 and 2 are synchronous. They wait until the the final position is reached before the next command is processed.
Command 3 is processed independent of the XY movement, and it is asynchronous (the next command is processed immediately, it does not wait to reach the commanded z position)
A response is always in the form:
Index can vary and is predefined and fixed (e.g. 0 state, 1time, 2==x, 3==y, 4==z, 5==laseron)
This allows a constant stream of variable data to be reported. Responses are optional. Some commands will not respond anything. Also: responses are asynchronous, they can occur at any time, and at any pace.
See the table with index values for valid indexes. Unknown indexes and associated values should be silently ignored
The length of all the command arguments is (can be) encoded in the command. This allows backwards compatibility, as unknown commands can be parsed and its arguments ignored. To implement this, a 16 bit size field is included in the commands 16 significant bits. Add [length]<<16 to the command. The lower 16 bits are used for the actual command code.
No CRC or other error checks are implemented. It is assumed that a guaranteed data stream is implemented at a lower protocol level. A TCP/IP socket implements CRC, retransmissions and flow-control.
Comments lines in the file are supported. Comments start with a ';' character, and extend all the way to the EOL character.
the comment character should be the first character on the line.
The content of the comments have no exact predefined format. However, the laser system may store the first comment lines, and display them on the LCD screen to identify the job.
So these lines might include something like "Title: ", "Owner:" and "Date:".
The following index values are defined at the moment (not all are implemented yet).
|0||State||R||Current equipment state (0=not initialized, 1=initializing, 10=initialized, 20=job received, 30=marking, >100=error)|
|1||Time||R||Current time in [msec] after poweron|
|2||X||R(W*)||Current X position in [incr]|
|3||Y||R(W*)|| Current Y position in [incr]
||4||Z||R(W*)||Current Z position in [incr]|
|5||LaserOn||R||Status of the laser (1=on)|
|6||VentOn||RW||Status of the ventilation(1=on)|
|7||PurgeOn||RW||Status of the Purge(1=on)|
|8||CoolOn||RW||Status of the Water cooling (1=on)|
|100||MarkSpeed||RW||Set Speed in [1/10000 units] of the mark lines (100% = 10000)|
|101||MarkPower||RW||Set power in [1/10000 units] of the mark lines (100% = 10000)|
|102||MarkFreq||RW||Set frequency in [Hz] of the mark lines|
|200||UserAction||W||If written with a value != 0, the system pauses, to allow the user to interact (e.g. reposition)|
|201||JobXmin||RW||Minimum X position of the current job (bounding box)|
|202||JobXMax||RW||Maximum X position of the current job (bounding box)|
|203||JobYMin||RW||Minimum Y position of the current job (bounding box)|
|204||JobYMax||RW||Maximum Y position of the current job (bounding box)|