|
|
View previous topic :: View next topic |
Author |
Message |
hexfet13
Joined: 03 Jul 2009 Posts: 8
|
PIC18f2550 and rs232 garbage |
Posted: Fri Jul 03, 2009 10:33 am |
|
|
Hi, I'm trying to work with rs232 on pic18f2550 but with a simple test program in my hyperterminal I see only garbage . Originally, I need to implement a simple rs232 protocol to transfer a data stream with pll enabled (4MHz external crystal) but with pll enabled (fuses HSPLL and #use delay( clock=48000000 ) ) or not (only HS fuses enabled) the result is always the same.
Where's the mistake?
Thanks!
Code: |
#include <18f2550.h>
#fuses HS,NOWDT,NOPROTECT,NOPUT,NOLVP,NOMCLR
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS )
void main()
{
printf("\f");
while(1){
delay_ms(500);
printf("testing ");
}
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 03, 2009 1:36 pm |
|
|
1. Read the markings on the crystal. Is it really 4.000 MHz ?
2. Make sure you re-compiled the program and re-programmed it into
the PIC, after making changes.
3. Check the settings on HyperTerminal. Make sure it's set for
9600 baud, No parity, 8 bits, 1 stop bit, and No hardware or software
handshaking. Or try a different Terminal progam, such as TeraTerm:
http://www.ccsinfo.com/forum/viewtopic.php?t=39388&start=18
4. Do you have a MAX232-type chip between the PIC and the PC ?
Did you build the board and the serial cable yourself, or did you
buy them ? If you built them yourself, then check for wiring errors. |
|
|
hexfet13
Joined: 03 Jul 2009 Posts: 8
|
|
Posted: Sun Jul 05, 2009 4:19 am |
|
|
Thanks for reply.
I've solved the problem: the guilty was a spike upon Vcc caused by max3232.The amplitude of it was over 1.5V and the result was a dead pic that work at irregular intervals.
Thanks again. |
|
|
|
|
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
|