![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
mcnscott2
Joined: 25 Mar 2007 Posts: 19
|
question regarding fuses |
Posted: Sun Mar 25, 2007 10:30 pm |
|
|
I'm using this *code to implement a project, however this is my first in C and not assembly, In assembly a directive for the programmer (PICSTART Plus) has to be included, but this code doesn't have one
Code: | #include <SLED4C_1620a.h> // header file & function prototypes
void Main(void)
{
int announce=0; // holds # of time/temp announcements
init(); // initialize I/O & peripherals
while(1) // loop forever
{
read_time(); // read & display DS1307 time
read_temp(); // read & display DS1620 temp
// announce time/temp on roll-over from 59 to 00 minutes
if(ds1307_regs[MINUTES_REG]==0x00)
{
if(!announce) // say time & temp only if announce=0
{
say_time(); // say the current time
delay_ms(3000); // delay 3 seconds
say_temp(); // say the current temperature
announce +=1; // increment announcement counts
}
}
if(!ds1307_regs[MINUTES_REG]==0x00)
announce=0; // clear announcements until it's time
}
}
|
and the header file
Code: | /*
File name: SLED4C_1620a.h
Header file for SLED4C_1620a.c
*/
#include <16f876A.h>
#use delay(clock=20000000)
#use rs232(baud=2400, xmit=PIN_C0)
#use i2c(Master, SDA=PIN_B0, SCL=PIN_B1)
|
I've always used MPLAB and am integrating C with it now, so does the IDE automatically set the fuses? Looking at the CCS configuration window inside MPLAB, it seems it does, I'm not sure. Do I have to even put the fuses in or has my assembly learning been all wrong? Thank you.
*note code is from www.rentron.com |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Mar 25, 2007 11:09 pm |
|
|
No, it doesn't automatically do it. You need to add a #fuses statement,
as shown in bold below.
Quote: |
#include <16F876A.h>
#fuses HS, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=2400, xmit=PIN_C0)
#use i2c(Master, SDA=PIN_B0, SCL=PIN_B1) |
Also, your #use rs232() statement will create a software UART.
If you want a hardware UART (much better), than use this line instead:
Code: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) |
|
|
![](templates/subSilver/images/spacer.gif) |
mcnscott2
Joined: 25 Mar 2007 Posts: 19
|
|
Posted: Mon Mar 26, 2007 1:31 am |
|
|
Great, thank you! I'll implement the changes tomorrow. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|