![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
i m asking to use PIC16F877 to do a text display on LCD.. the LCD that i use is on the PICDEM 2PLUS... i had wrote the code to display the text, but it seen like show nothing.. i don't know where my mistake is.... | |
| |
| | #2 |
|
You appear to have initialisation code for 8 bit mode and write data for 4 bit mode. Have you combined code from 2 different sources? As a starting point, look at Nigel's LCD tutorial. He should be around soon and the link is in his sig + in the sticky. Mike. | |
| |
| | #3 |
|
combined code from 2 different sources?? i don't understand with what you mean..is it my source code have mistake? may i know which part of code should i correct it?? i only program this file inside PIC, no any other file... yap, before that, i had go through Nigel's LCD tutorial 3.. since i had to use PICDEM 2 PLUS to program it and display on its LCD, i had to change the code inside the tutorial(for the port pin).. since i new to LCD step source code, i fail to make the LCD work...the LCD display seen like didn't have any respond... thanks..May You Be Well And Happy... | |
| |
| | #4 |
|
You appear to have bit 7 of the LCD connected to Port D bit 3. You then write a full byte in INIT_LCD. Code: INIT_LCD BCF PORTA,3 MOVLW b'00101000' ;10h + 08h MOVWF PORTD Code: LCD_Char movwf templcd swapf templcd,w ;send upper nibble andlw 0x0f ;clear upper 4 bits of W movwf PORTD bsf PORTA,3 ;RS line to 1 call Pulse_e ;Pulse the E line high movf templcd,w ;send lower nibble andlw 0x0f ;clear upper 4 bits of W movwf PORTD This is why I can't follow your code. It switches from 8 bit to 4 bit. It cannot be both. I would suggest modifying Nigel's code and get that working first. Mike | |
| |
| | #5 |
|
i just edit the source code from example using 8-bit data bus LCD... since the LCD that i used on PICDEM 2 PLUS which the connection is for 4-bit data bus LCD, so i copy the 4-bit source code from Nigel's example.. i didn't understand with the step of code should go through, so i unable to write a right code.. ok, i will try to understand with the Nigel's tutorial 3 and do some editing from the code.. that Nigel's code is it just need to load with one file?don't need load other file? thanks... | |
| |
| | #6 | |
| Quote:
| ||
| |
| | #7 |
| Code: movlw b'110001' movwf TRISA | |
| |
| | #8 | |
| Quote:
| ||
| |
| | #9 | |
| Quote:
Mike | ||
| |
| | #10 |
|
P.S. I quoted the wrong post. The irony is fully appreciated.
| |
| |
| | #11 | |
| Quote:
movwf TRISA the PIC16F877 got only 6 bits RA0-RA5, so i just b'110001' not b'8 bit'... thanks.. | ||
| |
| | #12 | |
| Quote:
You can't load W with only 6 bits, so make sure it's loading the bits in the place you want. | ||
| |
| | #13 |
|
Obviously he would be on the safe side using 8 bits (I do that every time), but actually he's loading the six less significant bits of the TRISA register.
Last edited by eng1; 8th June 2007 at 06:29 PM. | |
| |
| | #14 | |
| Quote:
Far easier to do it with 8 bits in the first place!. | ||
| |
| | #15 |
|
I assumed everyone was talking tongue in cheek and joking around. If you see movlw 0x9 (only 4 bits) do you assume it will add a trailing zero and load 0x90 into W. When I posted above, "It would of course take B'1' as 128." I was joking. I don't think I have ever come across a situation where you add trailing zeroes. Mike. | |
| |
|
| Tags |
| display, lcd, pic, problem |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| PIC16F628A Reset? | marting | Micro Controllers | 18 | 5th December 2008 09:31 PM |
| Need help with Intel Assembly Language and PIC16F877 | avinsinanan | Micro Controllers | 10 | 4th March 2008 11:02 AM |
| Using Oscilloscopes | mechie | Electronic Theory | 9 | 29th November 2007 10:49 PM |
| Multiple digits 7 segments display | Joel Rainville | Micro Controllers | 44 | 22nd August 2005 09:22 PM |
| 7 seg. display problem | bluegirl | Electronic Projects Design/Ideas/Reviews | 8 | 18th April 2003 01:40 PM |