I use this code to read the forwardpower
and this for reflected powerCode:ADCIN 0, adval ' Read channel 0 to adval dummy = adval * 5 * 10 ' Multiply to load internal registers with 32-bit value value = Div32 1023 ' Divide 32-bit value by word and store in word forwardpower = (value*value)/50
and the type for SWR is:Code:ADCIN 1, adval1 ' Read channel 0 to adval dummy1 = adval1 * 5 * 10 ' Multiply to load internal registers with 32-bit value value1 = Div32 1023 ' Divide 32-bit value by word and store in word reflectedpower = (value1*value1)/50
..........1 + square root(reflectedpower/forwardpower)
SWR = --------------------------------------------
..........1 - square root(reflectedpower/forwardpower)
Any help how to show the SWR on LCD;
Last edited by savnik; - 30th March 2007 at 05:50.
The largest ADVAL1 can be is 1023
The largest dummy can be is 1023 * 5 * 10 = 51150 (which is 16 bits or less)
Why do you do the * 5 * 10, why not * 50? and why *50?
You do not need DIV32 since you never exceed 16 bits with dummy
The same goes for ADVAL calcs
In final form, your
RP = (ADVAL1*50/1023)^2/50
FP = (ADVAL*50/1023)^2/50
If you plug these into your SWR equation and reduce, you get
SWR = (ADVAL1+ADVAL)/(ADVAL1-ADVAL), which should be easy to deal with
However, with all this noted, I do not think you are going to get what you want ... or will you? I haven't yet tried to follow this thread in any depth.
Last edited by paul borgmeier; - 30th March 2007 at 08:46. Reason: reduced equation further
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks