![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Patrik Åkerlind Guest
|
Please show me a fast way to clear porta and portb? |
Posted: Wed Dec 04, 2002 3:39 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
R.J.Hamlett Guest
|
Re: Please show me a fast way to clear porta and portb? |
Posted: Wed Dec 04, 2002 4:55 am |
|
|
:=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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|