CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Need Help for HD44780 Programming with PIC16F876A
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 08, 2007 5:58 pm     Reply with quote

In that case, I suspect a wiring error or some other hardware problem.

Do you know that the PIC works ? Have you ever been able to run
a small program that just blinks an LED ? Here's an example.
This program will blink the LED on pin B0:
Code:

#include <16F876A.H>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

//=========================
void main()
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Mon Jan 08, 2007 6:06 pm     Reply with quote

Thanks very much for your time, effort & patience "PCM programmer" to explain things to me.. Very Happy

I have double-checked my hardware wirings and its correct. I'm not sure if the PIC works as i had only recently began programming with it. Sadly i don't have a multimeter with me now to test the output voltage. Will do so when i hit the laboratory in Uni tomorrow morning. So i've no idea if it works. I'll have a few LEDs. Will try to connect them up tomorrow to determine the problem.

I'll keep u posted as soon as i get the results from your test program and hope u'll check on me again when U hit the office tomorrow. Cheers..


PCM programmer wrote:
In that case, I suspect a wiring error or some other hardware problem.

Do you know that the PIC works ? Have you ever been able to run
a small program that just blinks an LED ? Here's an example.
This program will blink the LED on pin B0:
Code:

#include <16F876A>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

//=========================
void main()
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 08, 2007 6:09 pm     Reply with quote

Remember that you need a resistor in series with the LED on pin B0.
You could use a value such as 330 ohms or 470 ohms.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Mon Jan 08, 2007 6:10 pm     Reply with quote

Tks 4 ur reminder. Sadly, i do study electronics as my core subject.=P

PCM programmer wrote:
Remember that you need a resistor in series with the LED on pin B0.
You could use a value such as 330 ohms or 470 ohms.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

---------> what now????
PostPosted: Tue Jan 09, 2007 6:35 am     Reply with quote

Evil or Very Mad I have used the simple program U mentioned earlier and tested. There is absolutely no output from the Microcontroller at pinB0. Tested it with oscilloscope. Nope. Nothing...Have verified that my LED is working fine. Is there anyway to tell if the microcontroller isn't working?

Will now try and test the LCD using someone else's program.

Latest===========

I've tested the software to alternate the ON & OFF on both PORTS A & B. It looks like as though the program does not execute at all. It seems also that the LEDs attached individually to pin A1 and B0 do not follow the program at all and switches on and off erratically upon powering up and down. A decoupling capacitor has already been added to the PIC.

Please advise.....


PCM programmer wrote:
Remember that you need a resistor in series with the LED on pin B0.
You could use a value such as 330 ohms or 470 ohms.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

Help help
PostPosted: Wed Jan 10, 2007 11:10 am     Reply with quote

Gurus, please advise. I have purchased another PIC but the same problem occurs.

PCM programmer...please help!!!! Sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 12:22 pm     Reply with quote

There are other people that can help besides me. You shouldn't ask
just one person for help.

But anyway, I suspect a hardware problem. Describe all the external
connections to your PIC. Tell us what components you have connected
to the PIC pins and give the value of the components (i.e., a 10K
resistor going to +5v on the MCLR pin, etc.)

Tell us what programmer you're using (CCS ICD-U40, Microchip ICD2,
Warp-13a, etc.)

Tell us the voltage you are using to run the PIC. What type of power
supply are you using ? (Bench supply, or a "wall transfomer, etc.)

Basically, give all the details.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 4:25 pm     Reply with quote

Ok....I am currently doing my own breadboarding. I'm not using any demo set. I'm using my customised power supply (2.8VA). Output power is ~30.1V under no load.

When connected to LM7812, input of LM7812 registers ~19.1V and output of LM7812 registers 10V. Vo of LM7812 is connected to input of LM7805 and output of LM7805 registers ~4.7V. Input of LM7805 has a parallel 0.2uF capacitor connected to it. Other end of capacitor is to Gnd for "Fixed Output VR" mode. When initially measured, voltage will always start from 4.45V and slowly rise to 4.7V.

PIC is drawing power from Vcc line from Pin_20. Note that this voltage is going only to the PIC. There is a decoupling capacitor 1.0uF rated @50V connected in parallel to the PIC.

I'm using a Murata 4.0MHz Ceramic Resonator (CR). I've double-checked the frequency from the ceramic resonator with an oscilloscope and found it to have a frequency of 4.166MHz. One end of CR is connected to OSC1(Pin_9) while the other end of CR is connected to OSC2(Pin_10). The middle pin of CR is connected to Gnd line.

A 6 bus resistor network (1k ohms each) is drawing power from the Vcc line. One of the outputs of the bus resistor network is connected to "MCLR" of PIC (Pin_1). Voltage measured @Pin_1 of PIC is 4.6+V and rising to stop @4.7V

Pins 8 and 19 are connected to Vss (i.e Gnd) line.

******************Note that no LEDs are connected.

PIC: Microchip PIC 16F876A
Hardware Programmer: PICSTART PLUS (firmware version 4.50.2)
Software Programmer: MPLab v7.5
C Compiler: CCS v4.020

Currently, my main source file is as follows:

===================================
#include <16F876A.h>
#include <picsettings.h> //#FUSES NOWDT, HS, PUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
// #use delay(clock=4000000)


void main()
{
delay_ms(2000);
set_tris_b(0xF0); // Configures tris_B registers (RB4-7: input, RB0-3: output)
delay_ms(2000);
set_tris_a(0x2); // Configures tris_A registers(RA1: input, RA0,2,3,4,5: output)
while (1);
{
output_a(0x00);
output_b(0xFF);
delay_ms(2000);
output_a(0xFF);
output_b(0x00);
delay_ms(2000);
}
}
================================
================================

Currently, i am thinking of purchasing a voltage supervisory IC DS1233 that is to be connected to MCLR pin of PIC to ensure that the PIC does not lockup. Am currently awaiting for it to arrive.


Dear friends, please advise. Your help is very much appreciated. Crying or Very sad


PCM programmer wrote:
There are other people that can help besides me. You shouldn't ask
just one person for help.

But anyway, I suspect a hardware problem. Describe all the external
connections to your PIC. Tell us what components you have connected
to the PIC pins and give the value of the components (i.e., a 10K
resistor going to +5v on the MCLR pin, etc.)

Tell us what programmer you're using (CCS ICD-U40, Microchip ICD2,
Warp-13a, etc.)

Tell us the voltage you are using to run the PIC. What type of power
supply are you using ? (Bench supply, or a "wall transfomer, etc.)

Basically, give all the details.


Last edited by kevin5k on Wed Jan 10, 2007 5:13 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 4:44 pm     Reply with quote

Quote:
When initially measured, voltage will always start from 4.45V and slowly rise to 4.7V.


1. The power supply voltage must start at 0 volts (or at least close to 0v)
for the PIC to perform a power-on reset. It looks like your PIC
is never being reset.

Why does your power supply always start at 4.45v ? Do you
have an on/off switch ? Why does the power rise "slowly" ?
Does the power supply have large output capacitors on it ?
Basically, your whole power supply regulation circuit needs to
be improved. You need a supply that cleanly goes from 0 to 5.0v
and that rises quickly, and goes down to 0v when switched off.

2. All of your voltage measurements are not good. Your +12v regulator
is putting out 10v. Your +5v regulator is putting out 4.7v.

What are you using to measure the voltages ? A voltmeter or
an oscilloscope ? You need to get an accurate digital voltmeter.
Ttelmah
Guest







PostPosted: Wed Jan 10, 2007 4:52 pm     Reply with quote

Comments.
You can get rid of all the tris statements, and initialisation delays. In CCS, unless you select 'fast_io' mode, the compiler automatically adds TRIS statements in the output code for you, when you perform I/O.
Are your fuses 'remmed' out?. As posted, they seem to be...
Use 'disable HTML in this post', and the code buttons to post code. Otherwise it dosn't make much sense...
Your rising output voltage on the 7805, is 'abnormal'. Put your scope on the 5v line. Is it stable?. You don't describe any HF decoupling close to the regulator, and these chips can oscillate if this is not present. One symptom, can be a rising (and slightly low) supply line.
You make no mention of a Vdd connection to the chip.
Look at some of the examples. Note the extra initialisation lines to turn off the ADC. Include these.
Why is a 7812, giving 10v?. Same comment about oscillation. Otherwise there i something very abnormal in the load on this. It should be giving 12v, within a very small fraction of a vot.

Best Wshes
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 5:09 pm     Reply with quote

Quote:

Currently, i am thinking of purchasing a voltage supervisory IC DS1233 that is to be connected to MCLR pin of PIC to ensure that the PIC does not lockup.


It does not make sense. It will not contribute at all.
When everything fails, you must try to use the minimum hardware/firmware scheme just to know that the core is alive.
PCM Programmer guide you until the point where you will try to blink a LED, this should be your main concern right now.
I don't like the way you get the +5VDC for the PIC. Borrow any wall transformer with an output voltage close to 12VDC, hook it the 7805 with the input and output capacitors.
Try to replace the Murata resonator by a regular crystal and connect the oscillator capacitors in parallel, do not forget to change the configuration to XS or HS depending of the crystal frequency.
Connect +5V --> +LED- --> R --> PIN B0 and run the PCM Programmer code.

Humberto
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 5:18 pm     Reply with quote

Erm, I've just measured. It's 0V initially. Then when its switched on, it jumps to 4.65V for the Vcc line. This power rises immediately once its switched on. Its using two 1.0uF capacitors as I'm constructing a (+) & (-) PSU.

I'm using a voltmeter to measure.


PCM programmer wrote:
Quote:
When initially measured, voltage will always start from 4.45V and slowly rise to 4.7V.


1. The power supply voltage must start at 0 volts (or at least close to 0v)
for the PIC to perform a power-on reset. It looks like your PIC
is never being reset.

Why does your power supply always start at 4.45v ? Do you
have an on/off switch ? Why does the power rise "slowly" ?
Does the power supply have large output capacitors on it ?
Basically, your whole power supply regulation circuit needs to
be improved. You need a supply that cleanly goes from 0 to 5.0v
and that rises quickly, and goes down to 0v when switched off.

2. All of your voltage measurements are not good. Your +12v regulator
is putting out 10v. Your +5v regulator is putting out 4.7v.

What are you using to measure the voltages ? A voltmeter or
an oscilloscope ? You need to get an accurate digital voltmeter.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 5:29 pm     Reply with quote

Tks 4 the tip. I'll include a few more capacitors to make both Voltage Regulators stable with good transient response.

Erm, would you mind elaborating this "HF decoupling" as well as the "Vdd" line?

I'll decomment those ADC programming codes.

Ttelmah wrote:
Comments.
You can get rid of all the tris statements, and initialisation delays. In CCS, unless you select 'fast_io' mode, the compiler automatically adds TRIS statements in the output code for you, when you perform I/O.
Are your fuses 'remmed' out?. As posted, they seem to be...
Use 'disable HTML in this post', and the code buttons to post code. Otherwise it dosn't make much sense...
Your rising output voltage on the 7805, is 'abnormal'. Put your scope on the 5v line. Is it stable?. You don't describe any HF decoupling close to the regulator, and these chips can oscillate if this is not present. One symptom, can be a rising (and slightly low) supply line.
You make no mention of a Vdd connection to the chip.
Look at some of the examples. Note the extra initialisation lines to turn off the ADC. Include these.
Why is a 7812, giving 10v?. Same comment about oscillation. Otherwise there i something very abnormal in the load on this. It should be giving 12v, within a very small fraction of a vot.

Best Wshes
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 5:54 pm     Reply with quote

HF = high frequency. Polarized capacitors only act like capacitors for low frequencies (< 10's of kHz). You'll need a ceramic capacitor, most often 0.1 uF, placed very near each and every Vdd line on the PIC. Keep leads short.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 10, 2007 6:12 pm     Reply with quote

Roger that.Smile


newguy wrote:
HF = high frequency. Polarized capacitors only act like capacitors for low frequencies (< 10's of kHz). You'll need a ceramic capacitor, most often 0.1 uF, placed very near each and every Vdd line on the PIC. Keep leads short.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group