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

PIC16F1509 dead

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



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PIC16F1509 dead
PostPosted: Mon May 11, 2020 2:34 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon May 11, 2020 2:44 pm     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Mon May 11, 2020 3:41 pm     Reply with quote

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: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon May 11, 2020 4:06 pm     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Mon May 11, 2020 5:40 pm     Reply with quote

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: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon May 11, 2020 6:17 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon May 11, 2020 6:29 pm     Reply with quote

There's a copy of fuses.txt here:
http://www.datadynamics.co.jp/ccscc/faq/Fuses.txt

Save it in a safe place on your PC.
rovtech



Joined: 24 Sep 2006
Posts: 262

View user's profile Send private message AIM Address

PostPosted: Mon May 11, 2020 6:51 pm     Reply with quote

Thanks everyone. Greatly appreciated.
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