Ejemplo n.º 1
0
/*Read one BYTE from 1-wire data line*/
void ds1820_read_byte(uint8_t *byte, int sensor){
	
	*byte = 0; //format byte
	
	for(int i = 0; i < 8; i++){
		*byte |= (ds1820_read_bit(sensor) << i);
	}
}
Ejemplo n.º 2
0
static uint8_t ds1820_read_byte(void){
    int ii;
    uint8_t bit, byte = 0;
    portENTER_CRITICAL();
    delay_us(1);
    for (ii = 0; ii < 8; ii++) {
        byte = byte >> 1;
        bit = ds1820_read_bit();
        if (bit==0) {
            byte = byte & 0x7F;
        }
        else byte = byte | 0x80;
        
        
    }
     portEXIT_CRITICAL();
    return byte;
}
Ejemplo n.º 3
0
/*0 = not ready, 1 = ready*/
int ds1820_convert_ready(int sensor){
	return ds1820_read_bit(sensor);
}