Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 05, 2024, 12:59:21 00:59


Login with username, password and session length


Pages: [1]
Print
Author Topic: Need help on ht-picc lcd routine  (Read 6294 times)
0 Members and 1 Guest are viewing this topic.
arash
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 2
-Receive: 0


« on: December 29, 2005, 01:38:50 13:38 »

Hi all.
In Ht-picc ther is a lcd sample that i want to make a little change in it.I change the data

port to portb .but when i change the rs and rw pin to RB4 & RB5 the lcd doesn't work and i

must make all pins to one port.
What shall i do now?
Logged
Zaphod Beeblebrox
Active Member
***
Offline Offline

Posts: 139

Thank You
-Given: 25
-Receive: 89



« Reply #1 on: January 05, 2006, 03:03:23 15:03 »

Hi Arash,
I don't fully understand your problem, more description is needed. Anyway, here is my sample code that I succesfully implemented using Hi-Tech PICC 8.05 PL2. The configuration is as follows:
MCU: PIC16F877A
RD0-RD3: LCD DB4-DB7 (LCD in 4-bit mode)
RD5: LCD RS
RD6: LCD R/W
RD7: LCD EN

Fragments of my code:
 
Code:
/* LCD bit definition */
static bit LCD_RS @ ((unsigned) &PORTD * 8 + 5); // Register select
static bit LCD_RW     @ ((unsigned) &PORTD * 8 + 6); // Read / Write
static bit LCD_EN @ ((unsigned) &PORTD * 8 + 7); // Enable


/* MCU init sequence */
TRISD = 0b00010000;  // LCD data port init
DelayMs(100);
PORTD = 0x00;
DelayMs(100);

/* LCD init sequence */
LCD_RW = 0; // write to LCD mode
LCD_EN = 0;
LCD_RS = 0; // write control bytes
DelayMs(30); // power on delay
PORTD = 0x3;  // Write LCD mode
lcd_strobe();
DelayMs(5);
lcd_strobe();
DelayUs(100);
lcd_strobe();
DelayMs(5);
PORTD = 0x2;   // Set 4-bit mode
lcd_strobe();
DelayUs(40);
lcd_write(0x28); // Function Set - 4 bit mode, 1/16 duty, 5x8 font
lcd_write(0x08); // display off
/* Display Control => 00001DCB: D - Display ON/IFF, C - Cursor ON/OFF, B - Blink Cursor ON/OFF */
lcd_write(0b00001100); // display on, blink curson on
lcd_write(0x06); // entry mode
This code is working just fine for me. It should work properly if you change the code to accept port B.
Good luck.
« Last Edit: January 06, 2006, 11:26:38 11:26 by Zaphod Beeblebrox » Logged

Black holes are where the God divided by zero...
Don't panic!
Cortex
Guest
« Reply #2 on: January 06, 2006, 12:06:21 00:06 »

check that you have the RB4 & RB5 as output
regards
Logged
arash
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 2
-Receive: 0


« Reply #3 on: January 06, 2006, 09:06:51 21:06 »

Hi Zaphod Beeblebrox, can you share your full project.
Logged
Zaphod Beeblebrox
Active Member
***
Offline Offline

Posts: 139

Thank You
-Given: 25
-Receive: 89



« Reply #4 on: January 09, 2006, 09:06:53 09:06 »

Sorry pal, the code I gave you is a part of a commercial project I work on. I can't share whole project and to be honest it's a rather large amount of code.

I can help you with your code anyway.
Logged

Black holes are where the God divided by zero...
Don't panic!
BLK
Guest
« Reply #5 on: January 03, 2008, 05:33:24 17:33 »

Hi Arash, put your code to see wath not work
Logged
manuelroin
Guest
« Reply #6 on: January 03, 2008, 05:41:46 17:41 »

put your code to try help u !
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC