Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

floating point probem in pic18f452

Status
Not open for further replies.

yaswanthsai

Newbie level 6
Joined
Jul 19, 2009
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,362
Hi all, i want to send floating point value to 8 bit port of pic18f452. i am using HITECH C software for coding. for example a=2,4536, i want to send this value to any of PORT of pic18f452. help me in this.
 

You should clarify, how you intend the 8-Bit port to represent a float value. The HITECH C compiler is supporting all float operations provided by the C standard.
 

Are you want to see the floating number on seven segment using port or trying something else?
 

actually i am doing wireless pressure control. for this i am preparing two nodes. in one node i am taking voltage value from pressure tank and i am transmitting the same value to the control node. whr i am implementing PI algorithm to control control valve. for this Kp, KI ,error values are in floating point values. so i want to take PI value which is in floating point and i want to trasmitt to the DAC from the 8 bit port. from DAC i wil take corresponding current value to control control valve.

so help me how to take floating point value to the 8 bit port to send to the DAC0808.
 

The DAC0808 is only an 8-bit DtoA converter, you cant send it floating point values.
One way to do it would be to convert your output from the PI controller to a percentage of full scale. Then output to the dac the same percentage of the dacs full scale.
 

can u plz give any example c coding how to convert percentage full scale from pi controller.
 

The output from the pressure tank must have a full scale value?
So the percentage from the PI controller is

PerCentOutput = (PI_output / Pressure_full_Scale) * 100;

Full scale for the DAC is 256.

The output to the DAC is (PerCentOutput / 100) * 256;

You could simplify this to

DAC = (PI_output / Pressure_full_Scale) * 256;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top