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 CCS Technical Support

switch

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



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

switch
PostPosted: Wed Jan 10, 2007 4:06 pm     Reply with quote

I try to create a switch circuit from microcontroller which must to light on a led on pin B0 and light off a led on pin B1 when the input is ==0 and light on a led on pin B1 and light off a led on pin B0 when input is >0

i wrote the code bellow but the problem is that only the LED on pin B0 is light on unless the input is >0 and still light on for all the value of input



if (input(PIN_A0)==0){
delay_ms(10);
output_bit(PIN_B0,1);
output_bit(PIN_B1,0);
}
else{
delay_ms(10);
output_bit(PIN_B0,0);
output_bit(PIN_B1,1);
}








IS anyone know what is the problem????????
Ttelmah
Guest







PostPosted: Wed Jan 10, 2007 4:42 pm     Reply with quote

It is probably the classic PIC RMW problem (read modify write).
Have a look in the PIC data sheet, and a search on this forum, for these three words, and you should find a number of threads where this is described, as well as fixes for it. It is actually a hardware problem with the chip, especially when there is a significant load on an output pin (what resistors are you using to current limit the LED's).

Best Wishes
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