electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

interfacing JHD161A with PIC18F2550


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> interfacing JHD161A with PIC18F2550
Author Message
Ankita Agarwal



Joined: 10 Jun 2009
Posts: 7


Post04 Jul 2009 12:11   

jhd161a


I have written this code to interface JHD161A with my PIC18F2550 but LCD is showing nothing...i am attaching this code plz help

#include <p18cxxx.h>
#include<delays.h>

#pragma config PLLDIV = 5 // (20 MHz crystal on PICDEM FS USB board)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON //USB Voltage Regulator
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
#pragma config DEBUG = OFF
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CP2 = OFF
#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRT2 = OFF
#pragma config WRT3 = OFF
#pragma config WRTB = OFF // Boot Block Write Protection
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTR2 = OFF
#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF


#define LCD_data PORTB
#define LCD_rs PORTAbits.RA0
#define LCD_rw PORTAbits.RA1
#define LCD_en PORTAbits.RA2


void LCD_busy(void);
void LCD_init(void);



void main(void)
{
ADCON1|=0x0F;
TRISAbits.TRISA0=0;
TRISAbits.TRISA1=0;
TRISAbits.TRISA2=0;
LCD_init();
PORTB = 0x83;
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->l
LCD_en = 0;
LCD_busy();

PORTB = 'A'; //Function set: 1 Line, 8-bit, 5x7 dots
LCD_rs = 1; //Selected data register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->l
LCD_en = 0;
LCD_busy();



while(1)
{
};
}


void LCD_init(void)
{
TRISB=0;
PORTB = 0x30; //Function set: 1 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command


PORTB=0x0E;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy();

PORTB = 0x01; //Clear LCD
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command


PORTB = 0x06;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy();


}




void LCD_busy(void)
{

Delay10KTCYx ( 240 );
}

But nothing is displayed in LCd where is the problem i cudn't get.
Back to top
Google
AdSense
Google Adsense




Post04 Jul 2009 12:11   

Ads




Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> interfacing JHD161A with PIC18F2550
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
C code for interfacing DS1302 with PIC18F2550 (2)
Interfacing PIC18F2550 to Labview 7.1 or later (18)
Interfacing PIC18F2550 to Labview 7.1 or later (1)
DS1302 with PIC18F2550 (1)
how to connect PIC18F2550 with PIC18F4331?? (1)
ICSP w/ PIC18F2550 (4)
ADC interfacing with 8051 with full source code (1)
help with battery charger project-interfacing with lpc2148 (2)
Pic18f2550 and USB (2)
PIC 16C745 to PIC18F2550 (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS