// sets the position of cursor in row and column

Similar documents
LCD. Configuration and Programming

AVR Board Setup General Purpose Digital Output


C Programming in Atmel Studio 7 Step by Step Tutorial

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

Robosoft Systems in association with JNCE presents. Swarm Robotics

How to use RFpro in Packet Mode

Page 1 of 7. Samtron/Samsung 20S204DA2

Layman definition: Gadgets and devices Technical definition: Self-controlled devices Usually, such systems consist of I/O (input/output) devices such

6.1. EE 109 Unit 6. LCD Interfacing

Kod. #define white PA5 #define green PA6 #define red PA7


WEATHER STATION WITH SERIAL COMMUNICATION

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz II

Embedded Systems Programming. ETEE 3285 Topic HW3: Coding, Compiling, Simulating

SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS

chip1controller /* * SeniorDesignI2C.c * * Created: 11/24/2014 6:54:26 PM * Author: Robert Bower / Alonzo Ubilla * Chip 1 control */

" Write"a"single"line"of"C"code"to"implement"each"of"the"following.""Assume"the"following"declarations"

Lab Experiment 9: LCD Display

TN-192. Bar Graph shows analog trends on a dot-matrix character LCD module. Introduction. LCD Module Basics. Custom Characters

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) Dragon12 LCD Display. The Dragon12 board has a 16 character x 2 line display

Introduction to Micro-controllers. Anurag Dwivedi

Speed Control of a DC Motor using Digital Control

SPLDuino Programming Guide

Dragon12 LCD Displays Huang Sections 7.8 Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) ATD_10B8C Block User Guide. Dragon12 LCD Display

Character Based LCD Module Interface.

#include <avr/io.h> #include <avr/interrupt.h> #define F_CPU UL // 8 MHz.h> #include <util/delay.h>

LCDs. Embedded Systems Interfacing. 20 September 2011

Appendix A: Rack Specification Sheet

Dragon12 LCD Displays Hantronix_CLD.PDF data sheet (Dragon12 CD-ROM) Dragon12 LCD Display. The Dragon12 board has a 16 character x 2 line display

// initialize the library with the numbers of the interface pins - S LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

LABORATORY MANUAL EMBEDDED C LABORATORY. M. Tech I Year I Sem R13 DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGG.

EMBEDDED HARDWARE DESIGN. Tutorial Interfacing LCD with Microcontroller /I

Q1 Q2 Q3 Q4 Q5 Q6 Total /7.5 /5 /10 /5 /7.5 /5 /40

Lampiran I. Rangkaian Lengkap Alat. Universitas Sumatera Utara

loop switch ( ) { case STATE_INIT: // // break; case STATE_SETTING: // // break; case STATE_COUNTDOWN: // // break; case STATE_PAUSE: // // break;

EE 109 Unit 4. Microcontrollers (Arduino) Overview

//Added Band selection switch and User configurable IF for BITX by KD2ETS-modi //Removed non standard increment frequency//

Embedded Systems. Introduction. The C Language. Introduction. Why C instead ASM. Introduction to C Embedded Programming language

Laboratory 3 Working with the LCD shield and the interrupt system

Computer Architectures

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

#include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <string.h> #include <stdlib.h> #include "lcd.c"

AN703. Micro64/128. Accessing the 36k of SRAM 12/3/04

The naked computer. The naked computer. Separate bus architecture. Real-time Systems SMD138

CPEG300 Embedded System Design. Lecture Interface with Peripheral Devices

ARDUINO EXPERIMENTS ARDUINO EXPERIMENTS

LAMPIRAN. Program Keseluruhan Sistem Pengontrolan Level Air

The EE 109 LCD Shield

The EE 109 LCD Shield

An FTDI connection: The ATtiny microcontrollers don t have a hardware UART External Crystal header pins for an optional crystal

Lab 3 XBees and LCDs and Accelerometers, Oh My! Part 1: Wireless Communication Using XBee Modules and the Arduino

Character LCD Interface for ez80acclaim! MCUs

Supplementary Materials: Fabrication of a Lab on Chip Device Using Material Extrusion (3D Printing) and Demonstration via Malaria Ab ELISA

Software debouncing of buttons

Lab 4 LCDs and Accelerometers

Introduction. Unit 4. Numbers in Other Bases in C/C++ BIT FIDDLING. Microcontrollers (Arduino) Overview Digital I/O

C-CODE EXAMPLE FOR SCP1000-D01 PRESSURE SENSOR

Workshop Arduino English starters workshop 2

마이크로프로세서응용. ATmega128 7 Segment Driving

EXPERIMENT NO. 01 CALCULATOR USING PIC16F877

Digital and Analogue Project Report

#include <hidef.h> /* common defines and macros */ #include <MC9S12XEP100.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12xep100"

Lab Report for Sensor Calibration using a PIC16F84 GROUP MEMBERS ALFRED MAZHINDU SIMBARASHE CHIWESHE

Send commands via bluetooth, e.g. irise app for Android

Laboratory 5 Communication Interfaces

CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK

Using Arduino Boards in Atmel Studio 7

BUS=="usb", ACTION=="add", SYSFS{product}=="AVRISP mkii", MODE="0666", SYMLINK+="avrdev"

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

84x48 LCD Display. 1. Usage with an Arduino 1.1 Connecting the display 1.2 Pin assignment 1.3 Code example

AVR PCD8544 DRIVER DOCUMENTATION

3 Wire LED Module (SKU:DFR0090)

Liquid Crystal Displays

ARDUINO. By Kiran Tiwari BCT 2072 CoTS.

Microprocessors & Interfacing

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2

Programming Manual V1.1. Elektor Proton Robot. Bart Huyskens. Elektor Proton Robot

#define PD4 (*((volatile unsigned long *)0x )) #define PE3 (*((volatile unsigned long *)0x ))

Burglar Alarm Final Report

Arduino: LCD Diagrams & Code Brown County Library

{ int i,j; for(i=0;i<count;i++) for(j=0;j<1275;j++); }

CN310 Microprocessor Systems Design

File: Unsaved Document 1 Page 1 of 7

I n t e r a c t i v e HA u t o m a t a _. Programming for Engineers Winter Andreas Zeller, Saarland University

Designed & Developed By: Ms. Jasleen Kaur, PhD Scholar, CSE. Computer Science & Engineering Department

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

// fontdata6x8.h //WARNING: This Font is usable only with MikroE GLCD Lib. // X-GLCD Lib does not handle this font.

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

Input/Output Devices. Lecturer: Sri Parameswaran Notes by: Annie Guo

,$5$SSOLFDWLRQ1RWH$95 (IILFLHQWSURJUDPPLQJRI$WPHO V $95 PLFURFRQWUROOHUV

Debugging embedded HW/SW systems differs greatly from debugging software or hardware alone. Key steps to debugging: 1

IMDL Fall 2010 Final Report

Overview. The C programming model. The C programming model. The C programming model. The C programming model 1/23/2009. Real-time Systems D0003E

// Voltage Reference: AREF pin #define ADC_VREF_TYPE ((0<<REFS1) (0<<REFS0) (0<<ADLAR))

#include <Keypad.h> int datasens; #define pinsens 11. const byte ROWS = 4; //four rows const byte COLS = 3; //three columns

AUTORIDE FINAL REPORT

Junying Huang Fangjie Zhou. Smartphone Locker

Goal: Strengthen our understanding of C and program our Mudduino boards

Transcription:

CODE: 1] // YES_LCD_SKETCH_10_14_12 #include <LiquidCrystal.h> //lcd(rs, E, D4, D5, D6, D7) LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int numrows = 2; int numcols = 16; void setup() Serial.begin(9600); lcd.begin(numrows, numcols); lcd.clear(); lcd.setcursor(0,0); lcd.print("thank God!!!"); lcd.setcursor(0,1); lcd.print("this WORKS!"); // clears the display // sets the position of cursor in row and column void loop() if (Serial.available() > 0) char ch = Serial.read(); if (ch =='#') lcd.clear(); else if (ch == '/') // new line lcd.setcursor (0,1); else lcd.write(ch); 2] //YES_12-5_1 8 PIN MODE 2 PORTS 10-15-12 #define F_CPU 16000000UL #include <LiquidCrystal.h> #include <avr/io.h> #include <util/delay.h> //lcd(rs, E, D0, D1,D2,D3,D4,D5,D6,D7) LiquidCrystal lcd(8,9,0,1,2,3,4,5,6,7); #define LCD_DPRT PORTD // does NOT work with port A #define LCD_DDDR DDRD // ONLY with all B or C or a #define LCD_DPIN PIND // combination of the two!!! #define LCD_CPRT PORTB #define LCD_CDDR DDRB #define LCD_CPIN PINB

#define LCD_RS 8 #define LCD_RW 1 #define LCD_EN 9 void setup() Serial.begin(9600); void delay_us(unsigned int d) _delay_us(d); void lcdcommand( unsigned char cmnd ) LCD_DPRT = cmnd; // ready data lines LCD_CPRT &= ~ (1<<LCD_RS); // RS low (lower line on the timing diagram) to select the Instruction register. // Enable pin high to latch data on the falling edge. // Enable pin high for 1us to enable latching of instruction set. LCD_CPRT &= ~ (1<<LCD_EN); // LCD_EN pin of Port B low after sending an instruction. // Enable pin low for 100 us after sending instruction set. ** LCD_DPRT = data; LCD_CPRT = (1<<LCD_RS); // RS pin high (upper line on the timing diagram)to select the Data register. // Enable pin set to latch data on the falling edge. // Enable pin high for 1us to enable latching of data set. LCD_CPRT &= ~ (1<<LCD_EN); // LCD_EN pin of Port B low after sending data byte. // Delay 100 us between data sent. void lcd_init() LCD_DDDR = 0xFF; LCD_CDDR = 0xFF; LCD_CPRT &=~(1<<LCD_EN); lcdcommand(0x38); lcdcommand(0x0e); lcdcommand(0x01); lcdcommand(0x06); void lcd_gotoxy(unsigned char x, unsigned char y) unsigned char firstcharadr[]=0x80,0xc0,0x94,0xd4; //table 12-5 lcdcommand(firstcharadr[y-1] + x - 1);

void lcd_print( char * str ) unsigned char i = 0 ; while(str[i]!=0) lcddata(str[i]); i++ ; int main(void) lcd_init(); lcd_print("thank God!"); lcd_print("this compiles!"); while(1); return 0; 3] (Same as 2] above except for the lcdcommand and lcddata functions void lcdcommand( unsigned char cmnd ) LCD_DPRT = cmnd; // ready data lines LCD_CPRT &= ~ (1<<LCD_RS); // RS low (lower line on the timing diagram)to select the Instruction register. delay_us(.020); // Delay 20 ns for address set-up time. // Enable pin high to latch data on the falling edge. // Enable pin high for 230 ns to enable latching of instruction set. LCD_CPRT &= ~ (1<<LCD_EN); LCD_DPRT = data; LCD_CPRT = (1<<LCD_RS); LCD_CPRT &= ~ (1<<LCD_RW); delay_us(.020); LCD_CPRT &= ~ (1<<LCD_EN);.. // LCD_EN pin of PortB low after sending an instruction. // Enable pin low for 230 ns after sending instruction set. // RS pin high (upper line on the timing diagram)to select the Data register. // RW low to write instructions. // Delay 20 ns for address set-up time. // Enable pin set to latch data on the falling edge. // Enable pin high for 230 ns to enable latching of data set. // LCD_EN pin of PortB low after sending data byte. // Delay 230 ns between data sent.

4] 12.7.1 4 bit mode, 1port //<CODE6 12.7.1: 4bit mode, 1port> (SAME AS BEFORE) void delay_us(float d) _delay_us(d); void delay_ms(float d) _delay_ms(d); //****************************** void lcdcommand( unsigned char cmnd ) LCD_PRT = (LCD_PRT & 0x0F) (cmnd & 0xF0); LCD_PRT &= ~ (1<<LCD_RS); //RS = 0 for command LCD_PRT &= ~ (1<<LCD_RW); //RW=0 for write //EN =1 for H-to-L to make EN wider delay_us(20); LCD_PRT = (LCD_PRT & 0x0F) (cmnd << 4); //***************************** LCD_PRT = (LCD_PRT & 0x0F) (data & 0xF0); LCD_PRT = (1<<LCD_RS); LCD_PRT &= ~ (1<<LCD_RW); LCD_PRT = (LCD_PRT & 0x0F) (data << 4); //******************************* void lcd_init() LCD_DDR = 0xFF; LCD_PRT &=~(1<<LCD_EN); lcdcommand(0x33); lcdcommand(0x32); //EN=1for H-to-L to make EN wider // RS = 1 for data //RW= 0 for write //EN=1 for H-to-L to make EN wider //EN=1 for H-to-L to make EN wider // LCD port is output //LCD_EN=0 for stable power // $33 for 4 bit mode //$32 for 4 bit mode

lcdcommand(0x28); //$28 for 4 bit mode lcdcommand(0x0e); //$32 for 4 bit mode lcdcommand(0x01); //display on, cursor on wait lcdcommand(0x06); //shift cursor right //**************************** void lcd_gotoxy(unsigned char x, unsigned char y) //table 12-5 unsigned char firstcharadr[] = 0x80, 0xC0, 0x94, 0xD4; lcdcommand(firstcharadr[y-1] + x - 1); //************************* void lcd_print( char * str ) unsigned char i = 0 ; while(str[i]!=0) lcddata(str[i]); i++ ; //***************************** int main(void) lcd_init(); while(1) lcd_print("the world is but"); lcd_print("one country"); delay_ms(1000); // stay forever lcd_print("and this one"); lcd_print("also compiles"); delay_ms(1000); return 0; //********************************************** //********************************************** /CODE