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

stuck in #use delay

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








stuck in #use delay
PostPosted: Tue Aug 08, 2006 8:46 am     Reply with quote

Hi,
Just starting a new project and the code gets stuck at line 0014 and 0016! Not seen this before.
Code:

.................... #include <18F6310.h>
.................... //////// Standard Header file for the PIC18F6310 device ////////////////
.................... #device PIC18F6310
.................... #list
....................
.................... #device ICD=TRUE
.................... #device adc=8
....................
.................... #FUSES NOWDT                    //No Watch Dog Timer
.................... #FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
.................... #FUSES HS                       //High speed osc with HW enabled 4X PLL
.................... #FUSES NOPUT                  //Power Up Timer
.................... #FUSES DEBUG                    //Debug mode for use with ICD
.................... #FUSES MCLR                     //Master Clear pin enabled
.................... #use delay(clock=10000000)
0004:  CLRF   FEA
0006:  MOVLW  07
0008:  MOVWF  FE9
000A:  MOVF   FEF,W
000C:  BZ    002C
000E:  MOVLW  03
0010:  MOVWF  01
0012:  CLRF   00
0014:  DECFSZ 00,F
0016:  BRA    0014
0018:  DECFSZ 01,F
001A:  BRA    0012
001C:  MOVLW  3C
001E:  MOVWF  00
0020:  DECFSZ 00,F
0022:  BRA    0020
0024:  NOP
0026:  NOP
0028:  DECFSZ FEF,F
002A:  BRA    000E
002C:  GOTO   00A0 (RETURN)


I am using the ICD and it seems to be functioning correctly returning the correct clock speed and steping through the code (well to line 14/16!).

Code never gets further than this! Any ideas?
Guest








PostPosted: Tue Aug 08, 2006 8:52 am     Reply with quote

I will add that you can program the exact same .cof file into the PIC using the ICD-U program and the code exectues perfectly.
I presume that is must be a debuger bug?
Guest








PostPosted: Tue Aug 08, 2006 9:36 am     Reply with quote

When I click on "Stack" in the Debug window I get:

@delay_ms1(ERROR #22 : Bad expression syntax)

Does anyone know what this means? There is a delay_ms(100) later in the code which looks valid to me.
Ttelmah
Guest







PostPosted: Tue Aug 08, 2006 10:34 am     Reply with quote

First thing to understand, is that code is not shown in the listing 'in order'. The 'use delay' listing, is only called, when you reach a delay. In front of this, there ahould be a jump to your 'main' code. This is normally the first instruction in the ROM, but gets modified for debugging. You don't say what compiler you are using?. There have been problems with some chips/compiler versions, with this not being implemented properly. I have just tried a 'test' program for your chip, with the current compiler, and debugging enabled, and it appears correct. Note the jump, which is not showing in your listing:
Code:

0000:  GOTO   0030
.................... #include "C:\Program Files\PICC\amtest\test6310.h"
.................... #include <18F6310.h>
.................... //////// Standard Header file for the PIC18F6310 device ////////////////
.................... #device PIC18F6310
.................... #list
....................
.................... #device adc=8
.................... #device ICD=TRUE
....................
.................... #FUSES NOWDT                    //No Watch Dog Timer
.................... #FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
.................... #FUSES HS                       //High speed Osc (> 4mhz)
.................... #FUSES BROWNOUT                 //Reset when brownout detected
.................... #FUSES BORV21                   //Brownout reset at 2.1V
.................... #FUSES NOPUT                    //No Power Up Timer
.................... #FUSES BW16                     //16-bit external bus mode
.................... #FUSES STVREN                   //Stack full/underflow will cause reset
.................... #FUSES DEBUG                  //No Debug mode for ICD
.................... #FUSES MCLR                     //Master Clear pin enabled
....................
.................... #use delay(clock=10000000)
0004:  CLRF   FEA
0006:  MOVLW  06
0008:  MOVWF  FE9
000A:  MOVF   FEF,W
000C:  BZ    002C
000E:  MOVLW  03
0010:  MOVWF  01
0012:  CLRF   00
0014:  DECFSZ 00,F
0016:  BRA    0014
0018:  DECFSZ 01,F
001A:  BRA    0012
001C:  MOVLW  3C
001E:  MOVWF  00
0020:  DECFSZ 00,F
0022:  BRA    0020
0024:  NOP
0026:  NOP
0028:  DECFSZ FEF,F
002A:  BRA    000E
002C:  GOTO   0098 (RETURN)
....................
....................
....................
....................
.................... void main() {
0030:  CLRF   FF8

If the listing is 'as you show', without the jump anywhere, then it sounds as if you have a compiler problem with your version.
However you have clipped the 'header', showing the compiler version, and possibly this jump as well...

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