ARM HOW-TO GUIDE Interfacing I2C-7SEG with LPC2148 ARM

Similar documents
ARM HOW-TO GUIDE Interfacing 7SEG with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing GLCD with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Relay with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Keypad with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Switch with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Buzzer with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing Stepper Motor with LPC2148

ARM HOW-TO GUIDE Interfacing GPS with LPC2148 ARM

ARM HOW-TO GUIDE Interfacing GLCD with LPC2148 ARM

I2C on the HMC6352 Compass

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

8085 HOW-TO GUIDE Interfacing 8251 with 8085

17. I 2 C communication channel

Interfacing Z8 Encore! XP MCUs with an I 2 C-Based Character LCD

LPC1768 Industrial Reference Design Platform System Development Kit Version 1.3. May 2009

The I2C BUS Interface

Theory of Operation STOP CONDITION

P89V51RD2 Development Board May 2010

1.3inch OLED User Manual

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

KNJN I2C bus development boards

DEV-1 HamStack Development Board

LPC2468 Industrial Reference Design Platform System Development Kit Version 1.2. August 2008

Write LED display data, in accordance with the address from the display from low to high, from low to high data byte operation.

Future Designs, Inc. Your Development Partner LCD DEMO KITS

LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F4580

Using the I 2 C Interface on the ATmega328P and MC908JL16

VBattery 7 VCC V DD IRLED IS31SE5001 SDA SCL INTB SDB. Figure 1 Typical Application Circuit

I2C interface Tutorial

AN Interfacing Philips Bridge IC with Philips microcontroller. Document information

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

BL24C02/BL24C04/BL24C08/BL24C16

ICN12. I2C to UART Bridge, ADC,DAC and I/O

Lesson I2C. I²C (Inter-Integrated Circuit) Lab Assignment: I2C Slave Driver

Diploma in Embedded Systems

Introduction to I2C & SPI. Chapter 22

Introduction to 8051 microcontrollers

Embedded Workshop 10/28/15 Rusty Cain

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

Evaluation board for NXP LPC2103. User Guide. Preliminary Version updated 27 th Aug TechToys Company All Rights Reserved

How to Implement I 2 C Serial Communication Using Intel MCS-51 Microcontrollers

um-fpu Application Note 8 Developing an I 2 C Interface for um-fpu V2

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

ADC to I 2 C. Data Sheet. 10 Channel Analog to Digital Converter. with output via I 2 C

Basic Input/Output Operations

PCA9665; PCA9665A. 1. General description. 2. Features and benefits. Fm+ parallel bus to I 2 C-bus controller

RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

NIOS CPU Based Embedded Computer System on Programmable Chip

5WG AA_1 TECHNICAL DATA. KNX-Processor 78F0534/2.5, 78F0535/2.5 and 78F0537/2.5. Features. Description. Order Numbers

GIE 8051 Professional Kit. User Manual

E-Module: GLCD+RTC Combo Datasheet

PIC Microcontroller Introduction

NFC NUTSHELL KIT. MCU Modules USER MANUAL REVISION GMMC GmbH Keywords Abstract. Document information

Microcontroller-based Traffic Light Controller. Faculty of Life Sciences & Computing. Communications Technology London Metropolitan University

Microcontrollers and Interfacing

Document status: Preliminary

KNX-Processor 78F0534/2.5, 78F0535/2.5 and 78F0537/2.5

Various power connectors. 3.3V regulator. 64K Flash (Internal) 2K EEPROM (Internal) 4K SRAM (Internal) JA Mem Adr/ Data. Doc: page 1 of 9

SILICON MICROSTRUCTURES

Lecture (03) PIC16F84 (2)

Goal: We want to build an autonomous vehicle (robot)

KNJN I2C bus development boards

The Atmel ATmega328P Microcontroller

Electronics Construction Manual

The IIC interface based on ATmega8 realizes the applications of PS/2 keyboard/mouse in the system

ecee NXP LPC 2138 ARM Development Board

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Getting Started with STK200 Dragon

Pmod modules are powered by the host via the interface s power and ground pins.

Manual iaq-engine Indoor Air Quality sensor

Standard EEPROM ICs. Interfacing SLx 24Cxx I 2 C-Bus Serial EEPROMs to 8051 Controller Family, especially to the Siemens C500 Controller Family

NX-51 V2 plus experiment board Documentation 1. NX-51 V2 plus. P89V51RD2 microcontroller Eexperiment board. Documentation

SPI (Serial & Peripheral Interface)

Bachelor of Engineering in Computer and Electronic Engineering

DIGITAL HUMIDITY SENSOR HYT-131

ECE 4510/5530 Microcontroller Applications Week 10

Shack Clock kit PCB Revision: QCU Rev 1 or QCU Rev 3

8051 Basic Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Microcontroller basics

GRAVITECH GROUP

3.3V regulator. JA H-bridge. Doc: page 1 of 7

LPC1788 Mio Board. The functional details of the board are as follows-

Functional block diagram AD53x1 (Analog Devices)

IMU Axis Gyro Evaluation Board Application Note

μrfid User Manual v1.00

Finite State Machine Lab

GT24C02. 2-Wire. 2Kb Serial EEPROM (Smart Card application)

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Breeze Board. Type A. User Manual.

Preliminary Data MOS IC. Type Ordering Code Package SDA Q67100-H5096 P-DIP-8-1

keyestudio Keyestudio MEGA 2560 R3 Board

MicroBolt. Microcomputer/Controller Featuring the Philips LPC2106 FEATURES

Demo 17 - Receiving data from Host through Serial Port. Introduction:

Chapter 4. Enhancing ARM7 architecture by embedding RTOS

NHD-C0216CiZ-FSW-FBW-3V3

CHAPTER 1 - World of microcontrollers

A PIC-based LCD Display for Stand-Alone Instrumentation

AVR Development Board

AN10210 Using the Philips 87LPC76x microcontroller as a remote control transmitter

IMM64M64D1SOD16AG (Die Revision D) 512MByte (64M x 64 Bit)

Transcription:

ARM HOW-TO GUIDE Interfacing I2C-7SEG with LPC2148 ARM

Contents at a Glance ARM7 LPC2148 Primer Board... 3 I2C (Inter Integrated Circuit)... 3 Seven Segment Display... 4 Interfacing I2C - Seven Segment Display... 4 Interfacing I2C Seven Segment with LPC2148... 6 Pin Assignment with LPC2148... 6 Circuit Diagram to Interface I2C 7 seg with LPC2148... 7 Source Code... 7 C Program to I2C 7 Segment Display using LPC2148... 8 Testing the I2C Seven segment with LPC2148... 13 General Information... 14

ARM7 LPC2148 Primer Board The ARM7 LPC2148 Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port. NXP s ARM7 (LPC2148), ARM Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 32-bit Microcontrollers. I2C (Inter Integrated Circuit) The I2C (Inter-IC) bus is a bi-directional two-wire serial bus that provides a communication link between integrated circuits (ICs).I2C is a synchronous protocol that allows a master device to initiate communication with a slave device. Data is exchanged between these devices.

Seven Segment Display A seven segment display is the most basic electronic display device that can display digits from 0-9. The most common configuration has an array of eight LEDs arranged in a special pattern to display these digits. They are laid out as a squared-off figure 8. 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. Interfacing I2C - Seven Segment Display Fig. 1 shows how to interface the seven segments with microcontroller through I2C. I2C is a Master-Slave protocol. I2C has a clock pulse along with the data. Normally, the master device controls the clock line, SCL. This line dictates the timing of all transfers on the I2C bus. No data will be transferred unless the clock is manipulated. All slaves are controlled by the same clock, SCL.

A seven 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 come in two configurations, namely, Common cathode (CC) and Common anode (CA). In CC configuration, the negative terminals of all LEDs are connected to the common pins. The common is connected to ground and a particular LED glows when its corresponding pin is given high. In CA arrangement, the common pin is given a high logic and the LED pins are given low to display a number. Fig. 1 Interfacing I2C - 7segment to Microcontroller

7-SEG Display Interfacing I2C Seven Segment with LPC2148 We now want to display a four digit number in LPC2148 Primer Board by using seven segment displays. The seven segment display is connected with LPC2148 controller through I2C. In LPC2148 Primer Kit, 4 nos. of common anode seven segment displays are controlled by I2C Enabled drivers. I2C Lines serial clock SCL (P0.2), serial data SDA (P0.3) connected to the I2C based 7-segment display driver. The digit select lines are (MX1, MX2) controlled by the driver chip. The 7-segmend display is powered from the 5V power supply enabled by switch SW28. Pin Assignment with LPC2148 7-SEG Driver LPC2148 LINES 7-SEG PWR Selection SCL P0.2 SDA P0.3 Make switch SW28 to 7SEG label marking position +5V OFF 1 2 3 4 SW28 8 7 6 5 PWR ON/OFF ON 7SEG LCD SM/RL GLCD

CA1 CA2 CA1 CA2 CA1 CA2 CA1 CA2 3 8 3 8 3 8 3 8 2 3 2 3 61 62 XTAL2 XTAL1 VREF VDD1 VDD2 VDD3 VDDA 63 51 43 23 7 Circuit Diagram to Interface I2C 7 seg with LPC2148 3.3V 3V3 6 18 25 42 50 59 U16 VSS1 VSS2 VSS3 VSS4 VSS5 VSSA LPC2148 P0.3 P0.2 26 22 C11 2.7nF I2C 7-SEGMENT DISPLAY U7 1 24 2 ADR SCL 23 3 CEXT SDA 22 4 P8 P16 21 5 P7 P15 20 6 P6 P14 19 7 P5 P13 18 8 P4 P12 17 9 P3 P11 16 10 P2 P10 15 11 P1 P9 14 12 MX1 MX2 13 VEE VCC R40 10k 2_SEG7 2_SEG6 2_SEG5 2_SEG4 2_SEG3 2_SEG2 2_SEG1 2_SEG0 R41 10k C12 100n 12MHz SAA1064 C36 X13 C37 22pf 22pf 1 Q3 BC847AL BC847AL Q4 1 U9 1_SEG0 7 1_SEG1 6 A 1_SEG2 4 B 1_SEG3 2 C 1_SEG4 1 D 1_SEG5 9 E 1_SEG610 F 1_SEG7 5 G DP 7 SEG DISP U8 1_SEG0 7 1_SEG1 6 A 1_SEG2 4 B 1_SEG3 2 C 1_SEG4 1 D 1_SEG5 9 E 1_SEG610 F 1_SEG7 5 G DP U10 2_SEG0 7 2_SEG1 6 A 2_SEG2 4 B 2_SEG3 2 C 2_SEG4 1 D 2_SEG5 9 E 2_SEG6 10 F 2_SEG7 5 G DP U11 2_SEG0 2_SEG1 7 6 A 2_SEG2 2_SEG3 4 2 B C 2_SEG4 2_SEG5 1 9 D E 2_SEG6 2_SEG7 10 5 F G DP 7 SEG DISP 7 SEG DISP 7 SEG DISP Source Code The Interfacing I2C seven segment displays with LPC2148 program is very simple and straight forward, that display a four digit number in seven segment display by using I2C.The C programs are developed in Keil software.

C Program to I2C 7 Segment Display using LPC2148 *************************************************************************************** Title : Program to I2C - Seven Segment display *************************************************************************************** #include <LPC214x.h> #include <stdio.h> #define MAX 6 #define AA 2 #define SI 3 #define STO 4 #define STA 5 #define I2EN 6 void I2C_ISR(void) irq; void Wait (unsigned int); void I2C_Init (void); int I2C_Start (void); int I2C_Write (unsigned char *Buff, unsigned int Count); unsigned char Buff[] = 0x00,0x27,0x3F,0x06,0x5B,0x4F; unsigned char index = 0; void I2C_ISR(void) irq if (I2C0CONSET & 0x08) switch (I2C0STAT) case (0x08): I2C0CONCLR = 1 << STA; I2C0DAT = 0x70; //Slave Addr + W break;

case (0x10): break; I2C0CONCLR = 1 << STA; //Clear START Bit I2C0DAT = 0x70; case (0x18): break; I2C0CONCLR = 0x20; //Clear START Bit I2C0DAT = Buff[index]; index++; case (0x20): break; I2C0CONCLR = 0x20; //Clear START Bit I2C0DAT = Buff[index]; index++; case (0x28): break; I2C0CONCLR = 0x20; //Clear START Bit if (index < MAX) I2C0DAT = Buff[index]; index++; else index = 0; I2C0CONSET = 0x10; //Send STOP Bit

case (0x30): I2C0CONCLR = 0x20; //Clear START Bit if (index < MAX) I2C0DAT = Buff[index]; index++; else index = 0; I2C0CONSET = 0x10; //Send STOP Bit I2C_Start(); break; case (0x38): I2C0CONSET = 0x20; break; I2C0CONCLR = 1 << SI; VICVectAddr = 0x00; void main() unsigned int i; VPBDIV = 0x02; PINSEL0 = 0x00000055; // P0.3 - SDA0 & P0.2 - SCL0 U0LCR = 0x83; U0DLL = 97; U0DLM = 0x00; U0LCR = 0x03;

VICIntSelect = 0<<9; VICVectCntl0 = 0x020 9 ; VICVectAddr0 = (unsigned long)i2c_isr; VICIntEnable = 1<<9; I2C_Init(); I2C_Start (); for (i=0;i<30;i++) Wait(10000); I2C0CONCLR = 1 << SI; while(1) for (i=0;i<20;i++) Wait(10000); void Delay(void) unsigned int i,j; for(i=0;i<20;i++) for(j=0;j<200;j++); void Wait (unsigned int Delay) while(delay--); void I2C_Init (void) I2C0SCLH = 150; //50%duty,I2C Freq ->100KHz, PCLK = 30MHz I2C0SCLL = 150; I2C0CONSET = 1 << I2EN; //Enable I2C 0

int I2C_Start (void) I2C0CONCLR = 1 << STO; I2C0CONCLR = 1 << AA; I2C0CONSET = 1 << STA; return 0; int I2C_Write (unsigned char *Buff, unsigned int Count) while(count--) I2C0DAT = *Buff++; return 0; To compile the above C code you need the KEIL software. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project. In Keil, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without LPC2148 Primer Board. The Flash Magic software is used to download the hex file into your microcontroller IC LPC2148 through UART0.

Testing the I2C Seven segment with LPC2148 Give +3.3V power supply to LPC2148 Primer Board; the four seven segment display is connected with the LPC2148 Primer Board. First check the entire seven segments LED s are properly working or not. Here we are display just 1234 in four seven segment. The entire seven segments receive it through I2C & display it in order. If any data is not coming in seven segments, then you just check the entire seven segments LED s are working or not. Change the seven segment driver IC & Check the I2C connections. Check the four seven segments connections. Otherwise you just check the code with debugging mode in Keil. If you want to see more details about debugging just see the videos in below link. How to Create & Debug a Project in Keil.

General Information For proper working use the components of exact values as shown in Circuit file. Wherever possible use new components. Solder everything in a clean way. A major problem arises due to improper soldering, solder jumps and loose joints. Use the exact value crystal shown in schematic. More instructions are available in following articles, Interfacing UART with LPC2148 Microcontroller. Interfacing Keys with LPC2148 Microcontroller. User Manual of LPC2148 Primer Board. Tutorial of how to create & Debug a project in Keil.

Did you enjoy the read? Pantech solutions creates information packed technical documents like this one every month. And our website is a rich and trusted resource used by a vibrant online community of more than 1,00,000 members from organization of all shapes and sizes.

What do we sell? Our products range from Various Microcontroller development boards, DSP Boards, FPGA/CPLD boards, Communication Kits, Power electronics, Basic electronics, Robotics, Sensors, Electronic components and much more. Our goal is to make finding the parts and information you need easier and affordable so you can create awesome projects and training from Basic to Cutting edge technology.