interperting hex commands for a camera on a data sheet

I'm reading this data sheet for a camera.

Camera datasheet

So I have my arduino communicatign with the camera over spi and can send it a command to take a picture.

The last step is to send a command to retrieve the data, which I'm stuck on.

On page 4 the command DATA is

'FF FF FF 0x0A 0X05 Length Byte 0 Length Byte 1 Length Byte 2'

So in code the command would look like this. But how do I figure out what Length Byte 0, Byte 1 Length Byte 2 are??

uint8_t DataCmd[8] = { 0xff, 0xff, 0xff, 0x0a, 0x05, ?, ?, ?};

On page 6 it says

"Image Length = len 0 + Len 1 * 100h + Len 2 * 10000h"

What does this mean? and how to I translate it into the three parameters that I need for my command?

Do you know how big the picture is? If so, then

byte zero = size % 0x100;
byte one = size % 0x10000;
byte two = size / 0x10000;

That is the thing, I don't know how pig the picture is? it depends on the image content I suppose.

What do you do if you don't know the size?

Thanks

Reading the end of the manual you linked to it says...

Here is an example of the commands required to quickly capture and transfer an image form the C329 to an embedded system: • Establish communication as above. • Send command INIT ( FFFFFF0100870107h) • GET ACK (FFFFFF0E01nn0000h) • Send command SELECT IMAGE QUALITY (FFFFFF1000000000h) • GET ACK (FFFFFF0E10nn0000h) • Send command GET PICTURE (FFFFFF0405000000h) • GET ACK (FFFFFF0E04nn0000h) • GET ACK (FFFFFF0AnnL0L1L2h) • GET Image Data

so it looks like the data length is returned as part of the GET PICTURE command.

EDIT: This might also be of help to you.

it depends on the image content I suppose.

Why? The camera takes certain size pictures - so many pixels high and so many pixels wide. There is some information recorded for each pixel, but it is the same amount of information for each pixel. So, every picture should be exactly the same size.

Now, if the camera has taken that raw data, and compressed it as a jpg file, then the size will be different for each picture.

Hi Pauls,

Riva pointed out that I get the from the camera.

So I'm getting the response 'FF FF FF a 5 80 4B 0'

Is the size = 80 + (4B*0x100) + (0*0x1000)?

I'm trying to figure out how big of an array I should allocate to store the data.

Thanks

I'm trying to figure out how big of an array I should allocate to store the data.

How much memory do you have ? What resolution do you have the camera set to ?

Length Image Length = len 0 + Len 1 * 100h + Len 2 * 10000h

So for your picture.

80h+(4Bh*100h)=(8*16)+((4*16)+11)*256=19328 So that is your array size. Remind me again , which arduino you were planning to use?

G Edited for digit trouble.

Is the size = 80 + (4B*0x100) + (0*0x1000)?

I'm trying to figure out how big of an array I should allocate to store the data.

0x80 = 128 0x48 = 72 0x100 = 256

72 * 256 + 128 = 18560.

Does your Arduino have that much SRAM?

So for your picture.

80h+(4Bh*100h)=(8*16)+((4*256)+11)=1163

I think your calculator needs new batteries. Or some of your assumptions need checking.

Fingers corrected.

0x4*8*= 72

Is the size = 80 + (4B*0x100) + (0*0x1000)

I think some of your assumptions need correcting also or perhaps your glasses cleaned.

G

or perhaps your glasses cleaned.

It sucks getting old. ;)

Rock on buddy.

G