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

Please show me a fast way to clear porta and portb?

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







Please show me a fast way to clear porta and portb?
PostPosted: Wed Dec 04, 2002 3:39 am     Reply with quote

I have tryde to Read the CCS-Help and it recomend me this:
OUTPUT_A(0x00); //Clear PORTA
OUTPUT_B(0x00); //Clear PORTB
But it generate a lot becose you can set wath ever in this function.

I think this is it if not or if so please let me know.
#byte PORTA = 5
#byte PORTB = 6
void clearports()
{
PORTA = 0x00;
PORTB = 0x00;
}
Wy is this not in the help file?
Is this a bad way?
___________________________
This message was ported from CCS's old forum
Original Post ID: 9755
R.J.Hamlett
Guest







Re: Please show me a fast way to clear porta and portb?
PostPosted: Wed Dec 04, 2002 4:55 am     Reply with quote

:=I have tryde to Read the CCS-Help and it recomend me this:
:=OUTPUT_A(0x00); //Clear PORTA
:=OUTPUT_B(0x00); //Clear PORTB
:=But it generate a lot becose you can set wath ever in this function.
:=
:=I think this is it if not or if so please let me know.
:=#byte PORTA = 5
:=#byte PORTB = 6
:=void clearports()
:={
:=PORTA = 0x00;
:=PORTB = 0x00;
:=}
:=Wy is this not in the help file?
:=Is this a bad way?
It depends what you want to do.
The 'Output_A' format, will actually generate exactly the same code, if 'Fast_io' is enabled on the port. If not, then by default, the 'standard_io' form, will add the code to control the TRIS register as well, which is why this form then becomes larger. The 'porta=0' form, _only_ clears the output latch, but doesn't change the TRIS register. So if all you want ot do is clear the output latch, then this is fine, but if you want the result to be put onto the output pins, then it will not do what is needed.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 9758
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