Skip to main content

Posts

Showing posts with the label microcontroller

Program to interface Relay with LPC2148 microcontroller

A relay is an electrically operated switch or an electro-mechanical switch. Relays are used where it is necessary to control an electronic circuit by a low-power signal or where several circuits must be controlled by one signal. Principle:   Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts. Program: Theory: A relay is used for electronic to electrical interfacing i.e. it is used to switch on or off electrical circuits operating at high AC voltage using a low DC control voltage. A relay generally has two parts, a coil which operates at the rated DC voltage and a mechanically movable switch. The electronic and electrical circuits are electrically isolated but magnetically connected to each other. In this R1 and R2 are the connection of relay made with LPC2148 and signal a...

Interfacing of Switch with LPC2148 microcontroller

Now, i discuss a program of LPC2148 microcontroller interfaced with a Switch and a LED. Earlier, i have discussed about the functions of LPC2148 microcontroller and its registers, which can help you understand the program described below. And, you also can understand the debouncing concept of switch when interfaced with microcontroller ( click here ) Program: Theory: IOPIN is the Input/Output Pin configuration which defines the current state of the GPIO configured port pins that can always be read from this register, regardless of pin direction. The denouncing switch concept has been implemented in this example code in which LED is switched on whenever a switch connected on port P0 is pressed.

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  ...

Download and install Hex file burner for 32-bit microcontroller

Flash Magic is a PC burner tool for programming flash memory based microcontroller using serial or Ethernet protocol built by NXP. This tool helps the developer to easily burn the hex file generated by the embedded software like Keil µvision for 8051 and ARM microcontrollers or MPLAB for PIC microcontrollers. It is available free and easy to install in Windows or Mac OS based PC. Installing Flash Magic and its USB-to-Serial driver: - Install Flash Magic for Windows XP/vista/7/8 or Mac OS X (available for Cortex device only) and also install USB-to-Serial driver so that flash magic can find the signature of LPC2148 microcontroller programmer board. Download Flash Magic - http://www.flashmagictool.com/ Download USB-to-Serial Driver - http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=225&pcid=41 Note: You must install the USB-to-Serial Driver for proper functioning of flash magic. Important Link: 1. How to use the Flash Magic Burner.        ...

Identify the COM port for Flash Magic burner

You have seen the COM port option while running the Flash Magic Burner for hex file. Every computer exists the different COM port so one has to select the COM port accordingly from the given drop-down option. To find COM port- Right click on ‘ My Computer ’ icon and select ‘ Properties ’ and go to ‘ Hardware ’ option and Click on ‘ Device Manager ’ and See the ‘ COM port ’ to know which COM port is compatible between your PC and ARM programmer board.

Overview of the PIC18 Family Microcontroller

Microchip has introduced six different lines of 8-bit MCUs over the years: 1. PIC12XXX: 8-pin, 12- or 14-bit instruction format 2. PIC14000: 28-pin, 14-bit instruction format (same as PIC16XX) 3. PIC16C5X: 12-bit instruction format 4. PIC16CXX: 14-bit instruction format 5. PIC17: 16-bit instruction format 6. PIC18: 16-bit instruction format Each line of the PIC MCUs support different number of instructions with slightly different instruction formats and different design in their peripheral functions. This makes products designed with a different family of PIC MCUs incompatible. The members of the PIC18 family share the same instruction set and the same peripheral function design and provide from eight to more than 80 signal pins. This makes it possible to upgrade the PIC18-based product without changing the MCU family. One of the design goals of the PIC18 MCU is to eliminate the design flaws of other earlier MCU families and provide a better upgrade path to ot...

Program to implement 7-Segment Display with 8051 microcontroller

What is 7 Segment Display? 7 Segment Display is an array of 8 LEDs connected or arranged in a special pattern together to form or display the digits from 0-9 and Dot functions also. The 7-segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment displays. It is composed of 7 LEDs assigning specific alphabet to each and 1 LED acts as a dot in the display. Every LED is assigned a name from 'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are used to display the numerals while eighth LED 'h' is used to display the dot/decimal. Concept: A 7-segment is generally available in ten pin package. While eight pins correspond to the eight LEDs, the remaining two pins (at middle) are common and internally shorted. These segments co...