This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #incluyde <ctype.h> | |
| #define SIZE 50 | |
| char s[SIZE]; | |
| int top =-1; | |
| push(char elem) | |
| { | |
| s[++top] = elem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /***Main Program **********/ | |
| #include <stdio.h> | |
| #define MAX 5 | |
| int status,top; | |
| int push(int stack[],int item) | |
| { | |
| if (top == MAX-1) | |
| { | |
| printf("Stack overflow \n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /************Main Function*****************/ | |
| #include <lpc214x.h> | |
| #include "ext_int.h" | |
| int main(void) { | |
| keypad_init(); //// initialize the keypad in interrup mode | |
| while(1) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <LPC214x.H> /* LPC21xx definitions */ | |
| #define IOPIN1 (*((volatile unsigned long *) 0xE0028010)) | |
| #define IOSET0 (*((volatile unsigned long *) 0xE0028004)) | |
| #define IOCLR0 (*((volatile unsigned long *) 0xE002800C)) | |
| #define IODIR0 (*((volatile unsigned long *) 0xE0028008)) | |
| #define IODIR1 (*((volatile unsigned long *) 0xE0028018)) | |
| #define LED_IO_DIR IODIR0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This experiment is testing output port function ofΒ LPC2148 to drive 2 LED at P0.21 and P0.22 | |
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// | |
| // Program : Example for display LED | |
| // Description : LED Blink toggle at P0.21 and P0.22 | |
| // Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz | |
| // Filename : led.c | |
| // C compiler : Keil CARM Compiler | |
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Programming on chip flash driver -- copy data from RAM to Flash/Erasing Sector address, Erasing complete chip and programming the chip with IAP [In Application Program] commands*/ | |
| /* Reference Manual for Flash memory and IAP commands :http://www.nxp.com/documents/user_manual/UM10139.pdf */ | |
| #include ''../FlashOs.H" | |
| // Memory Mapping Control | |
| #define MEMMAP (*((volatile unsigned char *) 0x E01FC040)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Reference user manual : | |
| http://www.keil.com/dd/docs/datashts/philips/user_manual_lpc2119_2129_2194_2292_2294.pdf | |
| /*Serial interfacing for LPC2129 [NXP] UART1*/ | |
| #include <LPC210x.H> /* LPC21xx definitions */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Reference user manual : | |
| http://www.keil.com/dd/docs/datashts/philips/user_manual_lpc2119_2129_2194_2292_2294.pdf | |
| /* WDT [Watch Dog Timer] driver for LPC2129 */ | |
| #include <LPC210x.H> /* LPC210x definitions */ | |
| extern void init_serial (void); /* Initialize Serial Interface */ | |
| extern int sendchar (int ch); /* Write character to Serial Port */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LPC2148 port acts input for reading data | |
| from P0.28 and P0.29 that connected with push-button switches and resistor pull-up | |
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// | |
| // Program : Example for test switch | |
| // Description : Test switch at P0.28 and P0.29 for toggle LED at P0.21 and P0.22 | |
| // Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz | |
| // Filename : switch.c | |
| // C compiler : Keil CARM Compiler | |
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// | |
| // Program : Example for EINT2(External interrupt2) | |
| // Description : Test interrupt from switch press display by LED at P0.21 | |
| // : toggle and sound beep | |
| // Frequency : Crystal 12 MHz at PLL 5x(CCLK = 60 MHz),PCLK = 30 MHz | |
| // Filename : ext_int2.c | |
| // C compiler : Keil CARM Compiler | |
| //ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// | |
| #include βlpc214x.hβ // Header file for Phillips LPC2148 controller | |
| #include βsound.hβ // Header file for Phillips LPC2148 controller |