Skip to content

Instantly share code, notes, and snippets.

View Embedded-linux's full-sized avatar
πŸ’­
I may be slow to respond.

G Satish Kumar Embedded-linux

πŸ’­
I may be slow to respond.
  • Cavium Networks
  • Bangalore
View GitHub Profile
@Embedded-linux
Embedded-linux / UART0 and UART1
Created September 4, 2013 14:07
Transmit Data From UART0 & UART1
Transmit Data from UART0/UART1 module on LPC 2148
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
// Program : Library for serial communication(UART)
// Description : Library for about serial communication UART0 and UART1 of LPC2148
// Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz
// Filename : uart.h
// C compiler : Keil CARM Compiler
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
#define _PCLK 30000000 // Define PCLK for configuration baudrate
@Embedded-linux
Embedded-linux / UART for LPC2148
Created September 4, 2013 14:04
UART for LPC 2148
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
// Program : UART example
// Description : Example for test UART1 interrupt mode
// Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz
// Filename : uart_int.c
// C compiler : Keil CARM Compiler
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
#include β€œlpc214x.h” // Header file for Phillips LPC2148 controller
#include β€œuart.h” // Library for use module UART0,UART1
#include β€œstdio.h” // Library for use puts function(For UART1)
@Embedded-linux
Embedded-linux / ADC for LPC 2148
Created September 4, 2013 14:02
ADC for LPC 2148
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
// Program : Example Analog to Digital converter
// Description : Display A/D convert value on terminal program(used UART0
// : communication)
// Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz
// Filename : adc.c
// C compiler : Keil CARM Compiler
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
#include β€œlpc214x.h” // Header file for Phillips LPC2148 controller
#include β€œstdio.h” // Library for sprintf function
Note:
the operation of this experiment RTC module cannot operate
continuous without supply voltage. Because the program set to RTC clock use
same souce clock of CPU (CLKSRC bit in CCR register is β€˜0’). RTC module will operate
when apply supply voltage to CPU only
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
// Program : Example for Real time clock
// Description : -
@Embedded-linux
Embedded-linux / RTC for LPC2148
Last active December 22, 2015 07:19
Setting Time To RTC for LPC2148
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
// Program : Example for Real time clock
// Description : Example for display via Terminal program time format hh:mm:ss
// : and user can setup new time by press key β€˜*’ on keyboard
// Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz
// Filename : rtc_setup.c
// C compiler : Keil CARM Compiler
//β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”//
#include β€œlpc214x.h” // Header file for Phillips LPC2148 controller
#include β€œstdio.h” // Library for use puts function(For UART1)
#include ”../FlashOs.H”
// Memory Mapping Control
#define MEMMAP (*((volatile unsigned char *) 0x E01FC040))
// Phase Locked Loop (PLL)
#define PLLCON (*((volatile unsigned char*) 0xE01FC080))