PDA

View Full Version : DEBUG and 64 Mhz clock problem



boban
- 28th November 2011, 15:45
Hello,
does anyone tried to use serout command with 64 Mhz? I have PIC 18LF46K22 with 16 Mhz crystal osc and PLL x 4. So my internal freq. is 64 Mhz. The PIC has 2 hardware serial ports, they are working well. But I need to send something serialy on another pin - debug info and it doesn't work well - most of the characters are not readable. Here is my code:

DEFINE OSC 64
DEFINE DEBUG_REG PORTC
DEFINE DEBUG_BIT 0
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 0

DEBUG "GET /"
for i=0 to 30
DEBUG command[i]
if (command[i] == $2F) then goto main
next i

I have on the PC the terminal with USB RS232 TTL converter. It is working well thus I can read the data from hardware serial port without problem. What I am receiving is:
) @ĪTTP

the get / which should be at the begining is wrong, these TTP characters are correct but the rest is wrong. I've tried to play with the speed to use e.g. 2400, also I've tried to use serout but no success.
Has anyone idea, what to do? I am using PBP 2.60...

aratti
- 28th November 2011, 17:07
Add the DEFINE DEBUG_PACING 1000 and see if it works.

Cheers

Al.

boban
- 30th November 2011, 12:02
I have tried but it didn't help. This parameter is used for the pause between characters, if the receiving device is not able to manage the data. But it is not my problem. My problem is the fact, that the data are corrupted and I have a feeling, that it is because of the wrong implementation of the pbp. If I will use the 4 Mhz crystal and OSC 4, it works perfectly.

aratti
- 30th November 2011, 12:13
Does it work also with the 16 MHz crystal and no PLL x 4 ?

Al.

Ioannis
- 30th November 2011, 12:47
If you try to make the output pin high at the beggining of the program?

Ioannis