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

Mon Oct 22 2018, 09:34 AM
JIMI吴
首席阿里巴巴zzzzzzzzzz
Mon Oct 22 2018, 08:58 AM
Sylvia
For a limited time we have lowered the rate on targeted website traffic. We have visitors from virtually every country on Earth. Each visitor is targeted by both country and keywords that you submit when you start your free trial period. If you need more visitors or product sales try our service free for seven days and we will send you 500 free visitors during the trial. There are no contracts and if you cancel during the trial period you will not be charged anything! Start your trial today: http://s.miku.moe/jbpuz
Mon Oct 22 2018, 05:37 AM
Iris Spain
aaa快乐是大家的aaa
ExperimenterUK
Sat Sep 29 2018, 06:28 PM
Please post questions in the forum.
Sat Sep 29 2018, 11:26 AM
Ashfaq Ch
hi i have some AT89C51RC microcontrollers already programed. some one help us to how to download from AT89C51RC and after study and edit all corractions reload to AT89C51RC controller
shshistiem
Wed Sep 12 2018, 10:58 PM
hii!! some1 please let me know how i ll get rfid code to 8051 by WEIGAND mode
DrNossberg
Tue Sep 11 2018, 08:09 PM
is there anyone here?
Mon Aug 27 2018, 07:30 AM
bun
Hello everyone!
Sat Jul 21 2018, 06:21 AM
Dibakar Bhanja Chowdhury
By using a 555 timer how can I expand the range of the mobile phone jammer? Please reply me asap
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?

Downloads

Comments

PCBindex
Fri Sep 14 2018, 02:45 AM
sirkit
Thu Sep 13 2018, 04:46 AM
shshistiem
Wed Sep 12 2018, 10:36 PM
DrNossberg
Tue Sep 11 2018, 03:25 PM
ranjanvh
Thu Sep 06 2018, 02:28 PM
rbbhamre
Tue Sep 04 2018, 06:15 PM
Tressie
Sun Sep 02 2018, 02:20 PM
Sudhansudeep
Fri Aug 31 2018, 08:26 AM

Online

Guests: 56, Members: 0 ...

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

Members: 38006
Newest member: PCBindex
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Sep 13 2018, 08:39 PM
First of all, by reading your reply, I abandoned m...
DrNossberg Avatar
Posted By DrNossberg
Thu Sep 13 2018, 03:49 PM
Hi, thanks you for your reply ^^ First of all, by ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Sep 12 2018, 12:12 AM
HiThere are several issues here.The original 8051 ...
DrNossberg Avatar
Posted By DrNossberg
Tue Sep 11 2018, 08:08 PM
Hello everybody!First of all let me explain some s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Sep 07 2018, 05:08 AM
The compiler thinks the micro doesn't have enough...
Sudhansudeep Avatar
Posted By Sudhansudeep
Fri Sep 07 2018, 02:59 AM
this is the build output message
Sudhansudeep Avatar
Posted By Sudhansudeep
Fri Sep 07 2018, 01:38 AM
Change the mobile number as [number removed] in t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Sep 06 2018, 08:56 PM
I don't know what the problem is, I get no errors....
Sudhansudeep Avatar
Posted By Sudhansudeep
Thu Sep 06 2018, 01:12 PM
the code is Attachment ...
Sudhansudeep Avatar
Posted By Sudhansudeep
Thu Sep 06 2018, 12:48 PM
the code is same as u sent me for 16 chars