[PIC] Vehicle Monitoring System with GPS and GSM - PIC18F46k22

Status
Not open for further replies.

blackpearl87

Newbie level 5
Joined
Jun 8, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
91
I'm doing a project using Picdem 2 Plus 2010 demo board to simulate a vehicle theft and accident alerting system. GPS receiver and GSM modem are being used to locate the vehicle and send a SMS to pre-determined mobile number. I'm using PIC18F46K22 micro-controller for this project.

the LCD on board is a 4-bit mode. DB4-DB7 pins of the LCD are connected to D0-D3 pins of pic controller. RS, RW, EN and PWR pins are respectively connected to D4-D7. I developed the below code, but I still can't get anything displayed on LCD.

Could anyone please highlight me what's wrong with this code?


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
95
96
97
98
99
100
101
102
#include <p18f46k22.h>
#include <delays.h>
 
#define LCD_DATA PORTD
#define LCD_RS PORTDbits.RD4
#define LCD_RW PORTDbits.RD5
#define LCD_EN PORTDbits.RD6
#define LCD_PWR PORTDbits.RD7
 
 
void Init_LCD(void);
void disCmd(unsigned char);
void disData(unsigned char);
void lcdCmd(unsigned char);
void lcdData(unsigned char);
void LCD_STROBE(void);
void string(char);
 
void main()
{
    ADCON1 = 0x0f;
    OSCCON = 0x36;
    TRISD = 0;
 
    Init_LCD();
 
    disCmd(0x80);
    string("HELLO WORLD");
    disCmd(0xc0);
    string("IT IS WORKING:-)");
 
}
 
 
//****************************************************************************************************
/* LCD display initialization */
void Init_LCD()                     
{
    disCmd(0x02);
    disCmd(0x82);
    disCmd(0x60);
    disCmd(0xc0);
    disCmd(0x80);
    disCmd(0x30);
    disCmd(0x10);
}
 
 
void LCD_STROBE(void)
{
    LCD_EN = 1;
    Delay1KTCYx(0.001);
    LCD_EN = 0;
}
 
 
void string(char q)
{
    while(q)
        disData(q++);
}
 
void disCmd(unsigned char cmdValue)
{
    unsigned char cmdValue1;
    cmdValue1 = PORTD;
    cmdValue1 &= 0xf0;
    cmdValue1 = cmdValue1 | (cmdValue & 0x0f);
    lcdCmd(cmdValue1);
}
 
 
void disData(unsigned char dataValue)
{
    unsigned char dataValue1;
    dataValue1 = PORTD;
    dataValue1 &= 0xf0;
    dataValue1 = dataValue1 | (dataValue & 0x0f);
    lcdData(dataValue1);
} 
 
 
void lcdCmd(unsigned char cmdOut)
{
    LCD_RS = 1;
    LCD_RW = 0;
    LCD_DATA = (cmdOut >> 4);
    LCD_STROBE();
    LCD_DATA = cmdOut;
    LCD_STROBE();
}
 
 
void lcdData(unsigned char dataOut)
{
    LCD_RS = 1;
    LCD_RW = 0;
    LCD_DATA = (dataOut >> 4);
    LCD_STROBE();
    LCD_DATA = dataOut;
    LCD_STROBE();
}

 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…