WEEK - 3 Sudhanshu
WEEK - 3 Sudhanshu
SUBMITTED BY
Sudhanshu Kumar
CL202408310180209
…………………………………………………………………………………………………………………………………………………………………………………..
#include <LPC17xx.h>
#include <stdint.h>
void delay_ms(uint32_t);
int main()
LPC_WDT->WDFEED = 0x55;
LPC_GPIO1->FIODIR |= All_LED;
LPC_GPIO1->FIODIR |= BUZZER;
LPC_GPIO1->FIOCLR |= All_LED;
LPC_GPIO1->FIOCLR |= BUZZER;
LPC_GPIO1->FIOSET |= BUZZER;
delay_ms(100);
LPC_GPIO1->FIOCLR |= BUZZER;
while(1)
LPC_GPIO1->FIOSET |= All_LED;
delay_ms(100);
//while(1);
LPC_GPIO1->FIOCLR |= All_LED;
delay_ms(100);
LPC_WDT->WDFEED = 0x55;
uint32_t i , j ;
// De_Signal
#include <LPC17xx.h>
#include <stdint.h>
void delay_ms(uint32_t);
int main()
LPC_PWM1->PR = 0;
LPC_PWM1->MR0 = 10000;
LPC_PWM1->MR1 = 2000;
LPC_PWM1->MR2 = 4000;
LPC_PWM1->MR1 = 2000;
LPC_PWM1->MR2 = 4000;
delay_ms(200);
LPC_PWM1->MR1 = 2000;
LPC_PWM1->MR2 = 6000;
delay_ms(200);
LPC_PWM1->MR1 = 2000;
LPC_PWM1->MR2 = 8000;
delay_ms(1000);
LPC_PWM1->MR1 = 2000;
LPC_PWM1->MR2 = 9000;
delay_ms(200);
uint32_t i , j ;
}
//Se_Signal
#include <LPC17xx.h>
#include <stdint.h>
void delay_ms(uint32_t);
int main()
LPC_PWM1->PCR &= ~(1 << 2); // select single ege mode output
LPC_PWM1->PR = 0;
LPC_PWM1->LER |= (1 << 2)|(1 << 0); // load enable for MRR0 and MR2
LPC_PWM1->TCR |= (1 << 3)|(1 << 0); // Enable the timer counters in PWm mode
while(1)
delay_ms(500);
delay_ms(500); }}
uint32_t i , j ;
}}
}
DT – 18th Dec. 2024
//uart_keypress
#include <LPC17xx.h>
#include "lcd.h"
int main()
char ch ;
lcd_init();
LPC_PINCON->PINSEL0 |= (1<<4); // select P0.2 pin alteranet function as Uart0 TXD0 pin
LPC_PINCON->PINSEL0 |= (1<<6); // select P0.3 pin alteranet function as Uart0 RXD0 pin
LPC_UART0->DLM = 0;
LPC_UART0->DLL = 6; // baut rate = pclk/16*DL = 1000000/16* (256 *DLM + DLL) = 1000000/(16 *6) = 10400
while(1)
ch = LPC_UART0->RBR;
lcd_dat_write(ch);
}
//uart_rs
#include <LPC17xx.h>
#include "lcd.h"
int main() {
char ch = 'A';
LPC_UART0->DLM = 0;
LPC_UART0->DLL = 6;
ch = LPC_UART0->RBR;
lcd_dat_write(ch);
while (1);
}
DT – 19th Dec. 2024
#include<stdint.h>
#include<LPC17xx.h>
#include<stdio.h>
#include"uart0.h"
#define tc 100.0f
int main(){
uint32_t Su_val;
char Sval[16];
uart0_init();
while(1){
LPC_ADC->ADCR|=SC;//start conversion
uart0_str_transmit(Sval);
delay_ms(2000);
new_line(); } }