|
|
View previous topic :: View next topic |
Author |
Message |
Lance Lascari Guest
|
18F252 and CCS RS-232 problem? |
Posted: Thu Feb 06, 2003 9:08 pm |
|
|
I couldn't find this problem when searching the archive... so I thought I would ask.
Using version 3.141. New to the 18F series pics...
[snip]
#include <18F252.h>
#use delay(clock=4000000)
#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#fuses HS,PUT,BROWNOUT,NOWDT,WDT1,NOPROTECT,NOWRTD,NOLVP
[snip]
The RS-232 string functions I findAny RS-232 string function I can find, seems to just get the first two chars out, and occasionally some garbage.
[snip fragment]
puts("hello"); // broken
printf("hello"); // broken
[snip fragment]
I suspect that the built in routines don't hang around and wait for the TX buffer to empty (and I bet it's double-buffered).
At 4800 baud, I do this
putc('h');
delay_ms(10);
putc('e');
delay_ms(10);
putc('l');
delay_ms(10);
putc('l');
delay_ms(10);
putc('o');
And it works fine every time.
Just surprised that this would be a bug if it really is. I've not had this particular problem with the 16fxxx PICs before.
Time to write my own puts(), no biggie. Wondering if anyone else has had this problem with the 18f parts in recent versions of the CCS compiler.
-Lance
___________________________
This message was ported from CCS's old forum
Original Post ID: 11378 |
|
|
Jerry Guest
|
Re: 18F252 and CCS RS-232 problem? |
Posted: Thu Feb 06, 2003 10:27 pm |
|
|
:=I couldn't find this problem when searching the archive... so I thought I would ask.
:=
:=Using version 3.141. New to the 18F series pics...
:=[snip]
:=#include <18F252.h>
:=#use delay(clock=4000000)
:=#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=#fuses HS,PUT,BROWNOUT,NOWDT,WDT1,NOPROTECT,NOWRTD,NOLVP
:=[snip]
:=
:=The RS-232 string functions I findAny RS-232 string function I can find, seems to just get the first two chars out, and occasionally some garbage.
:=
:=[snip fragment]
:=puts("hello"); // broken
:=printf("hello"); // broken
:=[snip fragment]
:=
:=
:=
:=I suspect that the built in routines don't hang around and wait for the TX buffer to empty (and I bet it's double-buffered).
:=
:=At 4800 baud, I do this
:= putc('h');
:= delay_ms(10);
:= putc('e');
:= delay_ms(10);
:= putc('l');
:= delay_ms(10);
:= putc('l');
:= delay_ms(10);
:= putc('o');
:=
:=And it works fine every time.
:=
:=Just surprised that this would be a bug if it really is. I've not had this particular problem with the 16fxxx PICs before.
:=
:=Time to write my own puts(), no biggie. Wondering if anyone else has had this problem with the 18f parts in recent versions of the CCS compiler.
:=
:=-Lance
Try to add this at the end of your print statements so the pic does not go to sleep.
while(TRUE)
{
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 11379 |
|
|
Lance Lascari Guest
|
Re: 18F252 and CCS RS-232 problem? |
Posted: Thu Feb 06, 2003 11:01 pm |
|
|
Thanks,
I should have posted the whole code, it was all contained in a never ending loop.
while(1)
{
//
do stuff
//
delay_ms(1000);
}
It can't go to sleep unless I let it, or is somebody deciding a bit much for me?
-Lance
:=:=I couldn't find this problem when searching the archive... so I thought I would ask.
:=:=
:=:=Using version 3.141. New to the 18F series pics...
:=:=[snip]
:=:=#include <18F252.h>
:=:=#use delay(clock=4000000)
:=:=#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=:=#fuses HS,PUT,BROWNOUT,NOWDT,WDT1,NOPROTECT,NOWRTD,NOLVP
:=:=[snip]
:=:=
:=:=The RS-232 string functions I findAny RS-232 string function I can find, seems to just get the first two chars out, and occasionally some garbage.
:=:=
:=:=[snip fragment]
:=:=puts("hello"); // broken
:=:=printf("hello"); // broken
:=:=[snip fragment]
:=:=
:=:=
:=:=
:=:=I suspect that the built in routines don't hang around and wait for the TX buffer to empty (and I bet it's double-buffered).
:=:=
:=:=At 4800 baud, I do this
:=:= putc('h');
:=:= delay_ms(10);
:=:= putc('e');
:=:= delay_ms(10);
:=:= putc('l');
:=:= delay_ms(10);
:=:= putc('l');
:=:= delay_ms(10);
:=:= putc('o');
:=:=
:=:=And it works fine every time.
:=:=
:=:=Just surprised that this would be a bug if it really is. I've not had this particular problem with the 16fxxx PICs before.
:=:=
:=:=Time to write my own puts(), no biggie. Wondering if anyone else has had this problem with the 18f parts in recent versions of the CCS compiler.
:=:=
:=:=-Lance
:=
:=Try to add this at the end of your print statements so the pic does not go to sleep.
:=
:=while(TRUE)
:={
:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 11380 |
|
|
Lance Lascari Guest
|
Re: 18F252 and CCS RS-232 problem? |
Posted: Sat Feb 08, 2003 1:46 pm |
|
|
Turns out this was a hardware problem.
Crappy bypassing around the chip made the PLL unstable, it ran fine in fundamental and low-frequency modes.
Treat the PLL with care!
Sorry for the noise,
Lance
:=Thanks,
:=
:=I should have posted the whole code, it was all contained in a never ending loop.
:=
:=while(1)
:={
:=//
:=do stuff
:=//
:=delay_ms(1000);
:=
:=
:=}
:=
:=It can't go to sleep unless I let it, or is somebody deciding a bit much for me?
:=
:=-Lance
:=
:=
:=
:=:=:=I couldn't find this problem when searching the archive... so I thought I would ask.
:=:=:=
:=:=:=Using version 3.141. New to the 18F series pics...
:=:=:=[snip]
:=:=:=#include <18F252.h>
:=:=:=#use delay(clock=4000000)
:=:=:=#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
:=:=:=#fuses HS,PUT,BROWNOUT,NOWDT,WDT1,NOPROTECT,NOWRTD,NOLVP
:=:=:=[snip]
:=:=:=
:=:=:=The RS-232 string functions I findAny RS-232 string function I can find, seems to just get the first two chars out, and occasionally some garbage.
:=:=:=
:=:=:=[snip fragment]
:=:=:=puts("hello"); // broken
:=:=:=printf("hello"); // broken
:=:=:=[snip fragment]
:=:=:=
:=:=:=
:=:=:=
:=:=:=I suspect that the built in routines don't hang around and wait for the TX buffer to empty (and I bet it's double-buffered).
:=:=:=
:=:=:=At 4800 baud, I do this
:=:=:= putc('h');
:=:=:= delay_ms(10);
:=:=:= putc('e');
:=:=:= delay_ms(10);
:=:=:= putc('l');
:=:=:= delay_ms(10);
:=:=:= putc('l');
:=:=:= delay_ms(10);
:=:=:= putc('o');
:=:=:=
:=:=:=And it works fine every time.
:=:=:=
:=:=:=Just surprised that this would be a bug if it really is. I've not had this particular problem with the 16fxxx PICs before.
:=:=:=
:=:=:=Time to write my own puts(), no biggie. Wondering if anyone else has had this problem with the 18f parts in recent versions of the CCS compiler.
:=:=:=
:=:=:=-Lance
:=:=
:=:=Try to add this at the end of your print statements so the pic does not go to sleep.
:=:=
:=:=while(TRUE)
:=:={
:=:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 11427 |
|
|
|
|
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
|