Please solve 4 and 5 only if you know the correct answer Eig
Solution
4. Number of pins to port A = 11.
Number of bit to character x = 8.
The most easiest way to reach the objective is to change 8-bit character to 11-bit character by some logical operation.
Program in C language:
#include <GIOP.h>
int main ()
{
unsigned char x; // Given 8 - bit character
unsigned int z = 0; // Take a 16-bit character and initialize at zero
int i =0; // Another 8-bit character with zero initialization
int i = i + (x & 0X01); // mask the lower bit of x and stored it into i
int z = z + (x & 0X10); // mask the upper bit of x and stored it into z
int z = z << 3; // left shift the bits by three times so that upper bit of x starts from bit 7 in z
int z = z + i; // add the lower bits of x to z to get 16 bit format of x in required sequence
PA = z; // send the value of z to port A, upper five bits of z is being ignored
return 0;
}
Ans 5.
Baud divisor = 0x682 = (1666)10
Actual baud rate = clock frequency / baud divisor
Actual baud rate = 16M / 1666 =9603.84 Hz
