bvPrint the bootloader version.
daPrint aperture information.
deDump EEPROM.
dsPrint distance stops.
dzPrint the zoom range.
ehpos,checksumSet absolute lens focus position (0…0x3FFF).
exExit to the bootloader.
fapositionMove focus to absolute position.
fdPrint focus distance range.
ffpositionFast focus.
fpPrint the raw focus positions.
gsEcho current device and lens statuses.
hvPrint the hardware version.
idPrint basic lens identification (zoom and f-number).
inInitialize the aperture motor. Aperture will fully open.
is{0, 1}Turn image stabilization off/on.
laoptionsLearn the focus range.
lcPrint cached lens status
llLibrary loaded check.
lpLens presence.
lsQuery lens for status immediately and print.
lvPrint the library version string.
mastopMove aperture to absolute position.
mcMove aperture to the fully stopped down limit.
mfMove focus incremental.
miMove focus to the infinity stop.
mnnum_stopsMove aperture incremental.
moMove aperture to completely open.
mzMove focus to the zero stop.
paPrint the aperture position.
pfPrint the focus position.
pl{0, 1}Lens power
rmverbose[,new]Set response modes.
sebyte,valTemporarily set non-volatile (EEPROM) byte.
sfcountSet the focus counter.
sgport,stateSet GPIO.
smmode_flagsSet special modes.
snPrint the device serial number.
Go to Table of Contents
5
sr{0, 1}Set spontaneous responses off/on.
vsPrint the short version string.
weserial_numberWrite non-volatile parameters to EEPROM.
Go to Table of Contents
6
Table 2. Bootloader Command Quick Reference
CommandArgumentsDescription
bePrint the banner string.
blBoot library.
brbaud_rate[,prt]Set baud rate, argument is actual baud rate / 100.
bsObsolete – commit baud rate setting.
hvPrint the hardware version.
lvPrint version of loaded library.
qpQuery current port number.
rmverbose[,new[,prt]]Set response modes.
routeesc,depthEscape from port routing.
rtport,depthRoute through to port with assigned depth.
snPrint the unit serial number.
sp{0, 1}Suppress prompt.
vnPrint the long version string.
vsPrint the short version string.
wcWrite all configurations to EEPROM.
xmunlock_snXModem firmware download.
Go to Table of Contents
7
3 General Notes on Using the Library
This section describes the differences between legacy library commands (libraries
up to version 15) and new library commands (versions 16 and upward), the differences in
command behavior, and the differences between the bootloader and library. It is also the
reference for the basic behaviors of the library.
3.1 Bootloader vs. Library
Prior to version 16 of the library, the bootloader and library code were integrated
together. While the library was still separately upgradeable, the bootloader and library
worked together. All commands were available for access all of the time. All commands
blocked until they were finished.
Version 4 of the hardware shipped with a new bootloader and new command
model. Bootloader commands are only available from within the bootloader, and library
commands are only available from within the library, except where the functionality is
duplicated. If a command with the same name exists in the bootloader and library then it
will perform the same function in both instances.
The bootloader transfers execution to the library for normal operation, and the
library handles normal command processing. Commands can be blocking or nonblocking (they return immediately while lens processing occurs “in the background”).
Firmware upgrading can only be done through the bootloader.
3.2 Aperture Positioning
Aperture positioning is generally measured in ¼ stop increments. However, the
input to the aperture positioning commands is an integer and the reported aperture
positions are f-number times ten or a corresponding integer number of ¼ stops. For
example, if f28 is reported for an aperture position, then it is indicating that the actual fnumber is 2.8. If this is the wide-open position then it is considered the zero position, and
the input to the absolute aperture position commands would be zero. If aperture
measurement is not reported as ¼ stops then the exception will be noted where
applicable.
A value of one would indicate ¼ stop from the full-open position (2.8) towards
the closed position, which would be approximately 3.1. If the aperture position is then
reported in this state, the number one would be reported as the position in number of ¼
stops from the wide-open (zero) position, and the f-number would be reported as f30.
Note that the library uses integer rather than floating point math, so the f-number reported
is close to, but not exactly the mathematical f-number.
3.3 Legacy Focus Positioning
Focus positioning for legacy commands is performed with respect to the encoder
positions directly reported by the connected lens. Each lens will have a different encoder
count for its focusable range, and the encoder count for the zero position will almost
Go to Table of Contents
8
never be zero, in fact it will usually be random, changing with each power cycle of the
lens. However, the focus counter command 'sf' can be used to make any number the
reference for the zero position. The lens can be focused anywhere from zero to infinity by
using commands to learn the full encoder count range and then applying those values to
the positioning commands. For example, a move to zero and then a set focus counter to
zero will establish the value of zero as the position for the minimum focus distance of the
lens. A move to infinity will then report the full number of encoder counts that it took to
get there.
3.4 Mapped Absolute Focus Positioning
Library versions 16 and up introduce the ability to perform absolute positioning
on a fixed scale. This fixed scale is a 14-bit range from 0 to 16383 (hex 3FFF). The range
of the lens from the zero stop to the infinity stop is mapped into this numerical scale. The
14-bit range is generally much larger than the encoder range returned by the lens, and
therefore a small change in the mapped position often will not result in a change to the
focus position.
The mapped focusing feature is highly recommended when using a control
surface to alter focusing. It allows use of a scale that is always fixed between the zero and
infinity positions. However, if the control surface is not capable of sending small enough
changes in the mapped position, then jumpy focusing behavior can occur. Ideally the
control surface should also have a 14-bit range, but a smaller range is okay as long as it is
several times larger than the lens' encoder range. The control surface should have at least
12-bit resolution to meet this requirement for all lenses tested to date. A smaller
resolution will still work, but focusing will not be as smooth or precise.
3.5 Focus Drift
Most lenses will experience drift of the focus mechanism. This results in a change
of the encoder position associated with a particular stop. Generally the lens will lose or
gain a few encoder counts when hitting a stop. The lens may also lose positioning just
during normal focusing, and it can be made worse if the focus move is small. The betterconstructed, more-expensive lenses will drift far less than the cheaper lenses. Drift must
be accounted for by relearning the encoder positions of the zero and infinity stops.
3.6 Legacy vs. New Commands
The library as shipped emulates the legacy command protocol. In this protocol all
commands are case insensitive and are acknowledged with the string 'OK' to indicate that
the command was received. This is followed by any output that the command may have,
after any delay that the command may need to complete its processing. Commands that
are marked as 'new' in this manual will still conform to this behavior.
It is possible to change this behavior so that the 'OK' string is not emitted. In this
case commands will report only their output, or a confirmation if they have no regular
output. These modes can be configured with the response mode command, and are
Go to Table of Contents
9
described further under that command heading. When the new library protocol is active,
commands become case-sensitive. They must be entered as lower-case only.
There are general enhancements that apply regardless of mode or command.
White space is now permitted and commands can have multiple arguments, each
separated by a comma.
3.7 Blocking vs. Non-Blocking Commands
In the legacy libraries (versions 15 and lower), all commands were blocking. In
other words, they needed to finish before any other command could be sent. The new
libraries introduce two new servo routines: an aperture servo and a focus servo. There are
new commands to use these routines. These new commands return immediately and the
library handles the necessary lens processing in the background.
If you intend to have multiple devices talking to the lens controller over several
serial ports, then all lens commands and status queries must use the new commands that
operate in the background. Otherwise, a device on one port will hold off the other devices
from getting their communications through in a timely manner. Also, the library
automatically coordinates the lens processing so no conflicts occur, which would not be
possible if using the legacy commands from multiple serial ports.
3.8 Terse vs. Verbose Reporting Modes
The device can be configured to report in two different modes in addition to
legacy/new protocols using the response modes ('rm') command. In terse mode,
characters are not echoed back from the device, and all commands return a single
number, zero for no error or a non-zero error value. Note that even commands that would
normally return a status string will not do so in terse mode as long as they are marked as
legacy commands. New commands will always echo their output if they have status to
print.
In verbose mode, all characters input to the device are echoed back out, and
commands will print their full status strings as usual. If set to both verbose and new
protocol modes, then a question mark will be emitted by the device for unknown
commands. Verbose mode is most useful when manually controlling the device through a
terminal program.
Go to Table of Contents
10
3.9 Status Strings
Starting with library version 18, there are a standard set of status strings that can
be queried for or spontaneously emitted from the device. The spontaneous emissions are
off by default but can be turned on with the command 'sr'.
3.9.1 Focus Position Status
Format: %:xxxx
Where xxxx is a 4-digit hexadecimal number indicating the current focus position
of the lens in the mapped range (0...3FFF).
3.9.2 Aperture Position Status
Format: &:xx
Where xx is a 2-digit hexadecimal number indicating the current aperture position
in 1/8 stops. Note that if the aperture position is unknown, for example if a lens has been
connected but not initialized, then the status string will be:
Where <focal_length> is a decimal number for the current focal length in
millimeters, <min_f> is a decimal number for the current minimum f-number times ten,
<num_stops> is a decimal number for the number of ¼ stops available, and <max_f> is a
decimal number for the current maximum f-number times ten.
Go to Table of Contents
11
3.9.4 Miscellaneous Status Flags
Format: #:xxxx
Where xxxx is a 4-digit hexadecimal number indicating the current value of the
flags. The flags are given in the following table.
Table 3. Status Flags
Bit(s)Description
0Port RA0 is input; 0 = output, 1 = input.
1Port RA1 is input; 0 = output, 1 = input.
2Port RA0 value; 0 = low, 1 = high.
3Port RA1 value; 0 = low, 1 = high.
4Aperture initialized; 0 = not initialized, 1 = initialized.
5Manual focus; 0 = lens is in autofocus, 1 = lens in in manual focus.
6Focus mode; 0 = normal; 1 = sticky lenses
7-15Reserved.
3.9.5 Lens Connection Messages
When in new-protocol mode, a spontaneous string will be emitted when a lens is
connected or disconnected from the unit. These strings are:
Lens Connected.
and
Lens Disconnected.
3.10 Errors in Command Processing
If a command fails it will report a numerical error code. In terse mode the number
is returned by itself, while in verbose mode and new-protocol mode the return string will
be:
ERRx
Where x is the numerical error code. The possible error codes that can be returned are
given in the following table.
Go to Table of Contents
12
Table 4. Error Codes
Error CodeDescription
0No error.
1Unrecognized command.
2Lens is in manual focus mode.
3No lens connected.
4Lens distance stop error.
5Aperture not initialized.
6Invalid baud rate specified.
7Reserved.
8Reserved.
9A bad parameter was supplied to the command.
10XModem timeout.
11XModem error.
12XModem unlock code incorrect.
13Not used.
14Invalid port.
15License unlock failure.
16Invalid license file.
17Invalid library file.
18Reserved.
19Reserved.
20Not used.
21Library not ready for lens communications.
22Library not ready for commands.
23Command not licensed.
24Invalid focus range in memory. Try relearning the range.
25Distance stops are not supported by the lens.
Go to Table of Contents
13
4 How to Read the Command References
Each command page is organized as follows:
Command Name (command)
Command Type: New/Legacy or both
Syntax: What is entered as the complete command
Returns: The information or exact string returned
Applicable Library
Versions
Description
A description of how the command is used.
Examples:
One or more examples of how the command is used. The command syntax is
shown as normal text, information returned from the device is shown in italic text. The
command confirmation for legacy behavior ('OK') is not shown.
Go to Table of Contents
14
5 Library Command Reference
The following pages contain descriptions of the commands that are available from
within the library. These commands will not be active while in the bootloader, however
the bootloader may have commands with the same name also implemented, in which case
they will perform the same function.
Go to Table of Contents
15
v18+
5.1 Bootloader Version (bv)
Command Type: New
Syntax: bv
Returns: Bootloader version number
Description
This command will print the version of the bootloader code from within the
library. Therefore exiting to the bootloader is not needed to read the revision information.
Example:
bv <CR>
44
Go to Table of Contents
16
v10+
5.2 Define Aperture (da)
Command Type: Legacy
Syntax: da
Returns: f<min>,<num_stops>,f<max>
Description
This command will print the the aperture range of the connected lens. The range
is printed in three parts as follows:
fmin,num_stops,fmax
The item printed is the letter 'f' followed by the current minimum f-number. This is
followed by a comma and the total number of stops in ¼ stops that can be commanded to
the lens. This is then followed by another comma, the letter 'f', and the current maximum
f-number.
Example:
da <CR>
f28,28,f320
Go to Table of Contents
17
v18+
5.3 Dump EEPROM (de)
Command Type: New
Syntax: de
Returns: EEPROM parameters as hexadecimal bytes
Description
This command will dump a hexadecimal stream of bytes that corresponds to the
non-volatile parameters stored in EEPROM. The commonly configured parameters are
almost always available through other commands, so this command is used to gain access
to the remaining parameters. These parameters are often low-level timing configurations.
Contact Birger Engineering if you think your programming needs might require
modification to these parameters.
Go to Table of Contents
18
v18+
5.4 Distance Stops (ds)
Command Type: New
Syntax: ds
Returns: $:<far>:<near>:<encoder>
Description
This command will execute a move to the zero stop of the lens. It will then
advance the lens through its focus range and print the distance stops as reported by the
lens. The distance stops take the form:
$:<far>:<near>:<encoder>
Where <far> is a 4-digit hexadecimal number representing the far distance of the stop in
centimeters, <near> is another 4-digit hexadecimal number representing the near distance
of the stop in centimeters, and <encoder> is a 4-digit hexadecimal number of the raw
encoder count of the lens. The command finishes with a move to the focus motor infinity
stop to read its position followed by a return to the original focus position. Issuing this
command while it is already in progress will cancel further distance reporting. Other lens
control commands will not work or should not be issued while this command is in
progress.
The infinity position is reported as ffff hexadecimal. The infinity position reported
as a distance stop may not actually correspond with the infinity focus position resulting
from the focus motor's infinity stop. These are often two different stops in the lens
construction. Not all lenses are capable of reporting distance stops.
This command will print the zoom range of the lens. The first number printed is
the minimum focal length in millimeters followed by 'mm'. This is followed by a comma,
the maximum focal length of the lens, and the letters 'mm'. Prime lenses will print the
same value for minimum and maximum focal length.
Example:
dz <CR>
18mm,55mm
dz <CR>
50mm,50mm
Go to Table of Contents
20
v16+
5.6 Servo Focus with Checksum (eh)
Command Type: New
Syntax: eh <absolute_position>,<checksum>
Returns: Nothing
Description
This command is used to set the focus position of the lens on an absolute 14-bit
scale from 0 to 3FFF hexadecimal. The command requires a checksum that is the bit-wise
exclusive-OR of the four 4-bit digits of the position. This command executes through the
servo focus routine and returns immediately.
All four digits of the position must be specified, including leading zeros. If the
correct number of digits is not sent or the checksum is incorrect, then the command will
be ignored.
Examples:
eh0000,0 <CR>
eh1000,1 <CR>
eh3fff,c <CR>
Go to Table of Contents
21
v16+
5.7 Exit to Bootloader (ex)
Command Type: New
Syntax: ex
Returns: In bootloader!
Description
This command exits library processing and hands control to the bootloader.
Firmware (library) upgrades must be performed through the bootloader. There are several
other commands that can only be accessed through the bootloader.
The return response from this command depends on which protocol mode is
active, legacy vs. new, and terse vs. verbose, but the string 'In bootloader!' will always be
returned.
Examples:
ex <CR>
r!
In bootloader!
ex <CR>
BEI Boot Executive, v44
(c)2008 Birger Engineering, Inc.
In bootloader!
Go to Table of Contents
22
Loading...
+ 51 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.