Download Print this page

Capture A Jpeg From The Instrument - Land Instruments International SPOT User Manual

Modbus controls

Advertisement

Spot Modbus Controls

2.4 Capture a JPEG from the Instrument

JPEGs are transmitted by the instrument copying data to a buffer within the
Modbus registers, then the PC software reading it.
If bit 1 of the requests byte is set, the instrument will set bit 0 of the jpeg
control byte to indicate that jpeg capture is active then capture an image. It
will then repeatedly:
Wait till bit 1 of the jpeg control byte is clear
Copy next 48 bytes of image into buffer
Set bit 1 of the jpeg control byte
Meanwhile the pc software must read the data, so the buffer can be used
again.
The instrument watches for a read of the jpeg buffer and clears bit 1 of the
jpeg control byte automatically, so that the process above can be repeated.
When all data has been transmitted, the instrument will clear both bits of the
jpeg control flag.
The jpeg file starts with FF D8, includes a config frame, the length of the
main frame and 11 unnecessary bytes, then the main frame ending FF D9.
To compile a jpeg from the Modbus words transmitted, save words 4 – 346
then 361 onwards (counter starts at 0); high byte first.
ModbusWrite
WordCounter = 0
acquisition
Array =
ModbusRead
StatusValue = Array [0]
while
(StatusValue > 0xFF) {
Array =
ModbusRead
status byte
StatusValue = Array [25]
if
(statusval > 0x1f) {
for
i = 0 to 24 {
if
((wordcounter >= 4) && ((wordcounter < 347) ||
jpeg
AddToJPEG ((Array[i] & 0xFF00) >> 8)
AddToJPEG (Array[i] & 0x00FF)
}
WordCounter ++
of the transmission of the first buffer
}
}
}
Page 10
(5, 1)
// Request a JPEG
// Initialise a counter for the JPEG
(246, 1)
(221, 26)
(wordcounter > 360)))
//wordcounter starts at 0 at the beginning
// Read the JPEG status bit
// and monitor it
// While jpeg transmission active, loop
// Read the whole jpeg buffer and
// If there is new data
// for each word in the latest buffer
{
// The words required for a
// lower byte
User Guide
// upper byte

Advertisement

loading