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

ICD Advance Debugging.

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



Joined: 24 May 2004
Posts: 5
Location: Madrid, (SPAIN)

View user's profile Send private message

ICD Advance Debugging.
PostPosted: Mon May 24, 2004 8:44 am     Reply with quote

I have trying to use the "advance debugging" with the ICD-40U in order to obtain messages from my PIC at the 'monitor' window when debugging the project.
I have routed the pin_b3 to the pin #1 of the RJ12 and I have also included this line in my project:

#use rs232 (baud=9600, xmit=PIN_B3, stream=DEBUG)

(I have no any other serial port defined but this).

I try to transmit to the 'monitor' window with this instructions:

fprintf(DEBUG, "\nminutes= %lu", Minutes);

Nevertheless there is no information dumped to my monitor :-(.

Can anybody tell me what is wrong??

Thanks!
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon May 24, 2004 9:11 am     Reply with quote

Try this
Code:
#use rs232(baud=38400,xmit=PIN_C5,rcv=PIN_C4,INVERT,stream=DEBUG) // STDERR(same as DEBUG)

and use a resister from the PIC TX pin to PC RS232 RX pin.
resister is 1k ohm
dgb



Joined: 24 May 2004
Posts: 5
Location: Madrid, (SPAIN)

View user's profile Send private message

PostPosted: Tue May 25, 2004 8:29 am     Reply with quote

Thanks treitmey, two things:
1. I have found a mistake at the cabling of the prototype-->after fixing this I have stuff sent by the PIC on my monitor (great!!). The downside is that it has no sense what it is shown on it.
2. I have tried your settings, but without changing my port pin (I keep on the RB3 for XMIT). No results at all. I have tried all the combinations between baud rate, invert/no-invert and parities. Making all the possible combinations from 300 bauds to 38400 I have similar rubish on my monitor.

Have any idea?

Thanks.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu May 27, 2004 7:43 am     Reply with quote

Sorry, I havn't been on for a couple of days. It sounds like you have a wireing problem. Find a pin that is the most isolated. ( no special functions((pullup resister)) and no other wireing to other devices/chips. Then run 1k resister from pin to pin 2 of DB-9 serial cable. Then use this code as a check.
Code:

#include <18F458.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=40000000)

#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7,stream=debug)  // Jumpers: 8 to 11, 7 to 12

void main()
{
   fprintf(debug,"Starting!!\n\r");
 }

Then get the rs232/fuses/clock/includefile parts right and it should run
The program Siow works well for serial RS/TX. It came with CCS software.

good luck
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu May 27, 2004 7:46 am     Reply with quote

also note that in the above code I should have an "INVERT" in the rs232 line.


You see when this code was written it used the hardware UART, not a software one like we are trying to use.

This hardware USART then when into a MAX232 chip. This is a level tranlater. That is why it didn't need a INVERT
dgb



Joined: 24 May 2004
Posts: 5
Location: Madrid, (SPAIN)

View user's profile Send private message

PostPosted: Sun May 30, 2004 7:21 am     Reply with quote

Hmmm, I don't think this is a cabling problem. I have changed the xmit pin for two times, even one of them was the xmit line of the internal UART peripheral. But in all the cases the result was the same: the monitor window was plenty of characters that had nothing to do with the real fprintf's. I have to remark that this advance debugging is made through the ICD-40U, so no DB9 connector is being used, nor SIOW program or other hyperterminal, but the "Monitor Window" of the ICD-DEBUG-TOOL_SET.
I have notice that there is no differences on the data seen on the "Monitor window" when I declare "STREAM=DEBUG", to the case that this directive doesn't appear in my code. It seems as if the compiler wouldn't take it into account... Does this make a tip for you??
dgb



Joined: 24 May 2004
Posts: 5
Location: Madrid, (SPAIN)

View user's profile Send private message

PostPosted: Mon May 31, 2004 1:12 am     Reply with quote

I got it!
I wrote the next:
Code:

#use rs232(DEBUGGER)
.
.
.
printf("Now it works\n");

I can't get it work with the STREAM=DEBUG directive inside the #use rs232, and I can't get it work neither when using fprintf instead of printf.
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