Previous in Forum: Mymail Been Hacked or Assess by Someone Else   Next in Forum: Microsoft Word/Excel
Close
Close
Close
8 comments
Rate Comments: Nested
Participant

Join Date: Feb 2012
Posts: 3

Problem Interfacing PIC16F877A with JHD162A LCD

02/22/2012 5:51 AM

My final project is to create a "DISTRIBUTED MESSAGE DISPLAY SYSTEM", USING "MASTER-SLAVE COMMUNICATION", where the "DESKTOP" acts as the "master" and the "Microcontroller+LCD" acts as the "slave".

Our 1st step was to interface the Microcontroller with the Desktop using MAX232 and a DB9 connector, trying to display some message at the Hyperterminal Screen of the Desktop. (Specifications: using 4Mhz oscillator, baud rate 9600, 0-5V supply). BUT WE HAVE NOT YET GOT THE DESIRED CHARACTERS DISPLAYED !!!

Now, We are trying to interface the microcontroller PIC16F877a with a LCD - JHD162A. (Specifications: 5Mhz oscillator, baud rate 9600, 0-5V supply). BUT NO RESULT ! ONLY THE CURSOR IS BLINKING AT THE BEGINNING !!!

CAN ANYONE PLZ HELP ??????? FIND OUT OUR FAULTS AND POSSIBLE SOLUTIONS PLZZZZZ !!!!!!

Here is the program that we have written, burnt in the MC and are still trying to display text in the LCD:

#INCLUDE <P16F877A.INC>
__CONFIG _CP_OFF & _CPD_OFF & _DEBUG_OFF & _LVP_OFF & _WRT_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC

COUNTA EQU 0x30
COUNTB EQU 0x64
ORG 0X000
GOTO MAIN
ORG 0X004
STOP
GOTO STOP
ORG 0X010


MAIN
MOVLW 0X00
BSF STATUS, 5 ; BANK 1
MOVWF TRISB ; SET PORT B AS O/P
MOVWF TRISA ; SET PORT A AS O/P
MOVWF TRISC
BCF STATUS, 5


MOVLW 0x38 ; 8 BIT DATA BUS AND 2 LINE DISPLAY
CALL COMD
BSF PORTC, 1
CALL DELAY
BCF PORTC, 1
MOVLW 0x0E ; TURN ON LCD AND CURSOR BLINKING
CALL COMD
BSF PORTC, 1
CALL DELAY
BCF PORTC, 1
MOVLW 0X80
CALL COMD
BSF PORTC, 1
CALL DELAY
BCF PORTC, 1
MOVLW 0X01
CALL COMD
BSF PORTC, 1
CALL DELAY
BCF PORTC, 1

LOOP:
MOVLW 0x31
CALL TEXT
BSF PORTC, 1
CALL DELAY
BCF PORTC, 1

GOTO LOOP

COMD: BCF PORTA, 1 ; RS=0 (INSTRUCTION REGISTER)
MOVWF PORTB ; COMMAND OR TEXT IN PORTB
BCF PORTA, 2 ; R/W=0
BSF PORTA, 0
CALL DELAY
BCF PORTA, 0
RETURN

TEXT:
BSF PORTA, 1 ; RS=1 (DATA REGISTER)
MOVWF PORTB ; COMMAND OR TEXT IN PORTB
BCF PORTA, 2 ; R/W=0
BSF PORTA, 0
CALL DELAY
BCF PORTA, 0
CALL DELAY
RETURN
RETURN


DELAY:
MOVLW D'11'
MOVWF COUNTB

NEW2 DECF COUNTB
BTFSS STATUS, Z ; SET/RESET?
GOTO NEW1 ; IF A IS NOT 0
GOTO NEW ; IF A IS 0


NEW1 MOVLW D'100'
MOVWF COUNTA

LOOP2 DECF COUNTA
BTFSS STATUS, Z ; SET/RESET?
GOTO LOOP1 ; IF A IS NOT 0
GOTO NEW2 ; IF A IS 0

LOOP1 MOVLW D'249'

LOOP3 ADDLW D'255'
BTFSS STATUS, Z ;IS ZERO FLAG SET?
GOTO LOOP3 ; NO
GOTO LOOP2 ; YES

NEW RETURN


END

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
Engineering Fields - Electrical Engineering - Been there, done that. Engineering Fields - Control Engineering - New Member

Join Date: Dec 2008
Location: Long Island NY
Posts: 15600
Good Answers: 981
#1

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/22/2012 9:35 AM

Have you consulted with your teacher for this final project about your problem? If you did, what did they say?

Did you contact any of the component manufacturers, specifically the microcontroller about your communication problem? If you did, what did they say?

Did you probe any pins of the microcontroller with an oscilloscope? If you're lucky the scope has a serial ASCII translator that can decode the messages?

What school are you attending?

__________________
"Don't disturb my circles." translation of Archimedes last words
Register to Reply
Participant

Join Date: Feb 2012
Posts: 3
#6
In reply to #1

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/27/2012 2:06 AM

yes, we are constantly in touch with our teacher. but she's unable to help any further now.

No, talking to the manufacturers is out of the question. its practically impossible.

we attend the Bengal College of Engineering and Technology.\

The oscilloscope thing didnt work.

Register to Reply
Guru
Engineering Fields - Electrical Engineering - Been there, done that. Engineering Fields - Control Engineering - New Member

Join Date: Dec 2008
Location: Long Island NY
Posts: 15600
Good Answers: 981
#8
In reply to #6

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/27/2012 9:16 AM

Well if the oscilloscope is not showing any communication from your computer to your chip, then all of those lines of code in your initial message are nothing more than text on a page. You've not been able to get any coding into your microcontroller. First thing is establish communication with your chip. Get your chip to accept the simplest of commands (turn one I/O bit ON/OFF) and have your debug program able to retrieve the program and register array from the chip and not a simulator. Only once you know that you're actually programing the chip and not your computer can you proceed any further.

__________________
"Don't disturb my circles." translation of Archimedes last words
Register to Reply Score 1 for Good Answer
Guru

Join Date: Mar 2007
Location: by the beach in Florida
Posts: 33392
Good Answers: 1817
#2

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/22/2012 3:30 PM
__________________
All living things seek to control their own destiny....this is the purpose of life
Register to Reply
Commentator

Join Date: Jul 2008
Location: LA, CA
Posts: 97
#3

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/22/2012 5:59 PM

School Project! :)) In my final project 'we' all had to build micro computers with... WIRE WRAP!!! Z80 CPU's, 6116 Rams, 2732 roms, 8255 as a multiple purpose IO system lol

CHECK YOUR WIRING! Check subsystems for proper operation.

Mine had one address line A014 accidently tied to ground... Took me a few days to find it, but after that correction - it worked as planned :))

__________________
Bla - de - bla - de - BLA!!! "That's Me!!!"
Register to Reply
Participant

Join Date: Feb 2012
Posts: 3
#7
In reply to #3

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/27/2012 2:18 AM

we have rebuilt the ckt from scratch a thousand times! we are getting frustrated now !!!!

Register to Reply
Guru

Join Date: Feb 2012
Posts: 595
#4

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/23/2012 3:08 PM

i donno about µC-s

but the HyperTerminal must meet your COM parameters and *protocol

and your cable must be properly wired for*

and your polarities need to match at µC and PC side

there were some extra crap with MB integrated Comm controllers - just try at minimum bauds first

__________________
ci139
Register to Reply
Guru

Join Date: Feb 2012
Posts: 595
#5

Re: Problem Interfacing PIC16F877A with JHD162A LCD

02/25/2012 6:36 AM

chk http://ww1.microchip.com/downloads/en/DeviceDoc/31009a.pdf

it looks your EEPµC is sensitive to overloads (not to experiment with)

you need X-tra protection to PC side if you need to play around with

+ i'd try something like that http://www.lammertbies.nl/comm/cable/RS-232-spy-monitor.html

__________________
ci139
Register to Reply
Register to Reply 8 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

ci139 (2); cmerigroup (2); redfred (2); SolarEagle (1); Walts_Worker (1)

Previous in Forum: Mymail Been Hacked or Assess by Someone Else   Next in Forum: Microsoft Word/Excel

Advertisement