Hi, I am a beginner so be patient!
When i run the code below after downloading the prog to my Xc161xBoard, if i step over the line which creates Test, why does it take about 5 secs to debug this line??
typedef struct _tag { char a[10]; char b[10]; int c; }Test;
Test test = {"Hello", "Goodbye", 23};
Assumming you are using the monitor and debugging real hardware serially. I might be wrong there because I think that the XC family has JTAG, but still this might help someone else:
Using the monitor does have some overhead. A few tips to speed things up:
- use the maximum baud rate you can between the computer and the target. For instance, anything below 38400 Baud is not normal for a CPU speed of 20MHz. Check for noise issues, grounding problems etc. if you can't achieve a reasonable communication speed.
- I make it a rule to never, ever, use your computer's internal COM port. Odds are that the hardware is minimalist and the driver must be crusty. Use a dedicated USB to COM adapter instead (Quatech has pretty good ones).
- any information on the screen that shows "volatile" data from the target will take some bandwidth for each debugging step. Try to avoid showing data you don't need: minimize the size of the memory window to what is needed, open the ARTX status window only when necessary, etc.
$0.02
I make it a rule to never, ever, use your computer's internal COM port.
With the exception of some Dell machines, I have never ever seen a problem with a built-in serial port.
On the other hand - a huge number of USB-to-serial dongles have chips or drivers that does work lousy. They may have a huge FIFO, but their drivers may set FIFO the timeout or FIFO watermark level much too high, resulting in too long latencies for many protocols. If the protocol is stop-and-go, there may never be enough data in the FIFO to get a FIFO watermark interrupt.
The latencies of USB also affects how fast a driver may toggle (or poll) the handshake lines.
Well, my computer is a Dell : )
I should have said: "I make it a rule to never use my computer's internal COM port."... because I know mine is moody, and that my USB adapter performs like a champ; now for other people in other situations, it could be exactly the opposite, I agree!
I had never thought of how USB could affect the handshake lines, interesting thought.
-Stephane