Eejit’s guide to using a LCD alphanumeric display with the CCS C compiler 1.Hardware connection 2.The LCD.C include file 3.An example.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Simple Microcontroller Programming with PIC16F88.
The 8051 Microcontroller and Embedded Systems
Lab7: Introduction to Arduino
Embedded Sumo 1T4 – 1T5 UTRA.
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
 | bit OR & bit AND ~ bit NOT ^ bit EXLUSIVE OR (XOR) > bit RIGHT SHIFT.
EE 316 Computer Engineering Junior Lab Word Mastermind.
Spring EE 316 Computer Engineering Junior Lab LCD modules, PROMs, Serial Ports.
Using PDG with e2studio: Example
EE 316 Computer Engineering Junior Lab Digital Hangman.
EEE305 Microcontroller Systems Lecture 5B: Simple I/O Embedded C using PIC microcontrollers Teaching resources on on
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
How to use the CCS compiler with the serial port.
Dr. Hoganson CSIS Segment Display and Count by 16 This is our third lab using the 68HC11 microcontroller. We will write a program that counts by.
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Serial Communication Lab 12 Module M21.1. Asynchronous Serial I/O ASCII code 54H = (“T”) sent with odd parity.
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
September, 2007ENGR Low-Level Robot Control Mechatronics: Motors, sensors & embedded controls.
© AJH 2013, V2.0 Computer Programming Embedded Systems Programming Stand-alone code, system initialisation, operating systems. Low-level operations; port.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
Practical Electronics & Programming
Embedded Stroke Evaluation System Amanda Sweeney, 4ECE Supervisor: Dr. Martin Glavin.
RS232 #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
LCD Interfacing.
CS-280 Dr. Mark L. Hornick 1 Programming for the LCD Display.
OOPic (Object Oriented Pic) Dominick D’Aniello Jacques Bosman.
EE 316 Computer Engineering Junior Lab Serial Ports, LCD Displays & PROMs.
Slide 1 Project 1 Task 2 T&N3311 PJ1 Information & Communications Technology HD in Telecommunications and Networking Task 2 Briefing The Design of a Computer.
This material exempt per Department of Commerce license exception TSU Architecture Wizard and PACE Lab 2 Introduction.
Reading and Writing Text over USB A Colony Project Tutorial.
What is Binary Code? Computers use a special code of their own to express the digital information they process. It's called the binary code because it.
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER.
Team 6. Guitar Audio Amplifier Audio Codec DSP Wireless Adapter Motor Array PC LCD Display LED Arrays Pushbutton or RPG Input Device
AAPT workshop W03 July 26, 2014 Saint Cloud State University, MN, USA
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
Arduino Programming Part 6: LCD Panel Output ME 121 Portland State University.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Introduction to Projects using Microcontroller Md. Khalilur Rhaman Credit: Interface Lab.
Infrared Proximity Sensors & Liquid Crystal Display Instructor Dr Matthew Khin Yi Kyaw.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
Sitarambhai Naranjibhai Patel Institute of Technology and Research Centre, Umrakh, Bardoli. A Presentation On “ 16x2 LCD Interfacing with AVR atmega32.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
Jeremy Sandoval University of Washington May 14, 2013
Using a SparkFun™ serial LCD with an Arduino
Scrolling LCD using Arduino.
Assist. Prof. Rassim Suliyev - SDU 2017
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
LCD Interfacing using Atmega 32
Fundamentals of Computer Engineering
Display Devices 16 x 2 lcd display.
Arduino Programming Part II
Microcontroller basics
Arduino Part 1 Topics: Microcontrollers Programming Basics
Administrative things
Robotics System Lecture 11_12: DC Motor
Lab #1: Getting Started.
Introduction to Arduino IDE and Software
Presentation transcript:

Eejit’s guide to using a LCD alphanumeric display with the CCS C compiler 1.Hardware connection 2.The LCD.C include file 3.An example

1 1: Hardware connection 1.The CCS LCD.C file is based on the LCD 4-bit mode, which only uses the top four Data pins of the LCD module. 2.The CCS LCD.C file defaults to all connections to Port D. If you wish to use Port B, then the line #define use_portb_lcd TRUE must be in your program before the LCD.C file is included. 3.The wiring diagram of the next slide shows the connections that have to be made.

2: The LCD.C file The standard CCS distribution comes with the file LCD.C, which in Version 4 is to be found in folder Program Files/PICC/Drivers by default. You should print this out. By including this file in the preamble of your program you can access the following functions: 1.Function lcd_init(). Normally this should be in your main() function following any variable definitions. This initializes the LCD module and thus should be run BEFORE any other LCD-related operation. 2.Function lcd_putc(c). Will display the character c in the next position of the LCD; e.g. lcd_putc(‘H’);. If the character is \f then the display is cleared, if \n then go to start of line 2 and if \b move back one position. This function also seems to work (at least in Version 4) with strings; e.g. lcd_putc(“Hello world”);. 3.Function lcd_gotoxy(x,y) is used to move the virtual cursor to any position in line 1 ( y is 1) or line 2 ( y = 2). E.g. lcd_gotoxy(8,2); moves the cursor to character position 8 in line 2. 4.Function lcd_getc(x,y) returns the character displayed on line y position x ; e.g. digit = lcd_getc(8,2); assigns the variable digit to the value displayed in line 2 position 8 5.If your application is using a different LCD; e.g. a 4-line display, then you need to copy and rename the lcd.c file and edit your renamed file.

3: An example To display the message on the LCD (2-line, 16 characters): PIC says hello xxth time *** where xx is incremented every second. Send a message “For the xxth time: Hello world from the PIC” via the serial port at 4,800 baud. Flash an LED connected to pin RB5 each time a message is sent/displayed. 1.Header: #define #use delay(clock = ) #fuses HS,NOWDT,NOPROTECT,PUT,NOLVP #use rs232(baud=4800,xmit=PIN_C6) #bit LED = 5.5 #include I am using a PIC16F877A as the target With a 8MHz crystal, which is why the High Speed fuse is specified Give pin RA5 the name LED The all important LCD file included 4800 baud out of pin RC6 (UART)

2.Main function: main() { unsigned long int i = 0; lcd_init(); set_tris_a(0x1F); setup_adc_ports(NO_ANALOGS); while(TRUE) { LED = 1; printf(“For the %luth time; Hello world from the PIC\n\r”,i); printf(lcd_putc,”\fPIC says hello\n%luth time ***”,i++); delay(500ms); LED = 0; delay(500ms); } } 16-bit variable i records the message count Now initialise the LCD device Set Pin RA5 as Output (b’01111’) Ensure that Port A is all digital (not analog) DO forever Turn on LED Message through the serial port Long Decimal placeholder for i Message through the lcd_putc() function to the LCD display Delay for 0.5 second LED off Delay for 0.5 second Clear display and start again Line 2

This is what it looks like using HyperTerminal through a serial port of a PC

And this is what the LCD display looks like.