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

crazy fuses ?? in midrange 4.085??

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



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

crazy fuses ?? in midrange 4.085??
PostPosted: Tue Sep 06, 2011 2:17 pm     Reply with quote

I have used ver 4.085 with the 16f/c family for years using internal osc and external crystals.
Also done a number of projects with 18f parts - but never had occasion to use an external crystal with the 18F parts

I've tried this with an 18f4520 and an 18f4620 - only changing to BORV43 for that part - with the same weird results. compare my fuse statement with what the compiler did. I would GREATLY prefer if anyone knew a work around - as the code that is generated otherwise for 18f parts has been satisfactory.
I am in NO Hurry to upgrade to a fresh version and its unknowns.

Is the following bizarre fuse compilation ME or the compiler ??

Code:

CCS PCH C Compiler, Version 4.085, 47322               06-Sep-11 15:54
               Filename: d:\abm\serdem5.lst
               ROM used: 172 bytes (1%)
                         Largest free fragment is 32596
               RAM used: 14 (1%) at main() level
                         14 (1%) worst case
               Stack:    1 locations
*
0000:  GOTO   0044
.................... #include <18f4520.h>
.................... //////// Standard Header file for the PIC18F4520 device ////////////////
.................... #device PIC18F4520
.................... #list
.................... #fuses HS,NOPROTECT,NOMCLR,NOWDT,NODEBUG,NOLVP,NOIESO,
.................... #fuses NOFCMEN,PUT,NOWRT,NOFCMEN,BROWNOUT,BORV42,   // borv43 in 4620
.................... #fuses CCP2C1,NOPBADEN,NOLPT1OSC,noxinst,
.................... #include <stdlib.h>
.................... #use fast_io(B)
.................... #use delay( clock=16588880,INTERNAL ) // clock changed to 80000
.................... #use rs232(baud=57600, xmit=PIN_C6, rcv=PIN_C7, ERRORS )
*
0030:  BTFSS  F9E.4
0032:  BRA    0030
0034:  MOVWF  FAD
0036:  GOTO   0082 (RETURN)
.................... #bit  T0IF    = 0xFF2.2  // flag in reg
.................... //***********************************
.................... void InitHDW ( void ) {
.................... //***********************************
....................      output_b (0);    //  - all INPUT
*
001E:  CLRF   F8A
....................      set_tris_b (0);
0020:  MOVLW  00
0022:  MOVWF  F93
....................      set_tris_c (128); // set bit 7 per datasheet for C7=INPUT
0024:  MOVLW  80
0026:  MOVWF  F94
....................      SETUP_TIMER_0(RTCC_8_BIT|RTCC_DIV_256);
0028:  MOVLW  C7
002A:  MOVWF  FD5
.................... }
002C:  GOTO   0078 (RETURN)
.................... void zertime(void){
....................     t0if=0;  set_timer0(93);
*
003A:  BCF    FF2.2
003C:  CLRF   FD7
003E:  MOVLW  5D
0040:  MOVWF  FD6
.................... }
0042:  RETLW  00
.................... void main() {
0044:  CLRF   FF8
0046:  BCF    FD0.7
0048:  CLRF   FEA
004A:  CLRF   FE9
004C:  MOVLW  60
004E:  MOVWF  FD3
0050:  MOVLW  40
0052:  MOVWF  F9B
0054:  MOVF   FD3,W
0056:  BCF    FB8.3
0058:  MOVLW  11
005A:  MOVWF  FAF
005C:  MOVLW  A6
005E:  MOVWF  FAC
0060:  MOVLW  90
0062:  MOVWF  FAB
0064:  MOVF   FC1,W
0066:  ANDLW  C0
0068:  IORLW  0F
006A:  MOVWF  FC1
006C:  MOVLW  07
006E:  MOVWF  FB4
0070:  CLRF   05
0072:  CLRF   06
0074:  CLRF   0B
....................     unsigned int8 i;
....................     InitHDW();
0076:  BRA    001E
....................     printf ("*Hello*\r");  // quick check output baud
0078:  CLRF   0D
007A:  MOVF   0D,W
007C:  RCALL  0004
007E:  INCF   0D,F
0080:  BRA    0030
0082:  MOVLW  08
0084:  SUBWF  0D,W
0086:  BNZ   007A
....................     while (1) {           // now get AND send at same time
....................           for (i=0; i<255; i++){
0088:  CLRF   0C
008A:  INCFSZ 0C,W
008C:  BRA    0090
008E:  BRA    00A8
....................               output_high(pin_b0);
0090:  BSF    F8A.0
....................               zertime();
0092:  RCALL  003A
....................               while (!t0if){};
0094:  BTFSC  FF2.2
0096:  BRA    009A
0098:  BRA    0094
....................               output_low(pin_b0);
009A:  BCF    F8A.0
....................               zertime();
009C:  RCALL  003A
....................               while (!t0if){};
009E:  BTFSC  FF2.2
00A0:  BRA    00A4
00A2:  BRA    009E
....................           }
00A4:  INCF   0C,F
00A6:  BRA    008A
....................     }  //         END : while  1
00A8:  BRA    0088
.................... }
.................... //
00AA:  SLEEP

Configuration Fuses:
   Word  1: 0800   NOIESO NOFCMEN INTRC_IO
   Word  2: 1E0E   BROWNOUT NOWDT BORV42 PUT WDT32768
   Word  3: 0100   NOPBADEN CCP2C1 NOLPT1OSC NOMCLR RESERVED
   Word  4: 0081   STVREN NODEBUG NOLVP NOXINST RESERVED
   Word  5: C00F   NOPROTECT NOCPD NOCPB
   Word  6: E00F   NOWRT NOWRTD NOWRTC NOWRTB
   Word  7: 400F   NOEBTR NOEBTRB


Is there a work around or did I do something that caused this ??
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Tue Sep 06, 2011 2:31 pm     Reply with quote

You.
You are specifying HS (external crystal), then overriding this with your clock statement (,INTERNAL.....)

Best Wishes
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