bit read_ad_result(U16 *ad_result_ptr)
{
    static data bit flag = FALSE;
    data bit success;

    // If the value is locked we don't need to worry about s_ad_status changing
    // during the course of executions (no need to buffer it).
    if (s_ad_status & VALUE_LOCKED) {
        // Create the 10-bit result from the two 8-bit sfr's.
        *ad_result_ptr  = (U16) s_ad_msb    << 2;
        *ad_result_ptr |= (U16) s_ad_status >> 6;
        s_ad_status    &= ~VALUE_LOCKED;
        success         = TRUE;
    }
    else {
        // Flag the error.
        *ad_result_ptr = 0x0000;
        success        = TRUE;
    }

    return(success);
}