Consider the following microcontroller 8-bit peripheral register. Bit 7 6 5 4 3 2 1 Purpose start ready channel gain (a)
Posted: Thu May 05, 2022 1:17 pm
Consider the following microcontroller 8-bit peripheral register. Bit 7 6 5 4 3 2 1 Purpose start ready channel gain (a) Create a single data structure in C that allows this register to be viewed as both: (i) An unsigned char. (3 marks) (ii) A set of bit fields. (4 marks) (b) Show the code to implement the following sequence as C language code: (i) Set register to zero. (1 mark) (ii) Set channel to 4 and gain to 1. (1 mark) (iii) Set start bit to 1. (1 mark) (iv) Wait until ready bit is a 1. (1 mark) (v) Set start bit to 0 (1 mark)