CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Another RS232 issue

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Another RS232 issue
PostPosted: Wed Dec 14, 2005 3:46 pm     Reply with quote

Hi guys,
I have been reading the posts, but haven't seen anything like my problem.

I am using a 16F873A and a 20 MHz Osc and I am trying to communicate with the PC through rs232 (I use a MAX232 too).

I have a simple test program that counts every 1 second and shows the value of the counter on the screen.

The problem is that the communication (at least TX from the pic to the pc) works fine at first, for the first few seconds, but then it goes nuts and starts sending garbage for a while, and then it stops throwing anything.

It displays:

counter = 1
counter = 2
counter = 3
counter = 4
¬W–‹…)ÿÕ•¹Ñ…)ÿMY‹…)


...and then it just stops communicating.

I have tried to run some of the example codes that come with the compiler and tried copying some of the codes that appear at the manual, but always get the same problem: rs232 communication works for some seconds and then it just goes nuts.


Any ideas of what can the problem be?

Thanks in advance!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 14, 2005 3:51 pm     Reply with quote

Quote:
I have a simple test program that counts every 1 second and
shows the value of the counter on the screen.

Post the test program. Be sure to pPost all the #include, #fuses, and
#use statements.

Also post your compiler version.
Guest








PostPosted: Wed Dec 14, 2005 4:15 pm     Reply with quote

Here it is:


#include <16F873A.h>
#include <stdio.h>
#include <stdlib.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, PARITY=N, BITS=8,ERRORS)

void main() {
int a=0;

while (TRUE) {
++a;


printf("counter = ");

printf("%d \n", a);
delay_ms(1000);

}
}


I use PCWH 3.203.

Perhaps there is a very obvious mistake, but I just can't find.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 14, 2005 4:25 pm     Reply with quote

What terminal program are you using ?
What operating system are you using on your PC ?
Do you have fifo buffers enabled for your PC's COM port ?
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Dec 14, 2005 4:42 pm     Reply with quote

I looks like a power fault or something consuming extra current.

1) Did you check the input voltage before the +5V regulator ?
2) Did you check the voltages at MAX232:
PIN2 to Gnd = ?? ( +V )
PIN6 to Gnd = ?? ( -V )

I would check them before and after the errors.


Humberto
Guest








PostPosted: Wed Dec 14, 2005 7:56 pm     Reply with quote

PCM programmer, I am working on a pc with windows 98, and I am using the "serial port monitor" which is in the tools of the compiler. I also tried downloading another serial port monitor, but it didn't work either.

Humberto, I think the hardware part is ok, but I will check those values tomorrow (I don't have the tools for doing it right now), and see what happens. Thanks.
Guest








PostPosted: Wed Dec 14, 2005 7:57 pm     Reply with quote

PCM programmer, I am working on a pc with windows 98, and I am using the "serial port monitor" which is in the tools of the compiler. I also tried downloading another serial port monitor, but it didn't work either.

Humberto, I think the hardware part is ok, but I will check those values tomorrow (I don't have the tools for doing it right now), and see what happens. Thanks.
Guest








PostPosted: Thu Dec 15, 2005 8:12 am     Reply with quote

Sorry for the duplicate message, it was a browser problem.
Now I used Hyperterminal to monitor the port, and I have the same problem. I have fifo buffers enabled.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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