Question

In: Electrical Engineering

An LCD 16x2 display is used for PIC16F1619, if Port C is connected to 8 data...

An LCD 16x2 display is used for PIC16F1619, if Port C is connected to 8 data pins of the LCD. Pin4 and 5 of port A are connected to EN and RS respectively. RW is tied to the ground. Write a C code to set up 2 lines, 5x8 matrix, 8-bit mode and force the cursor to the beginning of the first line.

Solutions

Expert Solution


#define RS RA5
#define EN RA4
#define D0 RC0
#define D1 RC1
#define D2 RC2
#define D3 RC3
#define D4 RC4
#define D5 RC5
#define D6 RC6
#define D7 RC7
unsigned char rw=0;// connected this pin to gnd

void main()
{
TRISA = 0x00;
TRISC = 0x00;// using port c as output
Lcd_init();
while(1)
{
// program to disply string
}
}
void lcd_init()
{
LCD_CmdWrite(0x30); // Configure the LCD in 8-bit mode,
LCD_CmdWrite(0x0C); // Display On and Cursor Off
LCD_CmdWrite(0x01); // Clear display screen
LCD_CmdWrite(0x06); // Increment cursor
LCD_CmdWrite(0x80); // Set cursor position to 1st line, 1st column
}
void LCD_CmdWrite( char cmd)
{

PORTC = (PORTC & 0xF0) | (cmd >> 4);; // Send the command to LCD
rs=0; // Select the Command Register by pulling RS LOW
rw=0; // connected to gnd low

en=1; // Send a High-to-Low Pusle at Enable Pin
__delay_ms(10);
en=0;

__delay_ms(200);
}

void _delay_ms(int x)

{
int y = x/15;
while(--y != 0)
continue;

}


Related Solutions

Q1- Write code in C language(Atmel atmega32 avr microcontroller) (a)-Switches are connected to Port C and...
Q1- Write code in C language(Atmel atmega32 avr microcontroller) (a)-Switches are connected to Port C and Port B and LED’s with PORTD. Write a code to read input from PortB and C and perform following. Addition of both inputs, Subtraction, Multiplication, Division, And, Or, Nor,Xor. (b)- A switch is connected to PD0 and LED’s to Port B and Port C. Write a code to perform following: When switch is 0 send your roll number to Port B. When Switch is...
Port = 0x0055 A) Port &= 0xff0; B) Port |= 15;   C) Port = Port ^...
Port = 0x0055 A) Port &= 0xff0; B) Port |= 15;   C) Port = Port ^ 0x0005; D) Port = ( ( Port &~(0x000f) ) | 0x0020 );   Please explain how each logical opperator works and write out the results.
I am trying to work on LCD display using VHDL. I want to display the word...
I am trying to work on LCD display using VHDL. I want to display the word “TECH” and make it blink on LCD. I need the complete source code (If anyone helps me and the code works I will offer bonus cash for it )
Question 1: Write an AVR program to display text on a 2-line WH2002 LCD display based...
Question 1: Write an AVR program to display text on a 2-line WH2002 LCD display based on the HD44780 controller. Apply the following: The LCD instruction/data bus is connected to PORTD, and control bus is connected to PORTB (RS is connected to PB0, R/W to PB1, E to PB2). Use the #define command to name PORTD as Display_port. Use the #define command to name PORTB as Control_port. The displayed information is stored in the microcontroller Flash ROM (maximum size of...
A consumer price analyst claims that prices for liquid crystal display (LCD) computer monitors have a...
A consumer price analyst claims that prices for liquid crystal display (LCD) computer monitors have a mean of $ 170 and a standard deviation of $ 47. 2. You randomly selected 25 LCD compute monitors. What is the probability that their mean cost is less than $ 180? Assume here that the prices are normally distributed 3. You randomly selected 64 LCD compute monitors. What is the probability that their mean cost is less than $ 180?
4.What are two methods used to backlight an LCD?
4.What are two methods used to backlight an LCD?
Handi Inc., a cell phone manufacturer, procures a standard display from LCD Inc. via an options...
Handi Inc., a cell phone manufacturer, procures a standard display from LCD Inc. via an options contract. At the start of quarter 1 (Q1), Handi pays LCD $4.00 per option. At that time, Handi’s forecast of demand in Q2 is normally distributed with a mean of 30,000 and a standard deviation of 9,000. At the start of Q2, Handi learns exact demand for Q2 and then exercises options at the fee of $2.70 per option, (for every exercised option, LCD...
A manufacture of laptop computers has four models, two with color lcd (liquid crystal display) screens...
A manufacture of laptop computers has four models, two with color lcd (liquid crystal display) screens (the spot model and the superba model) and two model with black and white lcd screens ( the standard model and the excel model). each model required assembly and test time and the requirements are shown in the table 2, together with the amount of time available for assembly and testing next month. LCD. the lcd screens are purchased from and outside supplier and,...
Using an arduino, breadboard,  ultrasonic sensor, buzzer, lcd and red led display distance in centimeters, If needed,...
Using an arduino, breadboard,  ultrasonic sensor, buzzer, lcd and red led display distance in centimeters, If needed, use a rotary potentiometer, male to male cable (m-m) female to male cable (f-m) or any resistor provided in the kit. display distance in centimeters to lcd. If the object is in distance, turn on Active buzzer(play sound) and turn on red led. If the object is not in range, display out of range or "Object now close'.  on the lcd, make sure the buzzer...
1)Why would an LCD display on calculators or electronic wristwatches appear completely black when viewed through...
1)Why would an LCD display on calculators or electronic wristwatches appear completely black when viewed through polarized sunglasses? How could one read the display without removing the sunglasses? 2)Why might it be beneficial for a photographer to have a polarizing filter for their camera when taking pictures outdoors? 3)What does the vertical polarization axis of polarized sunglasses indicate about the direction of polarization of light bouncing off a horizontal surface, such as a wet road or lake surface? Hint: The...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT