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.

Starting MPlab and PIC ( Problems)

Status
Not open for further replies.

baby_1

Advanced Member level 1
Advanced Member level 1
Joined
Dec 3, 2010
Messages
415
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
4,277
Hello
how can set up a lcd 16*2 with 4-bit Interface in Mplab?Does it have any library?
Thanks
 

Hi, you can read my **broken link removed** about interfacing 16x2 lcd with pic16f877a and Hi-tech PICC Compiler. This on russian and you can use google translate to reading.
 

if u know 8-bit interfacing lcd with controller then its very similar to that just u need to change the 0x28 insteed of 0x38 mode in lcd commands
try to do it ur own that will help u ....
 

Dear avineshb006@gmail.com
could you explain more how can i do that? if i send this command , how can send the date and what is the procedure?
I work with 18F452 and C is my programming Language
 

baby_1 try mikroC for this. I did the xlcd stuff and it made me mad even though i did everything right. I recommend mikroC if you dont want to make our own functions and if you want good ready made inbuilt functions.
 

Hello
i want to work with Mikroc or MicroBasic but i don't have enough money to buy it... :oops:

i enjoy mplab because its free and can increase knowledge in C programming ( MikroC is also good and have many functions instead of mplab but not free to use)
 

If you are using the Microchip C18 Compiler, simply use the existing libraries:

Reference: MPLAB® C18 C COMPILER LIBRARIES, Section: 3.2 EXTERNAL LCD FUNCTIONS, Page: 65

3.2 EXTERNAL LCD FUNCTIONS

These functions are designed to allow the control of a Hitachi HD44780 LCD controller
using I/O pins from a PIC18 microcontroller. The following functions are provided....

There is also a free application builder for PIC16/18:

**broken link removed**

The Microchip Application Maestro™ Software is a stand-alone software tool to configure and incorporate a range of pre-written firmware modules into your applications. Its heart is a collection of modules developed by Microchip Technology for use with its PICmicro devices. Starting from a graphic interface, select one or more available modules, then configure the parameters listed. When this is complete, the Application Maestro Software generates code that can be incorporated into the application project, using MPLAB® IDE or any compatible development environment.

It is important to note that the Application Maestro Software is not a plug-in or add-on to the MPLAB line of development tools.


Application Maestro Software also differs from other librarian systems because it does more than archive and manage related files for a single software project. Instead, it manages a library of ready-to-configure modules that can be customized to the application, and creates the necessary files for inclusion in the project on demand.

Application Maestro Software is a repository of pre-written software solutions that are optimized for the many peripheral features of Microchip controllers. It is no longer necessary to spend hours digging through code archives or documentation, trying to find the source code for an RS-232 serial communication port or CAN engine, then manually adding it to a new project. Nor do you have to re-invent a block of application code when you can’t find that one elusive archive. With the Application Maestro Software, it’s all in one place.

Features

Currently Maestro has these modules:

I2C Slave for PIC16/PIC18
Simple CAN Bootloader for PIC18
RTC for PIC16 family
10-bit ADC polled for PIC18
10-bit ADC interrupt for PIC18
Can driver with prioritized transmit buffer
I2C Master for PIC16/PIC18
SPIMaster for PIC16/PIC18
USART for PIC16/PIC18
Simple SRAM Dynamic Memory Allocation
EUSART based for PIC18
ECAN routtines for PIC18+ECAN
DeviceNet Group 2 Slave for PIC18
CAN from PIC18Fxx8
LCD C routines for PIC18
LCD routines for PIC16/PIC18

SPISlave for PIC16/PIC18
Oversampling module for PIC16/PIC18


BigDog
 

View attachment library_for_lcd_2x16_2x20_4x16_4x20.zipView attachment lcd commands.doc
Dear avineshb006@gmail.com
could you explain more how can i do that? if i send this command , how can send the date and what is the procedure?
I work with 18F452 and C is my programming Language

Find the attachment, and just check with this code and commands of lcd



Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <p18f4520.h>
#include <delays.h>
 
#define _XTAL_FREQ 10000000
 
//LCD (PortD)
#define  E            LATDbits.LATD6
#define  R_W       LATDbits.LATD5 
#define  RS          LATDbits.LATD4
#define  LCDdata LATD
 
void command(unsigned char);
void write(unsigned char);
void Nybble(unsigned char);
void init(void);
void PutMessage(rom char *);
 
void main()
{
    while(!OSCCONbits.IOFS);      //wait for osc stable
    ADCON1 = 0x0F;                //make RA0 digital
 
    //data direction registers all 0's mean that all pins are set to output
    //all 1's means that all of the pins are set to operate as inputs
    TRISA = 0x00;  
    TRISB = 0x00; 
    TRISD = 0x00;
        init();
        PutMessage("Hello World!");
        command(0xc0);
        PutMessage("WELCOME");
        while(1);
}
 
//Write a string to the LCD
void PutMessage(rom char *Message)
{
    rom char *Pos = Message;
    while(*Pos!=0)
        write(*Pos++);
}
 
/**********************************************************/
//4-bit methods for LCD
/**********************************************************/
void command(unsigned char i)
{
    RS =0;
    R_W =0;          //R/W=LOW : Write
    Nybble(i>>4);    //Send upper 4 bits
    Nybble(i);       //Send lower 4 bits
    Delay1KTCYx(2);  //must wait at least 2mS (2*1000*4/1e6 = 8ms used)
}
 
void write(unsigned char i)
{
    RS =1;
    R_W =0;          //R/W=LOW : Write
    Nybble(i>>4);    //Send upper 4 bits
    Nybble(i);       //Send lower 4 bits
    Delay1KTCYx(2);  //must wait 2mS
}
 
/**********************************************************/
void Nybble(unsigned char dat)
{
    dat &= 0x0f;             //clear top bits of dat
    LCDdata &= 0xf0;         //clear bottom bits of port (interested only in DB7-DB4)
    LCDdata |= dat;          //or the two and store at port
    E = 1;
    Delay1TCY();             //enable pulse width >= 300ns (used 4uS)
    E = 0;                   //Clock enable: falling edge
}
 
/**********************************************************/
void init(void)
{
    LCDdata=0x00; 
    Delay1KTCYx(15);    //Wait >15 msec after power is applied (used 20mS)
    Nybble(0x3);    //command 0x30 = Wake up
    Delay1KTCYx(5);     //must wait 160us, busy flag not available (used 160uS)
    Nybble(0x3);    //command 0x30 = Wake up #2
    Delay1KTCYx(5);     //must wait 160us, busy flag not available (used 160uS) 
 
    command(0x20);      //Function set: 4-bit/2-line
    command(0x2c);      //Function set: 4-bit/2-line
    command(0x10);      //Set cursor
    command(0x01);      //Clear Display (Added)
    command(0x06);      //Entry Mode set
    command(0x0c);
}
/**********************************************************/
//End methods for LCD
/**********************************************************/

 
Last edited by a moderator:
  • Like
Reactions: baby_1

    baby_1

    Points: 2
    Helpful Answer Positive Rating
baby_1 you are so right mikroC is not free but there are ways to get it if u know what i mean.......

MikroC is extremely bad if you want to learn how to make functions on your own but there are methods to get MikroC if you know where to look for.
 
  • Like
Reactions: baby_1

    baby_1

    Points: 2
    Helpful Answer Positive Rating
Thanks linkstatic
the version MicroC that cracked not work properly and have a good header file to load into micro.but i started with mplabx and student version and its free , easy to use and have many section to do all dreams that you want to do with you pic micros.
Thanks for you suggestion
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top