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

C template for PIC16F676

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



Joined: 21 Oct 2004
Posts: 9

View user's profile Send private message

C template for PIC16F676
PostPosted: Thu Oct 21, 2004 10:08 pm     Reply with quote

Can anybody provide an example or template for PIC16F676 C code? I do not know how to start.

Please help! Question
_________________
CC
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Oct 21, 2004 10:18 pm     Reply with quote

Look into the PICC\Examples directory. There are many helpful example programs there.
dyeatman



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

View user's profile Send private message

Try searching this board...
PostPosted: Thu Oct 21, 2004 10:36 pm     Reply with quote

Also try a search on this board for 16F676. The first hit you get in the search will give you a basic start. There are a lot of others after that which provide a wealth of info...
cindyw



Joined: 21 Oct 2004
Posts: 9

View user's profile Send private message

PIC16F676
PostPosted: Thu Oct 21, 2004 10:57 pm     Reply with quote

Thanks for your advice.
Pic16f676.h file need to be included in the C programming. where is the definition or memory allocation for those registers? just like what has been defined in pic16f676.inc by assembly lauguage?
_________________
CC
dyeatman



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

View user's profile Send private message

What version do you have?
PostPosted: Fri Oct 22, 2004 6:07 am     Reply with quote

Do you have PCB, PCH, PCM, PCWH?

What version of CCS C compiler do you have (the version number is a single digit followed by a decimal and three more digits i.e 3.021 or 3.112)?

If you have the correct CCS C compiler you will find the PIC16F676.H header file in the PICC/devices directory.

You can open the .H file with Notepad to see what is in it...

No, it is not likely the same info as the 16F676.inc file you may be looking at. I have included part of the PIC16F676.H file below as an example of the information it contains.

Code:

//////// Standard Header file for the PIC16F676 device ////////////////
#device PIC16F676
#nolist
//////// Program memory: 1024x14  Data RAM: 64  Stack: 8
//////// I/O: 12   Analog Pins: 8
//////// Data EEPROM: 128
//////// C Scratch area: 20   ID Location: 2000
//////// Oscilator Calibration Address: 90
//////// Fuses: LP,XT,HS,EC,INTRC_IO,INTRC,RC_IO,RC,PROTECT,NOPROTECT
//////// Fuses: NOBROWNOUT,BROWNOUT,MCLR,NOMCLR,CPD,NOCPD,WDT,NOWDT,PUT
//////// Fuses: NOPUT
////////
////////////////////////////////////////////////////////////////// I/O
// Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
//                         PORT_B_PULLUPS(), INPUT(),
//                         OUTPUT_LOW(), OUTPUT_HIGH(),
//                         OUTPUT_FLOAT(), OUTPUT_BIT()
// Constants used to identify pins in the above are:

#define PIN_A0  40
#define PIN_A1  41
#define PIN_A2  42
#define PIN_A3  43
#define PIN_A4  44
#define PIN_A5  45

#define PIN_C0  56
#define PIN_C1  57
#define PIN_C2  58
#define PIN_C3  59
#define PIN_C4  60
#define PIN_C5  61


////////////////////////////////////////////////////////////////// Useful defines
#define FALSE 0
#define TRUE 1

#define BYTE int
#define BOOLEAN short int

#define getc getch
#define fgetc getch
#define getchar getch
#define putc putchar
#define fputc putchar
#define fgets gets
#define fputs puts

////////////////////////////////////////////////////////////////// Control
// Control Functions:  RESET_CPU(), SLEEP(), RESTART_CAUSE()
// Constants returned from RESTART_CAUSE() are:
#define WDT_FROM_SLEEP  0     
#define WDT_TIMEOUT     8     
#define MCLR_FROM_SLEEP 16   
#define NORMAL_POWER_UP 24   

And the file continues from here....

****************************************************
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