Discussion in "Project Doubts" started by    hareeshchamiyar    Mar 29, 2018.
Thu Mar 29 2018, 08:21 AM
#1
i am trying to make program for lcd interfacing with dspic30f2010 in 4 bit mode.i wrote the c program.and i successfully compiled with mplab xc16.but i didn't out put in bread board.
here is my program

#include "p30f2010.h"
#include "libpic30.h"
#include"xc.h"
#include"LCD Display.h"
_FOSC( CSW_FSCM_OFF & XT_PLL4);
_FWDT(WDT_OFF );
_FBORPOR(PBOR_ON & BORV_27 );
_FGS(CODE_PROT_OFF);

#define lcd LATC,LATD,LATF,LATE
#define FCY 5000000UL // =FOSC/4
#define rs LATFbits.LATF2
#define en LATFbits.LATF3
#define DB4 LATEbits.LATE8
#define DB5 LATDbits.LATD0
#define DB6 LATCbits.LATC14
#define DB7 LATCbits.LATC13


void lcd_init(void);
void toggle();
void lcd_cmd_hf(char v1);
void lcd_cmd(char v2);
void lcd_dwr(char v3);
void lcd_msg(char *c);
void delay(int ms);

int main(void)
{
lcd_init();

lcd_cmd(0x01); // Clear screen

delay(10);

lcd_cmd(0x80); // Initially at first line

lcd_msg("hello");

while(1==1);

}
void toggle()
{
LATFbits.LATF3 = 1;
delay(10);
LATFbits.LATF3 = 0;
}
void lcd_cmd_hf(char v1)
{
LATFbits.LATF2=0;
lcd &=0x0F;
lcd |=(v1&0xF0);
toggle();

}
void lcd_cmd(char v2)
{
LATFbits.LATF2=1;
lcd&=0x0F;
lcd |=(v2&0XF0);
toggle();
lcd &=0x0F;
lcd |=((v2&0x0F)<<4);
}
void lcd_dwr(char v3)
{
LATFbits.LATF2=1;
lcd &=0x0F;
lcd |=(v3&0xF0);
toggle();

lcd &=0x0f;
lcd |=((v3&0x0F)>>4);
toggle();
}
void lcd_init()
{
TRISC=0;
TRISB=0;
TRISF=0;
TRISE=0;
TRISD=0;
delay(20);
lcd_cmd_hf(0x20);//4 BIT LINE 1
delay(10);
lcd_cmd(0x20);//4 BIT LINE 1
delay(1);
lcd_cmd(0x0c);//DISPLAY ON CURSOR OFF
delay(1);
lcd_cmd(0x01);//CLEAR DISPLAY
delay(1);
lcd_cmd(0x06);//DISPLAY ON
delay(1);
lcd_cmd(0x80);//
delay(1);
}
void delay(int ms)
{
int i,j;
for(i=1;i<=32767;i++);
for(j=1;j<=32767;j++);
}
void lcd_msg(char *c)
{
while(*c !=0);
lcd_dwr(*c++);
}

somebody please help me.
thanks


[img] Schematic_TEST_Sheet-1_20180329182820.jpg [img]


[ Edited Thu Mar 29 2018, 01:12 PM ]
Thu Mar 29 2018, 08:24 PM
#2
Schematic_TEST_Sheet-1_20180329182820.jpg did not upload.
Try zipping and attaching.

Have you got a basic flashing LED test working ?


[ Edited Thu Mar 29 2018, 08:29 PM ]
Fri Mar 30 2018, 06:31 AM
#3
THANKS FOR U R REPLAY .IF U HAVE THE PROGRAM FOR LED INTERFACING WITH DSPIC30F2010.PLEASE FORWARD ME.
THANKS.
Sat Mar 31 2018, 12:03 AM
#4
I think this is what you need to get an understanding of the setup.

https://singularengineer.com/dspicpic24-configuration-bits-and-oscillator-settingsusing-xc16-and-mplab-x/


[ Edited Sat Mar 31 2018, 12:04 AM ]

Get Social

Information

Powered by e107 Forum System

Conversation

Sun May 20 2018, 10:01 AM
justinb
how to write and execute a program that read the keypad button and display the number on 7 segment on intel8051 at89s52 in assembly language?
Thu May 17 2018, 06:36 AM
HAMZA TAJ
sir iwant to ask about controller of three phase supply by using back to back thyristor instead of triac....will u give me some guideline?
Sat Apr 28 2018, 12:54 PM
ashutosh jain
IR Remote Switch using TV remote (RC5 Protocol) is not working properly. opp1 & opp2 is in problem.plz help
ExperimenterUK
Fri Apr 27 2018, 08:09 PM
@kaiserslautern Post in forum
Wed Apr 25 2018, 07:09 AM
kaiserslautern
Hello everyone, using software uart is a very good idea for a second serial port. Thank you so much. I would kindly like to know how to connect this port to the PC?
ExperimenterUK
Sat Apr 21 2018, 07:50 PM
This is a community site. Feel free to help anyone needing advice
hareeshchamiyar
Thu Mar 29 2018, 10:47 AM
please help me for the configuration bits for dspic30f2010
hareeshchamiyar
Thu Mar 29 2018, 10:45 AM
can any one using dspic30f2010.
Thu Mar 29 2018, 06:03 AM
Neena
can anybody give solar tracking in 8051 using proteus and keil to mail [email protected]
ExperimenterUK
Mon Mar 19 2018, 07:33 PM
sorry bedo.. maybe next time

Downloads

Comments

bdmehta
Tue May 22 2018, 02:30 AM
kmag1953
Sun Apr 29 2018, 07:09 PM
udiwonder
Sat Apr 28 2018, 12:41 PM
pirpiri
Sat Apr 21 2018, 03:35 PM
Pater
Fri Apr 20 2018, 02:38 PM
jamiel
Sat Apr 14 2018, 12:47 AM
akrepkral76
Wed Apr 04 2018, 07:51 PM
samanthaeaves
Mon Apr 02 2018, 06:27 AM

Online

Guests: 67, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37998
Newest member: bdmehta
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jun 16 2018, 11:33 PM
hi sir sorry for the late reply sir can we control...
LAMBO Avatar
Posted By LAMBO
Sat Jun 16 2018, 07:15 AM
hi sir sorry for the late reply sir can we control...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon May 14 2018, 10:17 PM
So the main problem is that I am not getting Analo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon May 14 2018, 09:40 PM
Hi sir after checking all the connection i...
Pater Avatar
Posted By Pater
Mon May 14 2018, 05:36 PM
Basically my project is based on Data Acquisition ...
LAMBO Avatar
Posted By LAMBO
Sun May 13 2018, 02:13 PM
Hi sir after checking all the connection i...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon May 07 2018, 07:27 PM
This design should be fine.Choose a frequency betw...
Pater Avatar
Posted By Pater
Mon May 07 2018, 01:28 PM
Sorry for late reply as exams were on,Based on my ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu May 03 2018, 03:32 PM
If the circuit works with a light bulb, the probl...
LAMBO Avatar
Posted By LAMBO
Thu May 03 2018, 08:04 AM
Hi sir as u mentioned above everthing is working...