View previous topic :: View next topic |
Author |
Message |
dgb
Joined: 24 May 2004 Posts: 5 Location: Madrid, (SPAIN)
|
ICD Advance Debugging. |
Posted: Mon May 24, 2004 8:44 am |
|
|
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! |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon May 24, 2004 9:11 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
dgb
Joined: 24 May 2004 Posts: 5 Location: Madrid, (SPAIN)
|
|
Posted: Tue May 25, 2004 8:29 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 27, 2004 7:43 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 27, 2004 7:46 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
dgb
Joined: 24 May 2004 Posts: 5 Location: Madrid, (SPAIN)
|
|
Posted: Sun May 30, 2004 7:21 am |
|
|
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?? |
|
![](templates/subSilver/images/spacer.gif) |
dgb
Joined: 24 May 2004 Posts: 5 Location: Madrid, (SPAIN)
|
|
Posted: Mon May 31, 2004 1:12 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|