Difference between revisions of "Printer Command Set"
(Documentation for the printer-computer interface.) |
|||
Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
+ | |||
+ | See [[Printer Command Set Table]] for a table of command byte-code mappings. | ||
= Command Set Functions = | = Command Set Functions = | ||
Line 165: | Line 167: | ||
</blockquote> | </blockquote> | ||
Execute a command in the secondary command set. | Execute a command in the secondary command set. | ||
− | |||
− | |||
− | |||
− |
Revision as of 23:07, 29 December 2013
Contents
Overview
See Printer Command Set Table for a table of command byte-code mappings.
Command Set Functions
Position and movement
setPosition
Command: 'p'Response: xpos: int16, ypos: int16
Get the current head position in steps, relative to the zero-point.
getPosition
Command: 'P', xpos: int16, ypos: int16Response: none
Move the head to step position (xpos, ypos), relative to the zero-point.
zeroPosition
Command: 'Z'Response: none
Zero the head position Makes the current position be location (0, 0).
incrementPosition
Command: 'M', dx: int16, dy: int16Response: none
Move the head by dx steps horizontally and dy steps vertically.
getHeadSpeed
Command: 's'Response: speed: uint8
setHeadSpeed
Command: 'S', speed: uint8Response: none
Cartridge
testFire
Command: 'T', cartridge: uint8, count: uint8Response: none
Fire all of cartridge's nozzles by iterating over address signals count times. The cartridge number uses bit places to address multiple cartridges, e.g. a value of 0b01 corresponds to the first cartridge, 0b10 corresponds to the second cartridge, and 0b11 corresponds to both the first and second cartridges.
fire
Command: 'F', cartridge: uint8, primitive: uint8, address: uint8, count: uint8Response: none
Fire the nozzle at address of primitive of cartridge number cartridge a total of count times.
printRow
Command: 'R', cartridge: uint8, stepsPerDot: uint8, numDots: uint16, data: uint8[]Response: none
Burst mode firing. Print numDots dots with stepsPerDot X-axis steps between them. The total distance travelled will be stepsPerDot × numDots steps. The firing information is in the data array, which is of length num-set-bits(cartridge) × numDots × 13 bytes. Each byte represents primitive signal values. The format is ordered first by dot position, then by cartridge number as it appears from least-significant bit to most significant, and then by address from 1 to 13.
For example, for cartridge 0b11 and stepsPerDot of 100, the bytes would be ordered: [ dot0-cartridge1-address1, dot0-cartridge1-address2, ..., dot0-cartridge1-address13, dot0-cartridge2-address0, dot0-cartridge2-address0, ..., dot99-cartridge2-address13 ]
Calibration
getCalibration
Command: 'c', field: uint8Response: value: int16
Get the calibration value of field. The field may be:
- 0x01 -
- 0x02 -
setCalibration
Command: 'C', field: uint8, value: int16Response: none
Set the calibration of field to value. See getCalibration for the list of valid fields and their corresponding byte codes.
getVersion
Command: 'v'Response: majorRevision: uint16, minorRevision: uint16
Get the firmware version number.
Peripherals
digitalRead
Command: 'd', pinNumber: uint8Response: value: uint8
Read the digital value of pinNumber pin (Arduino numbering). Automatically sets required registers to allow input. Response value is 0x00 for false, and 0x01 for true.
digitalWrite
Command: 'D', pinNumber: uint8, value: uint8Response: none
Write the digital value of pinNumber pin (Arduino numbering). Automatically sets required registers to allow output. The value argument is 0x00 for false, or else true. The firmware will not be responsible for making sure the pin isn't already used for motor or cartridge control.
analogRead
Command: 'a', pinNumber: uint8Response: value: uint16
Read the analogue (ADC) value of pinNumber pin (Arduino numbering). Automatically sets required registers to allow input. Response value is the ADC reading. The firmware will not be responsible for making sure the pin isn't already used for motor or cartridge control, or for checking that the pin is ADC capabable.
analogWrite
Command: 'A', pinNumber: uint8, dutyCycle: uint8Response: none
Write the analogue (PWM) value of pinNumber pin (Arduino numbering). Automatically sets required registers to allow output. The dutyCycle argument can be between 0x00 (0% duty cycle) and 0xFF (100% duty cycle). The firmware will not be responsible for making sure the pin isn't already used for motor or cartridge control, or for checking that the pin is PWM capabable.
Other
wait
Command: 'W', milliseconds: uint16Response: none
Pause reading commands for milliseconds number of milliseconds.
gCode
Command: 'G', string: uint8[], 0x00Response: none
Execute a null terminated string of GCODE.
extendedCommand
Command: 0xFF, cmd: uint8[]Response: varies
Execute a command in the secondary command set.