Render the depth map in grayscale
The far and close ranges for the scene can be controlled with the camera far and near clip distances.

The best format for you to export depth information would be on an OpenEXR file. Z infomation would be stored as 32bit linear data, not restricted to the grayscale values form 0 to 1 and not mapped to the 256 values of 8 bit images.