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

Is there any special for PIC12F617?

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



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

Is there any special for PIC12F617?
PostPosted: Thu Mar 03, 2016 9:25 am     Reply with quote

I tested with a small program but did not see any active even I have changed some others new IC.
Suppose that I bought fake one?
My code:
Code:

#include <12F617.h>
#FUSES NOMCLR                   
#FUSES PROTECT
#use delay(internal=4000000)

void main()
{   
   while(TRUE)
   {     
      Output_high(PIN_A2);
      delay_ms(150);
      Output_low(PIN_A2);
      delay_ms(350);     
      Output_high(PIN_A3);
      delay_ms(150);
      Output_low(PIN_A3);
      delay_ms(350);     
   }
}

I use PICKIT3.
Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Thu Mar 03, 2016 9:36 am     Reply with quote

Which pin are you testing?. A3, is _input only_, and is the MCLR line unless you program it otherwise. Chip won't run unless this is pulled high, or you add 'NOMCLR' to the fuses.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 03, 2016 10:34 am     Reply with quote

also

you should never #fuse PROTECT until the FINAL product is 100% tested and 'market ready' !

Jay
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Thu Mar 03, 2016 10:54 pm     Reply with quote

My Simple code:
Code:

#include <12F617.h>
#use delay(internal=4000000)

void main()
{   
   while(TRUE)
   {     
      Output_high(PIN_A0);
      delay_ms(150);
      Output_low(PIN_A0);
      delay_ms(350);     
      Output_high(PIN_A1);
      delay_ms(150);
      Output_low(PIN_A1);
      delay_ms(350);     
      Output_high(PIN_A2);
      delay_ms(150);
      Output_low(PIN_A2);
      delay_ms(350);   
      Output_high(PIN_A4);
      delay_ms(150);
      Output_low(PIN_A4);
      delay_ms(350);     
      Output_high(PIN_A5);
      delay_ms(150);
      Output_low(PIN_A5);
      delay_ms(350);     
   }
}

Any Pin are not work.

Video and photos
https://drive.google.com/file/d/0Bz4V-IpuYR5rNGJMNFNEbE5SWFk/view?usp=sharing
https://drive.google.com/file/d/0Bz4V-IpuYR5rQ09FbndwcXg2a3M/view?usp=sharing
https://drive.google.com/file/d/0Bz4V-IpuYR5rMlVZRmVzLURnck0/view?usp=sharing
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 2:23 am     Reply with quote

As posted, it won't, unless you have a pullup on pin A3.
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 3:26 am     Reply with quote

Ttelmah wrote:
As posted, it won't, unless you have a pullup on pin A3.

Thank you.
I just wonder about the software only.
On the hardware side, I already know how to connect. I have done with many other IC then (for example 12F683).
Pull-up resistor on pin A3: I changed it and combined with the change "NOMCLR" in the code.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 4:34 am     Reply with quote

You have things backwards.

With 'NOMCLR', you don't need the resistor.
Without it you do.

Then you need to ensure everything else on the pins you want to use is turned 'off'. For instance, GP4, will often default to being the CLKOUT pin. So you need the INTRC_IO fuse to tell the compiler to turn this off. Also a lot of chips wake up with the watchdog enabled. It is never going to run if this is the case, so the NOWDT fuse. Also chips with the comparator often need this turned off if you are going to use the comparator pins. so a setup_comparator line to do this. Then just test on A5. If this starts working, then the chip is running, so it then becomes a matter of just testing the other pins. If they don't work, assume you have a compiler version that does not disable things like the analog inputs by default, so manually turn these off.
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 8:39 am     Reply with quote

Thanks for Ttelmah enthusiasm.
I need you to help me a standard configuration (software and hardware) to be able to control any PIN.
You experimental field with 12F617 yet?
I need that.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 9:00 am     Reply with quote

Just tried a chip, and this merrily sits toggling A0:
(with 5.053)
Code:

#include <12F617.h>
#device ADC=10
#fuses NOWDT, INTRC_IO, NOMCLR
#use delay(internal=4000000)

void main()
{
   setup_comparator(NC_NC);
   setup_adc(ADC_OFF);
   setup_adc_ports(NO_ANALOGS);
   while(TRUE)
   {
      output_toggle(PIN_A0);
      delay_ms(100);
   }
}
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 9:57 am     Reply with quote

Ttelmah wrote:
Just tried a chip, and this merrily sits toggling A0:
(with 5.053)
Code:

#include <12F617.h>
#device ADC=10
#fuses NOWDT, INTRC_IO, NOMCLR
#use delay(internal=4000000)

void main()
{
   setup_comparator(NC_NC);
   setup_adc(ADC_OFF);
   setup_adc_ports(NO_ANALOGS);
   while(TRUE)
   {
      output_toggle(PIN_A0);
      delay_ms(100);
   }
}

Thank Ttelmah very much.

The key problem is in "INTRC_IO"
After adding: "#fuses INTRC_IO" everything was operating normally.
#fuses INTRC_IO: What does it mean? In ccs help did no such thing.
Ttelmah



Joined: 11 Mar 2010
Posts: 19497

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 10:16 am     Reply with quote

As I said a couple of posts ago:

"So you need the INTRC_IO fuse to tell the compiler to turn this off".

Without this A4 is left with OSC/4 as an output on it. Shouldn't affect A0 though. Are you sure it is not the NOWDT?. As I pointed out early on, the code won't run if the watchdog is enabled.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 10:30 am     Reply with quote

re:
#fuses INTRC_IO: What does it mean?

It means to program the PIC to use the interal oscillator AND allow the I/O pins normally used with xtal/caps to be used for Input or Output. originally PICs needed 2 I/O pins for the xtal/caps, newer one can use an internal osicillator so those 2 pins are 'free' to be used for other functions. But... not all PICs allow for both pins to used AND some can only be an input or an output so it is very,very important to read the PIC's datasheet that you're using.

You need to take the read the Microchip datasheet for the PIC that you're using. FUSES are a 'low level' function of the PIC, NOT a CCS C code 'feature'. That's probably why it's not in the CCS Help section.

I understand English is difficult to understand ! It's my native language and after 6 decades it can be a problem for me !! I also know reading 400-500 pages of technical stuff is hard, but just take a section at a time, or just one peripheral. It gets better the more you read and all PICs are very similar.

Jay
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 10:36 am     Reply with quote

In the data sheet it is found in section 4.1 and section 4.4
_________________
Google and Forum Search are some of your best tools!!!!
hoa35ktxd



Joined: 23 Nov 2014
Posts: 27
Location: Vietnam

View user's profile Send private message

PostPosted: Fri Mar 04, 2016 10:59 am     Reply with quote

Would like to thank everyone for your interest in my problem.
Please confess: I am not a trained electronics and do not know much about English. I love science and electronics enthusiasts, and only self-learning principle.
What I exchanged here is because of google translate.
Sincerely.
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