View previous topic :: View next topic |
Author |
Message |
rovtech
Joined: 24 Sep 2006 Posts: 262
|
PIC16F1509 dead |
Posted: Mon May 11, 2020 2:34 pm |
|
|
I have stripped my software down to the bare minimum and still this PIC won't change voltages on any pins. I even replaced the PIC. It programs OK with one warning of the enless loop. I'm using a 'scope to look at the pin. Yes I have tried other pins and the PIC has power and ground. Three other PICs in the same system work fine and can be modified so there is nothing wrong with my methods.
CCS PCM 5.064 using MPLAB and ICD3
Am I missing something in this simple program? My next step is to breadboard the PIC. It is on a new and untested PCB which is simple and I have checked but I want to eliminate the software first. I'm suspicious of the clock setting. I can't believe it doesn't work.
Code: | /* Pre-processor directives */
#include <16F1509.H>
#fuses RC, NOWDT, PUT, NOPROTECT
#use delay (clock=8MHZ) // osc default 8 MHz
/* The main function */
void main(void)
{
// initialize port directions
set_tris_a (0x00);
set_tris_b (0x00);
set_tris_c (0x00);
// main loop
while (1) // endless loop
{
output_toggle (PIN_B7);
delay_us(5);
} // end of endless while loop
} // end of main function
// end |
|
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Mon May 11, 2020 2:44 pm |
|
|
You have it set up to use an external RC oscillator. What resistor and capacitor do you have connected for the oscillator? |
|
|
rovtech
Joined: 24 Sep 2006 Posts: 262
|
|
Posted: Mon May 11, 2020 3:41 pm |
|
|
Thank you. I knew it was something stupid.
I had INTRC before which I use on other PICs but the 1509 does not compile that so I changed it to RC after a quick look at the .h file.
I did not realize that meant ext RC.
I changed it to INTRC_IO and now it works. What is the significance of the IO?
I'm guessing it means the OSC pins can be used as I/O but it would be nice to not have to guess. Where can I look that up? I don't see it in the manual or the .h file. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Mon May 11, 2020 4:06 pm |
|
|
general comments...
re: Fuses
In the compiler 'folder' there should be a file called 'fuses.txt' that lists/comments what all the fuses are for all PICs ( well, more or less.....)
re: _IO
for some PICs... the _IO means that the 1 or 2 pins that the external Xtal/caps usually go to, are now available for Input and/or Output. You have to read the datasheet for your PIC to see what they can be used for. |
|
|
rovtech
Joined: 24 Sep 2006 Posts: 262
|
|
Posted: Mon May 11, 2020 5:40 pm |
|
|
I cannot find that folder. There is a readme.txt in Program Files(x86)>PICC but it says very little about fuses.
I looked in the data sheet for the PIC and only see EXTRC and INTOSC listed which are not in the .h file and I'm sure will not compile.
When INTRC did not work I looked up an old project from 2014 and saw I had used RC so used it without looking at the schematic which has 220pF and 55K on the CLKIN pin. Now it makes sense.
Edit: apparently it does not come with PCM compiler. I see a lot of enquiries on the CCS site about this. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Mon May 11, 2020 6:17 pm |
|
|
You may be able to ask CCS for a copy of the fuses.txt file.As long as you own a copy of a compiler, they should be fine sending it to you.
Just remember ONLY fuses in the PIC device.header file are applciable to that PIC. The compiler WILL probably tell you if you try to use an 'unknown' fuse.
Also remember that all 'RC' type oscillator clocks(internal and external) are not accurate and will vary over time and temperature. Newer PICs have better internal clocks but for bang on timing, and external xtal/caps or clk osc is best.
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
rovtech
Joined: 24 Sep 2006 Posts: 262
|
|
Posted: Mon May 11, 2020 6:51 pm |
|
|
Thanks everyone. Greatly appreciated. |
|
|
|