Skip to content

Instantly share code, notes, and snippets.

#include <lpc17xx.h>
#include "pwm.h"
#include "delay.h"
#define CYCLE_TIME 255
/* start the main program */
int main()
{
int dutyCycle;
unsigned int getPrescalarForUs(uint8_t timerPclkBit)
{
unsigned int pclk,prescalarForUs;
pclk = (LPC_SC->PCLKSEL0 >> timerPclkBit) & 0x03; /* get the pclk info for required timer */
switch ( pclk ) /* Decode the bits to determine the pclk*/
{
case 0x00:
pclk = SystemCoreClock/4;
break;
#include "LPC17xx.h"
#define SBIT_TIMER0 1
#define SBIT_TIMER1 2
#define SBIT_MR0I 0
#define SBIT_MR0R 1
#define SBIT_CNTEN 0
#include <lpc17xx.h>
#include "stdutils.h"
#include "gpio.h"
#include "timer.h"
#define LED1 P2_0
#define LED2 P2_1
void myTimerIsr_0(void)
#include <lpc17xx.h>
#include "stdutils.h"
#define SBIT_WordLenght 0x00u
#define SBIT_DLAB 0x07u
#define SBIT_FIFO 0x00u
#define SBIT_RxFIFO 0x01u
#define SBIT_TxFIFO 0x02u
#define SBIT_RDR 0x00u
#include "uart.h"
int main()
{
SystemInit();
/* Initialize All the Four UARTs with different Baud rate */
UART0_Init(9600);
UART1_Init(19200);
#include <lpc17xx.h>
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<20000;j++);
}
#include <lpc17xx.h>
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<20000;j++);
}
#include <lpc17xx.h>
#include "delay.h" //User defined library which conatins the delay routines
#include "gpio.h"
#define LED P2_0 // Led is connected to P2.0
/* start the main program */
int main()
{
SystemInit(); //Clock and PLL configuration