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

About #Fuses Compiler 5.076

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



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

About #Fuses Compiler 5.076
PostPosted: Fri Mar 16, 2018 3:03 am     Reply with quote

HI,
Please where can I find the detail (or explanation) of each FUSES ?

The 18F66K22.H provide this listing without any comment ...:

Code:
#device PIC18F66K22

#nolist
//////// Program memory: 32768x16  Data RAM: 4096  Stack: 31
//////// I/O: 53   Analog Pins: 20
//////// Data EEPROM: 1024
//////// C Scratch area: 00   ID Location: 200000
//////// Fuses: VREGSLEEP_SW,VREGSLEEP,INTRC_LP,INTRC_HP,SOSC_LOW,SOSC_DIG
//////// Fuses: SOSC_HIGH,NOXINST,XINST,LP,XT,HSH,HSM,ECH,ECH_IO,RC,RC_IO
//////// Fuses: INTRC_IO,INTRC,ECM,ECM_IO,ECL,ECL_IO,NOPLLEN,PLLEN,NOFCMEN
//////// Fuses: FCMEN,NOIESO,IESO,PUT,NOPUT,NOBROWNOUT,BROWNOUT_SW
//////// Fuses: BROWNOUT_NOSL,BROWNOUT,BORV30,BORV27,BORV20,BORV18,BORM_LOW
//////// Fuses: BORM_MED,BORM_HIGH,ZPBORM,NOWDT,WDT_NOSLEEP,WDT_SW,WDT,WDT1
//////// Fuses: WDT2,WDT4,WDT8,WDT16,WDT32,WDT64,WDT128,WDT256,WDT512
//////// Fuses: WDT1024,WDT2048,WDT4096,WDT8192,WDT16384,WDT32768,WDT65536
//////// Fuses: WDT131072,WDT262144,WDT524288,WDT1048576,RTCOSC_INT
//////// Fuses: RTCOSC_T1,CCP2E7,CCP2C1,MSSPMSK5,MSSPMSK7,NOMCLR,MCLR
//////// Fuses: NOSTVREN,STVREN,BBSIZ1K,BBSIZ2K,DEBUG,NODEBUG,PROTECT
//////// Fuses: NOPROTECT,CPB,NOCPB,CPD,NOCPD,WRT,NOWRT,WRTC,NOWRTC,WRTB
//////// Fuses: NOWRTB,WRTD,NOWRTD,EBTR,NOEBTR,EBTRB,NOEBTRB
////////

Thanks for your help.

Cogitum
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 16, 2018 5:24 am     Reply with quote

First place to look is the datasheet, Near the end is the 'Special Features of the PIC' chapter and it details the various bits of the registers also known as 'fuses'. CCS tends to use the same names as Microchip,though I've never compared each and every one for all the PICs.
Depending on the compiler you bought, you may have a 'fuses.txt' file. I don't know if CCS has it listed as a downloadable file.
The configuration bits are called 'fuses' as the original method of programming early devices (PLA, 8223 is an example) was to actually blow a small nichrome fuse link. This is a ONCE ONLY procedure ! Once blown there was NO second chance,so you had to be careful and confirm your code BEFORE committing to 'burning' the chip.

As you know, that PIC(well most today) have dozens of fuses. I have a device_name_project_name_fuses.fuz file with them all, one per line and '#include it'. First, I'm a lousy typist, so I only have to do it once, 2nd it makes the program 'cleaner', 3rd I know that ALL fuses are configured.

Jay
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

next
PostPosted: Fri Mar 16, 2018 8:20 am     Reply with quote

Hi Jay,

Thanks a lot for your quick answer.
Could you or not email me the fuse file ?

Thank in advance

Best regard

Cogitum
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Fri Mar 16, 2018 8:54 am     Reply with quote

fuses.txt comes with the compiler. It is in your compiler's install directory.
The explanations are the data sheet, combined with this file!....
So (for instance), the first fuse allowed 'VREGSLEEP_SW', in fuses.txt is given as:
VREGSLEEP_SW Ultra low-power regulator is enabled

and in the data sheet:
VREG Sleep Enable bit
1 = Regulator power while in Sleep mode is controlled by VREGSLP (WDTCON<7>)
0 = Regulator power while in Sleep mode is controlled by SRETEN (WDTCON<4>). Ultra low-power
regulator is enabled.

The 'SW' selection here is the software controllable form (the second line).
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

PostPosted: Fri Mar 16, 2018 12:26 pm     Reply with quote

Thank Ttelmah for you explanation. I got fuses.txt.
But that seem not easy.

Regards

Cogitum
Cogitum



Joined: 22 Mar 2012
Posts: 70
Location: France (Paris)

View user's profile Send private message

Mysterious problem with Oscillator 18F66K22 Compiler 5.076
PostPosted: Fri Mar 16, 2018 12:46 pm     Reply with quote

Hi,
Target is to use 20MHZ (Crystal) I can easily check the sinus on the scope!
Using the lab power supply. I make ON/OFF the voltage to my board.
One LED is blinking and from time to time the blink change (reduce).
When's the case i can't read the sinus on the Crystal but the blink is there!
Code:

#include <18F66K22.h>
#device adc=12
#include <stdlib.h>             
#include <string.h>

#FUSES NOWDT                    // No Watch Dog Timer NOWDT
#FUSES NOXINST                  // Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES HSH                      // High speed Osc
#FUSES NOBROWNOUT               // No brownout reset 
#FUSES NOPLLEN                  // 4X HW PLL disabled, 4X PLL enabled in software
//#FUSES WDT_NOSLEEP            // Watch Dog Timer, disabled during SLEEP
#FUSES VREGSLEEP_SW             // Ultra low-power regulator is enabled
//#FUSES NOLVP                  // No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES  SOSC_HIGH     
//#use delay(clock=20000000)
#use delay(crystal=20MHZ)
#use rs232(UART1,stream=gps,baud=9600, xmit=PIN_C6,rcv=PIN_C7)

void main()
{
printf("START TEST\r\n");

while(TRUE)
  {
   led_blinking();
   output_toggle(PIN_G0);
   delay_ms(500);
   printf("*******START TEST2********\r\n");
  }

}

Note: When the time of the blink reduce I can't read correctly the message.

Maybe internal osc is running ?

Welcome to any help.

Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Fri Mar 16, 2018 2:11 pm     Reply with quote

First thing. Standard is that the layout should always be:

Processor include
Fuses
Timing settings
pin definitions (pin select if applicable)
I/O definitions (#use rs232, I2c etc.)
Then include library files
Then the code.

Otherwise there is a risk of loading things that _must_ have other stuff setup, before the settings are made.

However, what you have is working.

Problem is that serial is slow, and humans are slower.
You are sending about 35 characters. If you send too fast the PC display and your vision just won't be able to update fast enough.
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