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

help with PIC16F877A

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 23, 2009 5:32 pm     Reply with quote

Quote:
I can't seem to find any available website online that has all the available functions

http://www.ccsinfo.com/content.php?page=compspecific

1. The 20 MHz crystal requires HS mode. It will not oscillate with the low
powered XT mode fuse.

2. You need to allow your LEDs to be on long enough for your eyes to
see them. Put delay statements between the LED on/off statements.

3. You don't need to set the TRIS. The compiler will do it for you when
you use the output_low() and output_high() functions (and other CCS
functions).

4. Always specify the NOLVP fuse. The vs. 4.x compilers default to that
mode, but I don't know what version you have, so it's best to specify it.

Study this example program:
Code:

#include <16F877A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)

//===============================
void main()
{

while(1)
  {
   output_high(PIN_C0);  // Blink LED on Pin C0
   delay_ms(500);
   output_low(PIN_C0);
   delay_ms(500);
  }

}
bling23



Joined: 21 Mar 2009
Posts: 4

View user's profile Send private message

PostPosted: Mon Mar 23, 2009 6:00 pm     Reply with quote

Thanks for your help
Now my simple test LED code works perfectly.

I have been to the website but it does not provide details on how to use those functions that they have.

It will be good if there was a source that has all the functions with all the different parameters that can be fed into the functions.

For example,

I was trying to do:

Code:
setup_timer_1(T1_INTERNAL | T1_DIV_BY_4);



I copied the code from a source.
however,
I want to do the same for timer2.
I know that timer2 is slightly different from 1 but I have no idea what parameters to type in.

I tried to duplicate.

Code:
setup_timer_2(T2_INTERNAL | T2_DIV_BY_4);


But it gives me error while compiling.

The problem I have now is not programming as I am quite good with C programming but the syntax and the coding for PIC.
I have never used it before and its very confusing.

For example, I would never figure that the problem I was having was with the HS fuse as I just included it because it seems like some syntax that PIC needed.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 23, 2009 6:19 pm     Reply with quote

Quote:

I have been to the website but it does not provide details on how to use
those functions that they have.

Look in the CCS manual:
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Unfortunately the manual is not easy to use, because it has no table
of contents ("Bookmarks") that you can click on, and the hyperlinks
don't work. You may want to use the Help file instead. It's in this directory:
Quote:
c:\Program Files\Picc\ccsc.chm


Quote:

I would never figure that the problem I was having was with the HS fuse.

Download the 16F877A data sheet:
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010242
Look in this section:
Quote:
14.0 SPECIAL FEATURES OF THE CPU

This table shows the frequency limits for each oscillator fuse:
Quote:
TABLE 14-2: CAPACITOR SELECTION FOR CRYSTAL OSCILLATOR

Always review a PIC module in the documentation before you use it.
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