View previous topic :: View next topic |
Author |
Message |
JerryEF
Joined: 23 Sep 2011 Posts: 2
|
Real basic DEBUG question |
Posted: Fri Sep 23, 2011 5:53 pm |
|
|
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
|
|
Posted: Fri Sep 23, 2011 8:27 pm |
|
|
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
|
|
Posted: Sun Sep 25, 2011 1:37 pm |
|
|
Maybe not related to your problem, but an invalid setup anyway is the line: Code: | setup_spi(SPI_SS_DISABLED); | change to: |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sun Sep 25, 2011 2:08 pm |
|
|
userstream enable is needed but so is a # use delay statement to set the clock frequency |
|
|
JerryEF
Joined: 23 Sep 2011 Posts: 2
|
|
Posted: Sun Sep 25, 2011 4:58 pm |
|
|
It turned out that I had an inconsistent CLOCK fuse set. Fixed that and everything works fine now. Thanks for the input. |
|
|
|