You will be writing software to set up the system in 8bit le

You will be writing software to set up the system in 8-bit left-aligned mode to generate a 250Hz PWM signal on Port T bit 0 (PT0). The frequency of the PCLK is 4 MHz. The output will be low at the beginning of the cycle, and go high when the duty count is reached. The overall period of the waveform will be 4 s.

Write the ritual that initializes the system with a 250 Hz 50% duty cycle waveform on PT0.

Write a function that changes the duty cycle of the waveform on PT0. The format of the input parameter to this function is 8-bit unsigned binary fixed-point. 0 means 0%, 128 means 50%, and 255 means 99.6%.

Solution

void SER_init (int uart) { LPC_UART_TypeDef *pUart; /* UART0 */ LPC_PINCON->PINSEL0 |= (1 << 4); LPC_PINCON->PINSEL0 |= (1 << 6); pUart = (LPC_UART_TypeDef *)LPC_UART0; pUart->LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ pUart->DLL = 0x10; //BR=9600 pUart->FDR = 0x21; /* FR 1,507, DIVADDVAL = 1, MULVAL = 2 */ pUart->DLM = 0; /* High divisor latch = 0 */ pUart->LCR = 0x03; /* DLAB = 0 */ }
You will be writing software to set up the system in 8-bit left-aligned mode to generate a 250Hz PWM signal on Port T bit 0 (PT0). The frequency of the PCLK is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site