16 bit runtime texture issues using UpdateTextureRegions()

I am using the code bellow to write a 16bit value to a texture.

However, when my value goes over 255, the pixel value loops back to 0. I cant get a value any higher than 1.

I have tried a few pixel formats, but to no avail :(.

I need to make texture pixels with 16 bit precision, can anyone help with this?

Update: I fixed my issue by making the pixel data a uint16 array, and casting it to a byte array. like this:

tex->UpdateTextureRegions(0, 1, region, 32 * 2, 2, (uint8*)data);