Tutorial questions 1
1. How would the denary (base-10) number -25 be expressed in 8-bit 2s complement binary?
2. The population of Selly Oak (during term time) is 34,173. What is the smallest integer data type in the standard C programming language that could represent this number?
3. In the C language, a variable x is declared as follows: uint8_t x=0xB1;
What value does x have after the following line of code runs x |= ( (1<<3) | (1<<2) );
4. In the C language, a variable x is declared as follows: uint8_t x=0xB1;
What value does x have after the following line of code runs x &= (1<<4);
5. In the C language, a variable x is declared as follows: uint8_t x=0xB1;
What value does x have after the following line of code runs x &= ~(1<<4) ;
6. In the C language, a variable x is declared as follows: uint8_t x=0xB1;
What value does x have after the following line of code runs x ^= (1<<4) ;
7. A velocity sensor measures forward velocities in the range 0 to 10 ms-1 and outputs a voltage in
the range 0 to 2V.
a) An 8-bit ADC is used to convert the velocity sensor output voltage, using VREF set to 5V. Calculate the resolution of the measurement (expressed both in V and in ms-1) and also the maximum error.
b) The same 8-bit ADC is used, now with VREF set to 2.5V. Calculate the resolution of the measurement and also the maximum error.