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 support@ccsinfo.com

SETUP_COUNTERS() with RTCC_INTERNAL??

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



Joined: 08 Dec 2005
Posts: 5

View user's profile Send private message

SETUP_COUNTERS() with RTCC_INTERNAL??
PostPosted: Thu Dec 08, 2005 3:19 pm     Reply with quote

Hello,
I have been looking around for a similar project so I wouldn't have to put another one in the fourm but everyones project are different in some way usually just different MCU. But shouldn't some things work exactly on every MCU!?
Well, to get to the point. I have a simple project with some flashing leds and I just can't get i working. I will post it a little bit later. First I would like to ask where can I read about the Setup_counter? I have looked in the Help and in the Manual for the compiler but it makes no sense to me. What does the RTCC_INTERNAL mean? What it's abbreviate for(maby it isn't but usually the hole word makes more sense). And I don't know when to use it and when I don't need it?
In some examples it's used and in some it's not, please someone?

And now to the code.

#include <16LF84A.h>
#use delay(clock=4000000)
#fuses XT, NOWDT, PUT, NOPROTECT

#define DIODE1 PIN_B1
#define DIODE2 PIN_B2
#define ONOFF PIN_B4

void main()
{
//setup_counters (RTCC_INTERNAL, RTCC_DIV_1);
while(TRUE)
{
while(INPUT(ONOFF))
{
output_high(DIODE1);
delay_ms(500);
output_low(DIODE1);
delay_ms(500);
}
output_high(DIODE2);
}
}

The problem is that the DIODE1 dosen't flash. DIODE1 turns on but now flashing and if you change the input the DIODE2 goes on.

I would really appreciate an explanation of this.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 4:07 pm     Reply with quote

My suggestion is to start with a very simple program, like this,
where you just try to flash the LED:
Code:

#include <16LF84A.h>
#fuses XT, NOWDT, PUT, NOPROTECT
#use delay(clock=4000000)

#define DIODE1 PIN_B1

void main()
{

while(1)
  {
   output_high(DIODE1);
   delay_ms(500);
   output_low(DIODE1);
   delay_ms(500);
  }

}

Do you have a series resistor between the LED and the PIC ?
husq



Joined: 08 Dec 2005
Posts: 5

View user's profile Send private message

PostPosted: Fri Dec 09, 2005 1:17 pm     Reply with quote

Thanks,
Well I tryied the program one more time and it turned out that it wasn't the program, it was my crystal that was kind of messing with me. So I'm working on a little special thing for that. But anyway I would still like to know about the other stuff, anyone?
About when to use the Setup_counter and what the RTCC stands for??

Greatful for any suggestions, and if anyone could recommend some books or papers to read for us newbies?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Dec 09, 2005 1:58 pm     Reply with quote

RTCC stands for "Real Time Clock Calendar", but that name is obsolete. It's now called Timer0 in all Microchip documents.
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