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

OUTPUT_FLOAT ( ), #USE STANDART_IO I DON'T UNDERSTAND

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



Joined: 12 Apr 2007
Posts: 4

View user's profile Send private message

OUTPUT_FLOAT ( ), #USE STANDART_IO I DON'T UNDERSTAND
PostPosted: Thu Apr 12, 2007 4:43 am     Reply with quote

Hi. Please give me a help for that i can't understand these functions. Could Anybody tell me for the functions?

output_float ( )
#use standart_io
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Apr 12, 2007 5:52 am     Reply with quote

You will find the requested info in the Manual, anyway the following threads will help you:

http://www.ccsinfo.com/forum/viewtopic.php?t=18060&highlight=standardio
http://www.ccsinfo.com/forum/viewtopic.php?t=19130&highlight=standardio


Humberto
radres



Joined: 12 Apr 2007
Posts: 4

View user's profile Send private message

Thanks
PostPosted: Fri Apr 13, 2007 3:25 pm     Reply with quote

Thanks for links. But i can't understand "output_float()" function yet. Could you help me for the function (output_float() )? Also i want to more information and examples for the #use standart_io, #use fast_io. What are the difference?Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 13, 2007 3:51 pm     Reply with quote

Quote:
But i can't understand "output_float()" function yet. Could you
help me for the function (output_float() )

Read Ttelmah's explanation of output_float() in this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=30448&start=1

Quote:

Also i want to more information and examples for the #use standard_io,
#use fast_io. What are the difference ?

Did you read those links ? They have very good explanations.
Ttelmah
Guest







PostPosted: Sat Apr 14, 2007 2:30 am     Reply with quote

Ok.
All 'output_float' does, is switches the pin to be an _input_, but does not read the data.
This switches off the drivers, so the pin goes high impedance. If it is being used as an 'output', it is then 'floating', hence the name.

Best Wishes
Ttelmah
Guest







PostPosted: Sat Apr 14, 2007 3:07 am     Reply with quote

Sorry PCM,
Didn't see you had already pointed this out. I was using a small screen, and 'missed' your last post, when I replied. Smile
Hate it when this happens.

Best Wishes
Zer0flag
Guest







output_float() and TRIS
PostPosted: Thu Apr 26, 2007 7:09 am     Reply with quote

Hi!

As far as I understood one can save program memory by #use fast_io(port). The con is that one has to set the TRIS registers manually for input or output. If pins don't change directions this has to be done only in the beginning o the program? Right?

Unfortunately I don't quite understand how I have to set the TRIS when unsing output_float() - as input (1) or as output (0)?

Thanks for any help!
Angelo

Ttelmah wrote:
Ok.
All 'output_float' does, is switches the pin to be an _input_, but does not read the data.
This switches off the drivers, so the pin goes high impedance. If it is being used as an 'output', it is then 'floating', hence the name.

Best Wishes
frequentguest
Guest







PostPosted: Thu Apr 26, 2007 7:20 am     Reply with quote

What output_float( does is set the tris bit to input (1).
Zer0flag
Guest







PostPosted: Thu Apr 26, 2007 7:30 am     Reply with quote

Thanks! So I suppose I have to set it manually when using fast_io.

frequentguest wrote:
What output_float( does is set the tris bit to input (1).
frequentguest
Guest







PostPosted: Thu Apr 26, 2007 10:54 am     Reply with quote

That's correct. Either with a set_tris_x() function call or an output_float() function call.
Zer0flag
Guest







PostPosted: Thu Apr 26, 2007 1:16 pm     Reply with quote

You mean the output_float() will auto-set the TRIS bit even in fast_io mode? Or did I misunderstand?

frequentguest wrote:
That's correct. Either with a set_tris_x() function call or an output_float() function call.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 26, 2007 1:23 pm     Reply with quote

To find out what a CCS function does, write a short test program,
compile it and look at the .LST file.

Example:
You have a question about the code produced by the output_float()
function when using "fast_io" mode.

Here is the short test program.
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

#use fast_io(B)

//===========================
void main()
{
output_float(PIN_B0);

while(1);
}


Here is the .LST file, after compiling with PCH vs. 4.032:
You can see that it sets pin B0 as an input.
Code:
.................... void main()
.................... {
0004:  CLRF   TBLPTRU
0006:  BCF    RCON.IPEN
0008:  CLRF   FSR0H
000A:  CLRF   FSR0L
000C:  BSF    ADCON1.PCFG0
000E:  BSF    ADCON1.PCFG1
0010:  BSF    ADCON1.PCFG2
0012:  BCF    ADCON1.PCFG3
.................... output_float(PIN_B0);
0014:  BSF    TRISB.0    // It sets pin B0 as an input pin.
.................... 
.................... 
.................... 
.................... while(1);
0016:  BRA    0016
.................... }
Zer0flag
Guest







PostPosted: Thu Apr 26, 2007 2:00 pm     Reply with quote

Thanks a lot for the code. That's what I will do next time first Smile

PCM programmer wrote:
To find out what a CCS function does, write a short test program,
compile it and look at the .LST file.
...
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