void Calculate_Power(){
/* the formula for VSWR =(1+ sqrt(Prev/Pfwd))/(1-sqrt(Prev/Pfwd))
/ just watching the two ADC inputs 0-1023
/ I used CH0 and CH1 as an0 and an1, so int temp =CH1/CH0
/ I made temp1 a float of int temp so I could use the float sqrt functions
/ temp2 is the sqrt of temp1, bla bla bla and you can follow the rest
/ is there a more easy way? since the math functions to me arn't there?
/ perhaps I have missed something?? thanks , chuck
/
*/
float temp1,temp2,temp3,temp4;
temp1 = float32_from_int32(temp); // this is from temp=(CH1/CH0);
temp2 = float32_sqrt(temp1);
temp3 = float32_add(1,temp1);
temp3 = float32_sub(1,temp1);
temp4 = float32_div(temp3,temp4);
}
I'm trying to build a power meter for hamradio, I am using the 2 adc inputs. All the program works fine except now I want to try to do power and swr calculations
it seems way too convoluted this way to me plus I am going to run out of space in the 16f877a, I also need to convert the 1023 bit total to dBm which will be more math.
too much for this PIC??
thanks! Happy Holidays.