View previous topic :: View next topic |
Author |
Message |
radres
Joined: 12 Apr 2007 Posts: 4
|
OUTPUT_FLOAT ( ), #USE STANDART_IO I DON'T UNDERSTAND |
Posted: Thu Apr 12, 2007 4:43 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
![](templates/subSilver/images/spacer.gif) |
radres
Joined: 12 Apr 2007 Posts: 4
|
Thanks |
Posted: Fri Apr 13, 2007 3:25 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 13, 2007 3:51 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat Apr 14, 2007 2:30 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat Apr 14, 2007 3:07 am |
|
|
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.
Hate it when this happens.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Zer0flag Guest
|
output_float() and TRIS |
Posted: Thu Apr 26, 2007 7:09 am |
|
|
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 |
|
|
![](templates/subSilver/images/spacer.gif) |
frequentguest Guest
|
|
Posted: Thu Apr 26, 2007 7:20 am |
|
|
What output_float( does is set the tris bit to input (1). |
|
![](templates/subSilver/images/spacer.gif) |
Zer0flag Guest
|
|
Posted: Thu Apr 26, 2007 7:30 am |
|
|
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). |
|
|
![](templates/subSilver/images/spacer.gif) |
frequentguest Guest
|
|
Posted: Thu Apr 26, 2007 10:54 am |
|
|
That's correct. Either with a set_tris_x() function call or an output_float() function call. |
|
![](templates/subSilver/images/spacer.gif) |
Zer0flag Guest
|
|
Posted: Thu Apr 26, 2007 1:16 pm |
|
|
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. |
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 26, 2007 1:23 pm |
|
|
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
.................... } |
|
|
![](templates/subSilver/images/spacer.gif) |
Zer0flag Guest
|
|
Posted: Thu Apr 26, 2007 2:00 pm |
|
|
Thanks a lot for the code. That's what I will do next time first
PCM programmer wrote: | To find out what a CCS function does, write a short test program,
compile it and look at the .LST file.
...
|
|
|
![](templates/subSilver/images/spacer.gif) |
|