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

Why the leds on Port C keeps on blinking?

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



Joined: 10 Sep 2003
Posts: 60

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger ICQ Number

Why the leds on Port C keeps on blinking?
PostPosted: Fri Dec 03, 2004 3:25 am     Reply with quote

Dear all,

I am trying to send data from pc to the pic. and from pic to the pc. When I send a byte from the pc to the pic, the pic will get the character and light a led. I connect a max232 between the pc and the pic.

My program looks like this:
#include <16f876.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT,PUT,BROWNOUT

#use delay(clock=20000000)
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7)

#byte PORTC=7

byte a;

#int_rda
void serial_isr()
{
a=getc();
portc=a;
}

void main()
{
set_tris_c(0x80);
enable_interrupts(global);
enable_interrupts(int_rda);

portc=0x02;

do {
} while (1);
}

However, when I send a byte, e.g. 1, the led that is connected to PIN C0 keeps on blinking. Later I change my program to just lights the PIN_C0 without receive data from the pc to check whether the problem is caused by the interrupt. However, the LED is still blinking if the rs232 between the pc and pic still there. If I remove the connection, then it is ok (just light on, without blinking. May I know anyone hav any idea why does this happen?

Thanks
_________________
Einly
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Dec 03, 2004 3:35 am     Reply with quote

The program version as shown above will blink the led on incomming serial data. So, if the led is blinking your PC must be transmitting data (even though you might 'think' it is not). Check all programs running on your PC.
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