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

Switch Statement

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







Switch Statement
PostPosted: Thu May 27, 2004 4:43 pm     Reply with quote

Hello everyone new to the forum. I have a question on a switch statement.

What I am doing is this

case 0x04:
c2 = 0;
c1 = 1;
delay_ms(500);
c1 = 0;
break;

on that particular case I just want to pulse c1 high for half a second but it doesnt work. The line goes high and stays high until any other case besides 4 is recognized. Any idea why? Can I not use a delay in there or what. Im just working on a project on my code knowledge is very limited by I appreciate any help.

Thanks
B
Guest








PostPosted: Thu May 27, 2004 6:01 pm     Reply with quote

Try this:
case 0x04:
output_bit(PIN_C2,0);
output_bit(PIN_C1,1);
delay_ms(500);
output_bit(PIN_C1,0);
break;
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Thu May 27, 2004 6:27 pm     Reply with quote

Or you might try:

CASE 0x04:
output_low(PIN_C2);
output_high(PIN_C1);
delay_ms(500);
output_low(PIN_C1);
break;

Ronald
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