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

help please it is urgent
Goto page Previous  1, 2, 3
 
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: Wed Aug 17, 2016 8:04 am     Reply with quote

Your photo of the breadboard circuit, shows a few problems.
http://i.hizliresim.com/zn23Jj.jpg

1. You have a 9v battery connected directly to the PIC power pins.
This violates the maximum ratings, which is +7.5v on the Vdd pin.
Is the battery really at 9 volts ? Did you check it with a voltmeter ?

2. The 9v battery is connected to PIC pins 32 and 31, which are Vdd and
ground. But the PIC also has Vdd and Gnd on pins 11 and 12.
These pins are not connected to anything, and that's wrong.

3. You should connect the 9v battery to the 7805 regulator, and let it
regulate the voltage down to +5v. Connect +5v to the red stripe bus
on your breadboard. Connect ground to the blue strip bus. Then all
other connections in the circuit that need +5v or Ground will be connected
to the red or blue bus strips. That's how a breadboard is supposed to
be used.

4. The 7805 regulator needs input and output capacitors on it.
For the output, use a 10 uF, 16v tantalum capacitor. For the input,
since you want to use 18v, you should probably use 10uF or more, at 50v
with an aluminum electrolytic capacitor.

5. You are missing bypass capacitors (100 nf ceramic) on each of the
pairs of power/ground pins. The PIC will often behave erratically if
these capacitors are missing.

6. I am not sure what PIC you are using. Your code says 16F877, but
your schematic says 16F877A. I can't tell from the photo. But a
16F877A is especially sensitive to missing bypass capacitors on the power
and ground pins.
erendogan83



Joined: 12 Aug 2016
Posts: 13

View user's profile Send private message

PostPosted: Wed Aug 24, 2016 6:27 am     Reply with quote

hi my fellow friends

I am sorry for late answer

I was very busy at work

here is a amateur drawing of my circuit in paint Smile

http://i.hizliresim.com/gXA0dO.jpg

I know it looks ridicilous Smile

problem is my circuit working fine in proteus but not in reality :(

moreover I added capacitors to my circuit as advised but no action

any advise? any mistake?

that is latest code used in pic16f877a
Code:

#include <16f877.h>     
#device ADC=10
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock=4000000)

#use fast_io(a)
#use fast_io(b)
#use fast_io(d)

#define use_portb_lcd TRUE
#define DEG_TO_MV(x) (x)*10

#include <lcd.c>

int16 sensor,temp;

#INT_TIMER0
void  TIMER0_isr(void)
{
   if (temp>340)
   output_high(pin_d1);
   else
   output_low(pin_d1);
}

void main ( )
{
   setup_psp(PSP_DISABLED);       
   setup_timer_2(T2_DISABLED,0,1);
   setup_CCP1(CCP_OFF);           
   setup_CCP2(CCP_OFF);           
   set_tris_a(0x01); 
   set_tris_d(0x00);
   output_d(0x00);
   setup_TIMER_0(RTCC_INTERNAL |RTCC_DIV_4);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);
   setup_adc(adc_clock_div_32);   
   setup_adc_ports(AN0);
   lcd_init();   
   set_adc_channel(0);   
   delay_us(20);         
   printf(lcd_putc,"\fSicaklik=");
   while(TRUE)   
   {
      sensor=read_adc(); 
      temp=(sensor*39)/8;   //This gives integer 0 to 5000 for 0 to 5v.
      //_efficiently_.
      disable_interrupts(GLOBAL);
      enable_interrupts(GLOBAL);
      lcd_gotoxy(10,1);
      printf(lcd_putc,"%5.1LW'C",(temp+20));
      delay_ms(100);
   }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19588

View user's profile Send private message

PostPosted: Wed Aug 24, 2016 8:30 am     Reply with quote

Several things straight away:

Capacitors, capacitors, capacitors.....

The 78xx regulators _require_ capacitors on their input and output, or they will oscillate. Read the data sheet on these. Capacitor on the input 0.33uF minimum, on the output 0.1uF minimum.

The PIC requires decoupling. 0.1uF adjacent to each pair of supply legs. LCD the same.

Then pin36 driving straight into the base of a transistor, wired as common emitter. Result this pin will be massively overloaded, as it tries to pull the pin up. Could easily blow the PIC and/or the transistor (though both are fairly rugged). You need something to limit the current.

Then they generally do not recommend connecting the Ve on the LCD directly to a pot connected between 0v and 5v. This can destroy the LCD if the pot is turned too far towards 5v. Normally the recommended circuit will have a resistor to limit how far the voltage can go.

These are all classic examples of why you will have people here all telling you to ignore Proteus. Problem is that they are basic electronic errors that Proteus will happily accept.....
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
Page 3 of 3

 
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