Project

General

Profile

SimpleCode » History » Version 2

peteruithoven, 2013-05-29 23:37

1 1 jaap
h1. SimpleCode
2 1 jaap
3 1 jaap
This simple coding scheme allows us to control the laser system, without having to implement a complete GCode interpreter.
4 1 jaap
It is based on simple integer numbers that are communicated over a line (RS232, USB or TCP/IP).
5 1 jaap
6 1 jaap
<pre>
7 1 jaap
<command> [arguments]
8 1 jaap
</pre>
9 1 jaap
10 1 jaap
h2. Commands
11 1 jaap
12 1 jaap
|_.Command|_.Function|_.Description|
13 1 jaap
|0|MoveXY <x> <y>|Absolute move to (x,y), laser OFF|
14 1 jaap
|1|LineXY <x> <y>|Absolute move to (x,y), laser ON|
15 1 jaap
|2|MoveZ <z>|Absolute move to (z), asynchronous|
16 1 jaap
|4|SetPosition <x> <y> <z>|set current position|
17 1 jaap
|5|Nop|No action|
18 1 jaap
|6|HomeXY|Move to end switches and set zero position|
19 1 jaap
|7|Set parameter <index> <value>|Set the requested parameter to a value. (100=Speed, 101=Power, 102=Frequency)|
20 1 jaap
|8|Get parameter <index> | Report the value of parameter nr <index>|
21 1 jaap
|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.|
22 1 jaap
|10|Drill mark <time> | Turn laser on for <time> msec on the current location.|
23 1 jaap
24 1 jaap
*Note:* Command 1 and 2 are synchronous. They wait until the the final position is reached before the next command is processed.
25 1 jaap
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)
26 1 jaap
27 1 jaap
A response is always in the form:
28 1 jaap
29 1 jaap
<pre>
30 1 jaap
<index> <value>
31 1 jaap
</pre>
32 1 jaap
33 1 jaap
Index can vary and is predefined and fixed (e.g. 0 == state, 1==time, 2==x, 3==y, 4==z, 5==laseron)
34 1 jaap
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.
35 1 jaap
See the table with index values for valid indexes. Unknown indexes and associated values should be silently ignored
36 1 jaap
37 1 jaap
h2. Length
38 1 jaap
39 1 jaap
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. 
40 1 jaap
41 1 jaap
h2. CRC
42 1 jaap
43 1 jaap
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.
44 1 jaap
45 1 jaap
h2. Comments
46 1 jaap
47 1 jaap
Comments lines in the file are supported. Comments start with a ';' character, and extend all the way to the EOL character.
48 1 jaap
the comment character should be the first character on the line.
49 1 jaap
50 1 jaap
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.
51 1 jaap
So these lines might include something like "Title: ", "Owner:" and "Date:".
52 1 jaap
53 1 jaap
h2. Index values
54 1 jaap
55 1 jaap
The following index values are defined at the moment (not all are implemented yet).
56 1 jaap
57 1 jaap
|_.Index|_.Value|_.R/W|_.Description|
58 1 jaap
|0|State|R|Current equipment state (0=not initialized, 1=initializing, 10=initialized, 20=job received, 30=marking, >100=error)|
59 1 jaap
|1|Time|R| Current time in [msec] after poweron|
60 1 jaap
|2|X|R(W*)| Current X position in [incr]|
61 1 jaap
|3|Y|R(W*)| Current Y position in [incr]
62 1 jaap
|4|Z|R(W*)| Current Z position in [incr]|
63 1 jaap
|5|LaserOn|R| Status of the laser (1=on)|
64 1 jaap
|6|VentOn|RW| Status of the ventilation(1=on)|
65 1 jaap
|7|PurgeOn|RW| Status of the Purge(1=on)|
66 1 jaap
|8|CoolOn|RW| Status of the Water cooling (1=on)|
67 1 jaap
|100|MarkSpeed|RW| Set Speed in [1/10000 units] of the mark lines (100% = 10000)|
68 1 jaap
|101|MarkPower|RW| Set power in [1/10000 units] of the mark lines (100% = 10000)|
69 1 jaap
|102|MarkFreq|RW| Set frequency in [Hz] of the mark lines|
70 1 jaap
|200|UserAction|W| If written with a value != 0, the system pauses, to allow the user to interact (e.g. reposition)|
71 1 jaap
|201|JobXmin|RW| Minimum X position of the current job (bounding box)|
72 1 jaap
|202|JobXMax|RW| Maximum X position of the current job (bounding box)|
73 1 jaap
|203|JobYMin|RW| Minimum Y position of the current job (bounding box)|
74 1 jaap
|204|JobYMax|RW| Maximum Y position of the current job (bounding box)|
75 2 peteruithoven
76 2 peteruithoven
h2. SimpleCode Previewer:
77 2 peteruithoven
https://github.com/peteruithoven/SimpleCodePreviewer