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 for rf12F675H

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







Help for rf12F675H
PostPosted: Tue Oct 12, 2004 11:47 pm     Reply with quote

Hi all
I have wroten this Code for the rf12F675H . But nothing happens.

Code:



#include "12f675.h"
#case
#use delay(clock=4000000)
#fuses hs,noprotect,nobrownout,put,nowdt




void main()
{





   while(1)
   {

      output_high(PIN_A0);
      output_high(PIN_A1);
      output_high(PIN_A2);
      output_high(PIN_A3);
      output_high(PIN_A4);
      output_high(PIN_A5);
         delay_ms(500);


      output_low(PIN_A0);
      output_low(PIN_A1);
      output_low(PIN_A2);
      output_low(PIN_A3);
      output_low(PIN_A4);
      output_low(PIN_A5);

         delay_ms(500);


   }

}



Do someone see an Error ???

Ikague
Guest








PostPosted: Wed Oct 13, 2004 12:57 am     Reply with quote

Hi
I forgot. I use the internal oscillator.
kypec



Joined: 20 Sep 2003
Posts: 54

View user's profile Send private message

PostPosted: Wed Oct 13, 2004 1:29 am     Reply with quote

I'm not sure whether the compiler configures
all the port pins which share the A/D feature
automatically as DIGITAL I/O or not.
I wouldn't rely on it and better have done it
myself:
Code:
setup_adc_ports(NO_ANALOGS)


Same applies to Analog comparators:
Code:
setup_comparators(NC_NC_NC_NC)


For further details please look in your
PICC\Devices\12F675.h header file
dvsoft



Joined: 28 Nov 2003
Posts: 46

View user's profile Send private message

PostPosted: Wed Oct 13, 2004 2:08 am     Reply with quote

bonjour,

Code:

#include <12F675H.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,INTRC, NOCPD, NOPROTECT, MCLR, NOPUT, BROWNOUT


   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);



try this code setup

Alain
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

PostPosted: Wed Oct 13, 2004 1:21 pm     Reply with quote

Ikague,

You are currently using this:
Quote:
#include "12f675.h"
#case
#use delay(clock=4000000)
#fuses hs,noprotect,nobrownout,put,nowdt

You want to change it to this (so you use the internal oscillator):
Code:
#include "12f675.h"
#device ADC=10
#case
#use delay(clock=4000000)
#fuses intrc_io,noprotect,nobrownout,put,nowdt,nocpd,nomclr

The #fuses command is the source of your problems. You did not define the intrc_io (enables internal oscillator, and IO function on GP4 and GP5), you used hs instead (for external high-speed oscillator). You also did not define nomclr to free GP3 (for input only)

Disable comparators and ADC function (as suggested previously):
Code:
setup_comparator( NC_NC_NC_NC );   // disable comparators
setup_adc_ports( NO_ANALOGS );   // disable analog inputs
setup_adc( ADC_OFF );         // disable A2D

And eliminate:
Quote:
output_high(PIN_A3);
and
Quote:
output_low(PIN_A3);
since you can only use this pin as an input.

Hope this helps.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 13, 2004 1:37 pm     Reply with quote

Code:
setup_comparator( NC_NC_NC_NC );   // disable comparators
setup_adc_ports( NO_ANALOGS );   // disable analog inputs
setup_adc( ADC_OFF );         // disable A2D


I think you are using PCM vs. 3.099. If so, the functions shown
above do not work properly for the 12F675.

To fix the problem, you need to directly set the register values
for the comparators and the ADC. Look at the highlighted lines
in following link. You need to add those six lines of code to your
program, in the same positions as shown in this link.
http://www.ccsinfo.com/forum/viewtopic.php?t=2808&highlight=cmcon+adcon0+ansel
ikague
Guest







It works!!!!!
PostPosted: Wed Oct 13, 2004 9:48 pm     Reply with quote

Thanks All. It works now !!!!!!! Very Happy
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