project using pic16F690,max232 and 2 x 16 LCD

Thread Starter

yogenchaulagain

Joined Jun 3, 2013
5
I am new to this forum and just started studying electronics gotta project to build system that takes a message from a PC unit and then sends the message to a PIC and then displays the message on an LCD using pic16F690,max232 and 2 x 16 LCD
Project includes
1) develop a wiring diagram that connects a PIC to a LCD display
2)develop a program that displays a message on a LCD when button RA1 is pressed.
4) download this program to the PIC micro-controller, test the program.
5) develop wiring diagrams to connect the PIC to a PC and convert the PC voltage levels to PIC based voltage levels using a MAX232C chip.
6) develop a program that receives a message through the PIC RS232c communication port when button RA2 is pressed (a sample program will be supplied) (you can use hyper terminal to test this program).
7) develop wiring diagrams to connect the PC to a PIC and convert the PC voltage levels to PIC based voltage levels using a MAX232C chip.
8)connect the PIC to the PC and display a PC information on the LCD display

I built the circuit and it works fine with computer. I am having trouble to connect LCD to pic16F690. my MPLAB codes are given below. I just compiled it and it works. don't know much about coding.
/*
* LCD interface example
* This code will interface to a standard LCD controller
* like the Hitachi HD44780. It uses it in 4 bit mode, with
* the hardware connected as follows (the standard 14 pin
* LCD connector is used):
*
* PORTC bits 0-3 are connected to the LCD data bits 4-7 (high nibble)
* PORTA bit 2 is connected to the LCD RS input (register select)
* RW input (read/write) connected to ground
* PORTA bit 1 is connected to the LCD EN bit (enable)
*
* To use these routines, set up the port I/O (TRISA, TRISD) then
* call lcd_init(), then other routines as required.
*/

#define _LEGACY_HEADERS //Added for compiler versions 9.81+
#include <htc.h>
#include "lcd.h"
#include <stdio.h>
#include "usart.h"
void pause( unsigned short usvalue ); //Establish pause routine function
unsigned char b0,input,count;
#define number 0x30
__CONFIG (INTIO & WDTDIS & MCLRDIS & UNPROTECT);
void main(void)
{
ANSEL = 0; // Set PORTA all Digital
ANSELH = 0;
CM1CON0 = 0; // Comparator 1 off
CM2CON0 = 0; // Comparator 2 off

TRISA = 0; // All PORTA Outputs
TRISC = 0; // All PORTC Outputs

lcd_init(); // Initialize LCD Display
INTCON=0; // purpose of disabling the interrupts.
init_comms(); // set up the USART - settings defined in usart.h
// running LCD

while (1==1)
{
lcd_clear(); // Clear LCD screen
lcd_goto(0); // select first line

for (b0=0; b0<10; b0=b0+1) // Create counting loop
{
lcd_putch(b0+number); // Display count on LCD
pause (250); // Delay 250 msec to see count
}
lcd_goto(0x40); // Select second line

lcd_puts("Hello World"); // Display Hello World
pause (1000); // Delay for 1 second to read display
}
while(1)
{

for (count = 0x31; count <= 0x39; count = count +1)
{
putch(count); // Send Count in ASCII
input = getch(); // Read a response from the user
putch(input); // Echo back response
}
while(1)
{
printf("Press a key and I will echo it back:\r\n");
input = getch(); // read a response from the user
printf("I detected [%c]\r\n",input); // echo it back
}
}
}
Could you help me out please.
Thank You.
 
Last edited:
Top