jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
while(1)
PORTD = ~PORTD;
Delay_ms(1000);
while(1)
{
PORTD = ~PORTD;
Delay_ms(1000);
}
If you still have the regulator (I can't see it in the second photograph) connect a 10uF capacitor across it's input pin and ground pin and connect a 100nF capacitor between it's output pin and ground pin. These must be close to the regulator, keep the wiring as short as you can.
Also connect 100nf across pins 11 and 12 and another across pins 31 and 32. Mount them close to the PIC and with short wires.
These capacitors are important. They are there to provide a clean supply to the PIC which is especially important when you are using that type of construction. If you leave them off, you may get no operation or random operation dependng on how bad the signals across the supply lines and oscillator components become.
Brian.
pin 1 give 5v and the vdd on the lcd give 1.5
the vdd on the pic give 5v
sbit LCD_EN at RB0_bit;
sbit LCD_RS at RB1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_EN_Direction at TRISB0_bit;
sbit LCD_RS_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
void main() {
TRISB = 0x00;
TRISD = 0x00;
PORTB = 0x00;
PORTD = 0x00;
LCD_Init();
LCD_Cmd(_LCD_CLEAR);
LCD_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"LCD 4-bit");
while(1)
{
PORTD = ~PORTD;
Delay_ms(1000);
} }
how do i use the decoupling capacitorsProblem 1: If the battery is a good one, you have killed the PIC and LCD. They are designed to run on no more than 5V but you have connected then directly to 9V.
Your construction is horrible but as far as I can tell from the photograph, it is electrically wired correctly except for the decoupling capacitors. I do not use your compiler but the code looks OK. Assuming the PIC and LCD have survived the supply voltage, the missing link to check is the configuration bits in the PIC. The compiler is setting them correctly but is your programmer actually loading them into the PIC? Some programmer units ignore the fuse settings or they have to be entered manually. Please try READING the PIC back into the programmer and looking at the fuses to see if they match the ones the compiler produced.
I assure you these things do work. I have a PIC running two 4 line LCDs at the same time in front of me at the moment!
Brian.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?