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

Real basic DEBUG question

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



Joined: 23 Sep 2011
Posts: 2

View user's profile Send private message

Real basic DEBUG question
PostPosted: Fri Sep 23, 2011 5:53 pm     Reply with quote

Newbe here. Long time C programmer. On again, off again CCS programmer. Been off for awhile. Been having no problems until trying to use the DEBUG printf facilities: Can't get DEBUG to printf properly to debug monitor window.

Most recent compiler update. PIC18F4620-I/P running on CCS Prototyping board Rev 6. Using ICD-U64 with most current firmware. The test program below was fully built using the CCS new project wizard.

The debugger has the parameter for Userstream Enabled set to TRUE. I have included the core of a program that illustrates my problem:

-> not including the .h files for the processor or project
Code:

#fuses DEBUG
#use RS232(DEBUGGER)

void main()
{

   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   
   printf("This should appear in debug window");
}

When I run this, I get garbage in the debug Monitor window when the printf executes.

Thanks in advance for any pointers.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 23, 2011 8:27 pm     Reply with quote

Quote:

setup_timer_0(RTCC_INTERNAL);

I have included the core of a program

Are there any interrupt routines in your program ? Are the interrupts
occurring when the printf to the Debug monitor is executing ?


Also, in this file,
Quote:
c:\program files\picc\drivers\sim.c

CCS shows an alternate method:
Code:

#use rs232(DEBUGGER, stream=DEBUG)

void main()
{
fprintf(DEBUG, "\r\nSending SEQ\r\n");
.
.
.

}
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Sep 25, 2011 1:37 pm     Reply with quote

Maybe not related to your problem, but an invalid setup anyway is the line:
Code:
   setup_spi(SPI_SS_DISABLED);
change to:
Code:
   setup_spi(FALSE);
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Sun Sep 25, 2011 2:08 pm     Reply with quote

userstream enable is needed but so is a # use delay statement to set the clock frequency
JerryEF



Joined: 23 Sep 2011
Posts: 2

View user's profile Send private message

PostPosted: Sun Sep 25, 2011 4:58 pm     Reply with quote

It turned out that I had an inconsistent CLOCK fuse set. Fixed that and everything works fine now. Thanks for the input.
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