Skip to main content

Posts

Showing posts from January, 2015

Program to Blink LED interfaced with LPC2148 microcontroller

LPC2148 is a 32-bit microcontroller by NXP. I discuss a simple LED interface program interfaced with LPC2148 microcontroller to make you understand its register and PINSEL functions. Program: Theory: In the above code, there are 3 main instructions are used- ISOET0/1, IODIR0/1 and IOCLR0/1 . Every instruction has its own meaning as explained in Table 4. The above is taken on Fast GPIO port P1 on pins 16-23. Each decimal number in 0x00000000 defines the 4-bit, so the total comes out to be 32-bit. In GPIO port P1, 0-15 pins are reserved so you cannot direct output on these pins. Whereas 24, 26, and 27 pins of GPIO port P0 are reserved.

Pin connect Block and Register Description of LPC214X microcontroller

Pin Connect Block: The purpose of the Pin connect block is to configure the microcontroller pins to the desired functions. The pin connect block allows selected pins of the microcontroller to have more than one function. Configuration registers control the multiplexers to allow connection between the pin and the on chip peripherals. Peripherals should be connected to the appropriate pins prior to being activated, and prior to any related interrupt(s) being enabled. Activity of any enabled peripheral function that is not mapped to a related pin should be considered undefined.   (image from: ustudy.in) Register Description: The Pin Control Module contains 3 registers- PINSEL0 :- It selects Pin function register 0 and can read/write operations. PINSEL1 :- It selects Pin function register 1 and can read/write operations. PINSEL2 :- It selects Pin function register 2 and can read/write operations.

Interfacing Analog-to-Digital Converter with 8051 microcontroller

Introduction: ADC0804 is one of the most commonly used analog to digital converter IC. In many applications it is required to convert the output of the sensor, which is analogue in nature to a digital form. The data in digital format can then be utilized for further processing by the digital processors. Typical applications include sound processing, temperature processing etc. The below figure demonstrates the principle and operation of interfacing a simple ADC 0804 using 8051 microcontroller. (courtesy: Engineergargae.com) Program:   #include "REGX52.H"  #define Mydata P2  #define LED P0  #define INTR P1_3  #define WR P1_1  #define RD P1_0  void main()   {    unsigned char value;    Mydata=0xFF; //make P1 as input    INTR=1; RD=1; WR=1;     while(1)      {       WR=0; //send WR pulse  ...