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

PIC16F716 LED Blink not work.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mmc01



Joined: 16 Jun 2010
Posts: 31

View user's profile Send private message

PIC16F716 LED Blink not work.
PostPosted: Mon Aug 25, 2014 2:40 am     Reply with quote

I try to make easy LED blink with PIC but LED not blink. First I use XTAL 25MHz and it not work so I change to 16MHz It's not work Now I use 4Mhz but it's not work too.
I use 16F72 and I think it lose So I change to 16F648 but LED not blink Now I use 16F716 it's not blink too .
Pin MCLR/VPP I connect with R1k to 5V but It's not work so I pull out R and connect direct to 5V it's not work. Now I connect with R4.7 to 5V it also not work. I think my PIC not lose I can wite ,read and erase program from my PIC. I measure output pin A1 it alway 1V and not blink. I don't know why LED not blink.

Code:
#include <16F716.h>
#use delay(clock=4000000)
#fuses XT,BROWNOUT,NOWDT,NOPROTECT

void main()
{
while(1){
 output_high(PIN_A1);
 delay_ms(500);
  output_low(PIN_A1);
 delay_ms(500);
}




Last edited by mmc01 on Tue Aug 26, 2014 1:37 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19554

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 2:54 am     Reply with quote

Of course it won't.....

Look at your 'design'. Remember the little groups of six pins on each leg of the IC are all connected together. You have the two clock pins, connecting to the crystal (good), but then connecting to both legs of the capacitors, and to ground. Duh. The oscillator is shorted out, so has no hope of working....

Test with a voltmeter. Pins 15 and 16 of the chip are both shorted to ground.
mmc01



Joined: 16 Jun 2010
Posts: 31

View user's profile Send private message

PostPosted: Wed Aug 27, 2014 3:06 am     Reply with quote

I measure pin 15, 16 it's 0.01 mV . I don't know why LED not blink. May be 16F716 not use MCLR . How to use 16F716 LED blink
alan



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

PostPosted: Wed Aug 27, 2014 4:15 am     Reply with quote

Reread Ttelmah's comment. So what you measure are correct. Your pins are shorted to ground. Remove the short and it might start working.

Regards
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 27, 2014 11:48 am     Reply with quote

This photo shows the correct wiring for the crystal circuit:
http://www.voti.nl/blink/pics/bb-870-big.jpg
Note how each 22pf capacitor is connected to a crystal pin and the
other lead jumps over to connect to the ground rail (which is the blue line).
The black wire is a ground wire. It's not part of the crystal circuit.

The key thing to understand is that on the breadboard, each vertical strip
of 5 holes is connected together internally.


Here is a more spread-out way of doing the crystal circuit:
http://nevcx.files.wordpress.com/2013/08/arduinoisp02_bb2.png
It's a different microcontroller, but the idea is the same.
Notice how each oscillator pin on the microcontroller goes over to
the crystal. One side of each capacitor goes to the crystal, and the
other side of the cap goes to ground. This spread-out crystal layout
is not ideal, but it probably will still work. If you cut your two capacitor
leads too short and you don't have more caps, then you may have to
do it this way.
mmc01



Joined: 16 Jun 2010
Posts: 31

View user's profile Send private message

PostPosted: Wed Aug 27, 2014 8:34 pm     Reply with quote

Thank you very much.
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 8:00 am     Reply with quote

I do same thing but still does not work.
This my code
Code:

#include <16F716.h>
#FUSES NOWDT, NOBROWNOUT, NOPROTECT
#use delay(Crystal=4000000)
#Define IN1 PIN_B0
#Define IN2 PIN_B1
#Define OUT1 PIN_A0
#Define OUT2 PIN_A1

   VOID main ()
   {
      port_B_pullups (0xFF) ;
      WHILE (TRUE)
      {
         IF (!input (IN1))
         {
            Output_high (OUT1);
            Output_low (OUT2);
         }
         IF (!input (IN2))
         {
            Output_high (OUT2);
            Output_low (OUT1);
         }
      }
   }

When press down button (IN1), the LED ON (OUT1).
When press Up button(IN1), the LED OFF (OUT1).
Why that?

If true:
Press button (IN1), the LED (OUT1) is ON and LED (OUT2) is OFF.
Press button (IN2), the LED (OUT1) is OFF and LED (OUT2) is ON.
Ttelmah



Joined: 11 Mar 2010
Posts: 19554

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 8:24 am     Reply with quote

What is on pin4 of your chip?....
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 8:35 am     Reply with quote

Hi,

It sure looks like the anodes (+) of your LEDs are connected to the GND rail? The cathode (-) connection of the LED is adjacent to the 'flat' spot on the package, and this pin needs to be connected to GND. If mis-wired, your LEDs are never going to light!

Forget the switches for a moment. Can you make an LED blink at a predictable rate, say 1 sec. On and 1 sec. Off??

When you do get around to testing your switches, it's customary to use a pull-up on the input pin, with the switch momentarily connecting the input to GND. Alternately, you can use a pull-down on the input pin, with the switch momentarily connecting the input to Vcc.

John
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 8:53 am     Reply with quote

Ttelmah wrote:
What is on pin4 of your chip?....

Pin4 not connect.
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 9:09 am     Reply with quote

ezflyr wrote:
Hi,

It sure looks like the anodes (+) of your LEDs are connected to the GND rail? The cathode (-) connection of the LED is adjacent to the 'flat' spot on the package, and this pin needs to be connected to GND. If mis-wired, your LEDs are never going to light!

All LED are light, but they are off when button is open.

ezflyr wrote:

Forget the switches for a moment. Can you make an LED blink at a predictable rate, say 1 sec. On and 1 sec. Off??

I'm try
Code:

#include <16F716.h>
#FUSES NOWDT, NOBROWNOUT, NOPROTECT
#use delay(Crystal=4000000)

   VOID main ()
   {
      WHILE (TRUE)
      {
         Output_high (PIN_A0);
      delay_ms (1000);
      Output_low (PIN_A0);
      delay_ms (1000);
      }
   }

It not work.
ezflyr wrote:

When you do get around to testing your switches, it's customary to use a pull-up on the input pin, with the switch momentarily connecting the input to GND. Alternately, you can use a pull-down on the input pin, with the switch momentarily connecting the input to Vcc.
John

Set Pull_Ups then connect to GND same Set Pull_Down then connect to VCC. It not work.
Sorry, I'm not fluent in english. (google help me)
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Mon Nov 24, 2014 9:14 am     Reply with quote

Ttelmah wrote:
What is on pin4 of your chip?....

Wow, thank you very much.
Connect Pin4 to VCC with 10k. OK.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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