Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need Help doing C Language Programming for PIC18F4520 MPLAB lCD 3

Status
Not open for further replies.
yes open the mplab. file -> import .. and locate the hex file and import it to the mplab. and, program it from mplab.. surely it will work.
 

yup . followed your step and program it already and didnt get what you said it will be..
 

Rd6(pic) to pin 3(lcd)
rd5 to pin 2
rd4 to pin 1
rd3 to pin11
rd2 to pin10
rd1 to pin 9
rd0 to pin8
 

Please name the LCD pins as RS. RW. E, D0-D7.

It seems that you are using 3 control lines and 4 data lines for LCD. So, your's is a 4-bit LCD. So, hemnath's code will not work for you. You need 4 -bit lcd code.
 

Rd6(pic) to E
rd5 to RW
rd4 to RS
rd3 to D7
rd2 to D6
rd1 to D5

ahhh . what the difference between 4bit and 8 bit?
rd0 to pin8
 

That picture looks very much like PICDEM 2 Plus later version (ROHS) version board.

If it is, then the code I posted should work.

RD7 needs to be high at all times, as this controls power to the LCD.

Did you try unplugging the programmer after burning the hex file, as the programmer sometimes leaves reset asserted?

Is the canned crystal oscillator Y2 connected the right way round? The writing should be upside down on the oscillator, if the board is right way up.

Do the LEDs count up when you first power up the board (with my hex file loaded and jumper J6 fitted)?

Can't think what else to try.
 
Last edited:

do you mean the words on y2 should be upside down ?
 

do you mean the words on y2 should be upside down ?

That is exactly what I mean

One corner of the oscillator is squarer than the other corners. This square corner should be top right, as suggested by the diagram on the board
 

what does the program in hex do ?
It:

1 flashes the LEDs (counts up)
2 Writes a test message to the LCD
3 Leaves a message on the LCD
4 Sends a help message to serial port at 9600 baud 8,n,1 (assuming 4MHz crystal oscillator fitted) use your favourite terminal program on PC
5 Waits for user to enter "?" for help, or a single character command.
6 Returns temperature if "h" command entered (as read from on-board temperature sensor)

If you do not even see step 1, then there is something seriously wrong.

I can post a simpler LED flash program that uses internal oscillator if step 1 fails.
 

and in the schematic diagram which headers need to be connected?
 

step 1 doesnt work at all

- - - Updated - - -

how do you want it to flash? one led or all 4 led?
 

step 1 doesnt work at all
Then there is something badly wrong.

how do you want it to flash? one led or all 4 led?
All 4 LEDs will light.

Try the attached hex file. It uses internal oscillator and flashes LEDs
 

Attachments

  • pintest.rar
    289 bytes · Views: 52

pintest rar , does the the d5 and d2 light up at different timing ?
 

fine. finally this program works for you .Please check the following connections in your hardware, and load the program to your microcontroller
connect LCD pin RS to PIN_D6
connect LCD pin EN to PIN_D4
connect LCD pin R_W to PIN_D5
connect LCD pin D7 to uC pin B7
connect LCD pin D6 to uC pin B6
connect LCD pin D5 to uC pin B5
connect LCD pin D4 to uC pin B4
If all the connections are right and program your microcontroller.
load this hex file.
 

Attachments

  • main.rar
    605 bytes · Views: 42

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top