• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 16 pages
Other

Devry University - Ecet 340: Lab#2 Keypad-Lcd Programming Keypad On Twr-Dev-Periph.

Document preview thumbnail
Preview 3 out of 16 pages

Devry University - ECET 340: LAB#2 Keypad-LCD PROGRAMMING KEYPAD ON TWR-DEV-PERIPH. do{ mSDelay(15); PORTA = PORTA | 0x0F; //COLUMNS SET HIGH row = PORTA & 0xF0; //READ ROWS }while(row != 0x00); //MAKE SURE BUTTON IS NOT STILL HELD } //CLOSE WHILE(1) } //CLOSE MAIN /**********************SUBROUTINES***********/ void mSDelay(unsigned int itime){ unsigned int i; unsigned int j; for(i=0;iitime;i++) for(j=0;j1000;j++); } Lab Manual for “HCS12 Microcontroller and Embedded Systems” LAB#2 Keypad-LCD WORKSHEET ACTIVITY 2 Repeat Activity 1 to display the characters on LCD. Use the LCD program in Lab1A_LCD #include hidef.h /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ #define LCD_DATA PORTC #define LCD_CTRL PORTC #define RS 0x01 // PORTCo for RS pin of LCD #define EN 0x04 // PORTC2 for en pin of LCd void COMWRT4(unsigned char); void DATWRT4(unsigned char); void mSDelay(unsigned int); const unsigned char keypad[4][4] = { 0x31,0x32,0x33,0x41, 0x34,0x35,0x36,0x42, 0x37,0x38,0x39,0x43, 0x2A,0x30,0x23,0x44 //Notice 0x2A is ASCII for '*' and 0x23 for '#' }; unsigned char column,row,mykey; /**************MAIN*******************************/ void main(void){ //OPEN MAIN DDRA = 0x0F; DDRC = 0xFF; //PORTC=output for data and control signals DDRB = DDRB | 0x80; //PB7 as output PORTB = PORTB & 0x7F; //PB7=0 for CSB pin of LCD DDRP = DDRP | 1; //PORTP7 as output for backlight control PTP = PTP | 1; //turn on the backlight (optional) PORTC =0x0; mSDelay(10); //Many of the initialization commmands of ST7036 LCD is the same as HD44780 covered in the Mazidi/Causey textbook. //However, for ST7034-bases LCD we need few more commands. See Page 42 of ST7036 datasheet COMWRT4(0x33); mSDelay(1); COMWRT4(0x32); mSDelay(1); COMWRT4(0x29); //Function set:DL=0(4-bit) This option is compatibe Lab Manual for “HCS12 Microcontroller and Embedded Systems”


Document information

Uploaded on
August 24, 2021
Number of pages
16
Written in
2021/2022
Type
Other
Person
Unknown
$13.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
registered_nurse
4.0
(132)
Sold
656
Followers
586
Items
1529
Last sold
6 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions

Whoops! We can’t load your doc right now. Try again or contact support.