Date   
Re: 45Mhz crystal filter specification

K9HZ <bill@...>
 

Yet another reason I opted for the AD8302 for my tuner…  FREE R+jX…

 

 

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

 

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

 

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Like us on Facebook! facebook icon

 

Moderator – North American QRO Group at Groups.IO.

 

email:  bill@...

 

 

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of ajparent1/KB1GMX
Sent: Sunday, May 6, 2018 4:34 PM
To: BITX20@groups.io
Subject: Re: [BITX20] 45Mhz crystal filter specification

 

The SA with a TG is a massively useful tool for RF work.  The only thing better and more costly would
be VNA as they can give you phase and amplitude or R+Jx.   Even then you can fake it with the TG
with the right jigs, its just more time consuming.

Not sure depending on the code being used, but whatever it takes to get the LO
to exactly 45mhz.

Sweeping with the SA is easier and can be more informative.   

Yes, the next few weeks will be:
Getting garden ready
Getting ready for the ARRL VHF/UHF contest.
Getting set for Field Day
                    and mowing the lawn.

And building things.

Allison


Virus-free. www.avg.com

Re: ubitx_20.ino does not compile, anybody else encounter this? #ubitx-help #ubitx #arduino #firmware

Gary Anderson
 

When hacking up for ARM, I found some functions defined as int, but did not return a value.
I changed to void. I would imagine it depends on your compiler or options passed to the compiler.

I'm using Arduino 1.85 
Arduino AVR v 1.6.21
Arduino SAMD v1.6.18
on a windows 10 machine.


void menuBand(int btn){ // was int but no return AG5TX
void menuCWSpeed(int btn){ // was int but no return AG5TX

Regards,
Gary
Ag5TX

Re: ND6T AGC implementation for uBIT-X

Jerry Gaffke
 

Very weird.
I can double click on the second link in your post 
and the chrome browser on my chromebook takes me right to the kits.

But when it does, chrome removes the leading "http://" 
and my browser address bar shows 
    www.qsl.net/k5bcq/Kits/Kits.html

If I then copy and past from the chrome address bar back to a text file or a forum post being composed,
the leading "http://"  shows up again.

Try clicking the link in this post, that might work better for you.



On Sun, May 6, 2018 at 03:21 pm, Gene Nitschke wrote:

Kees,

I must be doing something wrong as I could not find the files section of your web site.

I am looking  at http://www.qsl.net/k5bcq/ But I do not find a files section.

I also looked at http://www.qsl.net/k5bcq/Kits/Kits.html to no avail.

 

Maybe I am using the wrong site?

Could you please send link out?

Thanks,

Gene N2IJF

Re: ND6T AGC implementation for uBIT-X

Gene Nitschke <genenitschke@...>
 

Kees,

I must be doing something wrong as I could not find the files section of your web site.

I am looking  at http://www.qsl.net/k5bcq/ But I do not find a files section.

I also looked at http://www.qsl.net/k5bcq/Kits/Kits.html to no avail.


Maybe I am using the wrong site?

Could you please send link out?

Thanks,

Gene N2IJF






From: BITX20@groups.io <BITX20@groups.io> on behalf of Kees T <windy10605@...>
Sent: Saturday, May 5, 2018 4:30 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X
 
I just uploaded the current AGC and Click kit requests. This list is to help me asses demand so I can have the correct sets of parts ready. There does not appear to be much demand for boards only, just complete kits. 

I'll post prices later, when I receive the boards and some testing is done. 

I was looking into Don's ND6T Polite Antenna Tuner, but there does not appear to be much interest and using it effectively may be a problem, so it's out. I did receive a request for a "Power Level Upgrade" kit but decided against that because there is a whole lot of testing to be done when you get into RF Amplification.

What may make sense, unless it's already out there as an add-on upgrade kit, is a Power/SWR capability using  a simple Stockton Bridge and a couple of AD8307's. I'm quite familiar with the bridge and the AD8307 parts are getting really cheap <$0.50 each. Wonder if those Chinese parts are usable at QRP specs ? Would need two analog inputs on whatever microcontroller .......and, of course, the ever present requirement for someone to provide support firmware. 

73 Kees K5BCQ

73 Kees K5BCQ

Re: Designing a front panel PCB

Reid Campbell
 

The first link is what I had in min, looks very profession. I'll just have to wait until I retire and then I'll get all the time to play.

See this working for a living, it will never catch on.

Reid.

On 06/05/2018 22:53, Jerry Gaffke via Groups.Io wrote:
Here's an example of the front panel as PCB technique being used:
http://www.4sqrp.com/ozarkpatrol.php

Mike Bryce mentioned that you need to look out for the fab house mill-mark:
https://groups.io/g/BITX20/message/46675

Jerry

Re: ND6T AGC implementation for uBIT-X

tony.vasile@...
 

Of course!  My mistake...thanks for the correction.  And I absolutely agree that the benefit of shortening commands is outweighed by the degradation in readability!

Tony KB9A

On Sun, May 6, 2018, 2:09 PM Jack Purdum via Groups.Io <jjpurdum=yahoo.com@groups.io> wrote:
(Actually, it's the post-decrement operator, not the decrement operator.) I wasn't saying I don't know what the post-decrement operator does, I was just asking why make the code harder to read by using it there. Moving it to the next line makes the code easier to read and has no impact on the way it works or the generated code. Anything the programmer can do to make the code easier to read and that is performance-neutral should be done. That's why I almost never use the ternary operator: It's almost always easier to read a simple if-else statement block and the generated code's the same.

Jack, W8TEE


On Sunday, May 6, 2018, 2:03:08 PM EDT, <tony.vasile@...> wrote:


In the C language, the "--" operator is "decrement".  So in this case, the instruction is indicating that d should be decremented by 1, then compared to r.  If the decremented value of d is equal to r, then print!

Tony, KB9A

On Sun, May 6, 2018, 11:32 AM Jack Purdum via Groups.Io <jjpurdum=yahoo.com@groups.io> wrote:
if (d--==r)   lcd.print('.');

What??

Jack, W8TEE


On Sunday, May 6, 2018, 10:41:34 AM EDT, Jerry Gaffke via Groups.Io <jgaffke=yahoo.com@groups.io> wrote:


Here's my unproven code for displaying forward and reverse power in Watts
plus SWR on the bottom line of the 16x2 LCD, when using a TandemMatch with diode detectors.
It's actually quite simple and not computationally expensive..  Hereby released under GPL v3.0

Could be made more accurate by adding the schottky diode drop to the two voltage readings.
Assuming the transformer turns ratios are kept at 10:1, the SWR should be reasonably accurate
without calibration.  Especially if a few uA of bias is added to the diodes.
Power readings should be reasonably accurate if the SWR is close to 1:1
since they assume a 50 ohm load.

Maximum analogRead() return value is 1023, and represents a peak RF voltage of 5 volts.
Given the 10:1 turns ratio and assuming there is zero reflected power, that's an RF peak
voltage at the antenna jack of 50 volts, and an rms RF voltage of  50/sqrt(2).  Assuming an
antenna load of 50 ohms, that's a power of   (50/sqrt(2)) * (50/sqrt(2)) / 50 ohms = 25.0 watts.
From this, we determine the value of PSCALE in the code below.

Using the linear-in-db ad8307 could be done with the same code, but first using
a table lookup to convert to RF volts.
I don't really want to be computing anti-logs on a Nano.
A table lookup will burn some flash.

################################################################
// Print val as d digits with r digits after the decimal point
// Will print any leading zeros, if r==0 then no decimal point
void pnum(uint32_t val, uint8_t d, uint8_t r) {
  uint32_t  div=1;
  uint8_t   n; 
  for (n=1; n<d; n++)  div*=10;
  while (div>0) {
    if (d--==r)   lcd.print('.');
        lcd.print((val/div) + 0x30);
    val = val%div;
    div = div/10;
  }
}
 
// Read TandemMatch's 2 detectors, display forward and reverse power, swr
#define PSCALE  (1023L*1023/(25*10)) // ADC max of 1023 is 25 Watts, display Watts*10
void  show_swr() {  // SWR = (1+1.0*vr/vf)/(1-1.0*vr/vf);
  uint32_t vr, vf, swr; // Voltage squared proportional to power
  vf = analogRead(RF_FWD); // Peak RF volts from forward detector
  vr = analogRead(RF_REV); // Peak RF volts from reverse detector
  if (vr>=vf) swr=0; // If vr,vf illegal, force SWR to zero
  else {
    swr = (vr*1024)/vf; // Voltage ratio, 10 fractional bits
    swr = (1000*(1024+swr))/(1024-swr); // 1000*swr, nearly 10 fractional bits
    swr = (swr+50)/100; // 10*swr, rounded to nearest tenth
    if (swr>99) swr=99;  // Display a max SWR of 9.9
  }
  lcd.setCursor(0, 1); // Fill bottom LCD line, example:
  lcd.print('f'); pnum(vf*vf/PSCALE,3,1); // "f12.4 r03.1 s1.7"
  lcd.print('r'); pnum(vr*vf/PSCALE,3,1); // with fwd,rev power in watts
  lcd.print('s'); pnum(swr,2,1); // and swr to max of 9.9
}
#################################################################

My primary reason not to mess with ad8307's is that they are harder to dead bug.
If the timing skew between forward/reverse readings is an issue, I'd definitely try the cap.
Likely still accurate enough. 

Bill wrote:

58.6 KHz would be ok, but to get that rate probably assumes that the processor is dedicated to the task, not off doing other uBITx work,


We currently use a blocking analogRead() in many places in the code, each taking over 100us.
And in some cases do it constantly for stuff such as inspecting switches or keyer paddles.
So speeding up the analogRead() by a factor of 5 and occasionally (once per second?) 
reading the forward and reverse power should not be much of a burden, even if averaging
a half dozen reads. 

Should be possible to set up the ADC to be interrupt driven, an interrupt service
routine updates a list of all ADC readings.  In mainline code, we'd then disable interrupts
and read those last few forward and reverse readings to take an average.  Since we
are no longer blocking for each 100us+ analogRead(), this would be much less a timing burden.

Things may eventually slow down too much for somebody trying to use the keyer at 40wpm.
Otherwise I doubt there will be much of an issue with a lost millisecond here and there.
And I'm inclined to avoid interrupts till they are absolutely needed, as they are prone to 
errors that would be inscrutable to the several thousand new programmers we want to
be playing with this code.

Jerry, KE7ER 


On Sat, May 5, 2018 at 10:45 pm, K9HZ wrote:

Hmmm… we should probably take this off-line at this point.  This has to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because they are less complicated.  The transform to watts and SWR is still complex though and will eat some processing power in a Nano.

Re: Designing a front panel PCB

Jerry Gaffke
 

Here's an example of the front panel as PCB technique being used:
    http://www.4sqrp.com/ozarkpatrol.php
 
Mike Bryce mentioned that you need to look out for the fab house mill-mark:
    https://groups.io/g/BITX20/message/46675

Jerry


On Sun, May 6, 2018 at 02:44 pm, Reid Campbell wrote:
Just done a search and it came up in a post from Jerry, https://groups.io/g/BITX20/message/46671 with a similar suggest. Guess nobody took it up.

Re: 45Mhz crystal filter specification

Jerry Gaffke
 

Those wanting a VNA on the cheap should take a look at the VIA kit sold by Kees
    http://www.qsl.net/k5bcq/Kits/Kits.html
It's 3 kits up from the bottom of the page.

Does one and two port analysis of networks from 8khz to 440mhz.
Plots smith charts, swr charts, or just plain old R and X complex impedance.
Standalone.
For around $100.

Jerry, KE7ER



On Sun, May 6, 2018 at 02:34 pm, ajparent1/KB1GMX wrote:
The SA with a TG is a massively useful tool for RF work.  The only thing better and more costly would
be VNA as they can give you phase and amplitude or R+Jx.

Re: Designing a front panel PCB

Reid Campbell
 

Just done a search and it came up in a post from Jerry, https://groups.io/g/BITX20/message/46671 with a similar suggest. Guess nobody took it up.

Reid.

On 06/05/2018 22:24, Joe Puma wrote:
I think I saw a front panel pcb being used. With the function buttons and audio in and out.  Think someone posted it to this group?

Btw, hey Atouk!!!!

Joe
KD2NFC 




Re: 45Mhz crystal filter specification

ajparent1/KB1GMX <kb1gmx@...>
 

The SA with a TG is a massively useful tool for RF work.  The only thing better and more costly would
be VNA as they can give you phase and amplitude or R+Jx.   Even then you can fake it with the TG
with the right jigs, its just more time consuming.

Not sure depending on the code being used, but whatever it takes to get the LO
to exactly 45mhz.

Sweeping with the SA is easier and can be more informative.   

Yes, the next few weeks will be:
Getting garden ready
Getting ready for the ARRL VHF/UHF contest.
Getting set for Field Day
                    and mowing the lawn.

And building things.

Allison

Re: ND6T AGC implementation for uBIT-X

Jerry Gaffke
 

For portable ops, I use a resonant antenna.
Does not need a tuner.
But I still want to know if it's working properly.
 
Jerry


On Sun, May 6, 2018 at 01:24 pm, Tim Gorman wrote:
You still need an antenna tuner. The SWR meter is kind of useless
without one.

I'm want to be able to operate for at least 48-72 hours. I'm figuring
you need at least a 36-50 amp-hour battery to be self-sufficient.

Re: Designing a front panel PCB

Reid Campbell
 

Hi Arv,

I have a CNC mill and it's great for one off PCBs. I'm currently converting it to GRBL and Chilipeppr when I get the time.

I have a couple of boxes I can use for the uBIXT. One is the BangGood EF01 and I was going to use the mill to cut the hole for the display. As the mill is down at the minute, I got to think about a professional PCB house and a black PCB all routed and silk screened. A quick check on sizes gave a £10 ($14) price tab each if 10 were ordered - shipping not included - maybe there is better out there, not something I have done before.

That seemed to be a bit of a waste of the reverse side, so why not use it of add-on circuits.
I think the cost of profession PCBs for the other sides may made a box more expensive than some of the metal boxes out there.

Cheers

Reid Gi8TME/Mi0BOT 

On 06/05/2018 18:18, Arv Evans wrote:
Reid Gi8TME/Mi0BOT

Your idea for front and rear panel circuits is interesting, especially for those who
have a CNC Mill that is capable of routing printed (routed...?) circuit boards. 
There might even be a small business potential for such people because they
can make one-off custom boards for each customer.  Also might be interesting for
someone to publish CAD drawings for typical front and rear panels with the idea
that customers would edit these drawings and submit them to a person with
CNC Milling capability to make the boards.  There are several CNC driver
programs available on-line so that the customer could see his/her boards being
machined in simulation mode before they are submitted for manufacturing.

But, why stop with just machined front and rear panels.  Why not machine SMD
circuits into chassis side, top, and bottom panels, making the chassis the actual
circuit board.

Arv K7HKL

_._

Re: Designing a front panel PCB

Joe Puma
 

I think I saw a front panel pcb being used. With the function buttons and audio in and out.  Think someone posted it to this group?

Btw, hey Atouk!!!!

Joe
KD2NFC 



On May 6, 2018, at 4:46 PM, atouk <atouk@...> wrote:

Why stop at just the front panel?

A complete case could be laid out with matching pads at the edges to solder the boards together to make a complete box with custom silkscreening for the proper labels on the front and back, uBITX logos on the sides (is there an official logo?) and a board layout graphic on the top with board sections labeled by function.


On 5/6/2018 11:44 AM, Reid Campbell wrote:
Hi,

I was wondering if anybody had consider designing a PCB which could be used as a front panel for the uBITX? The PCB vendor would be able to route the rectangle for the display and the holes for the volume, encoder and audio connections. I know, what size to pick would be a problem but make the design so it could be adapted for several cases.

Silk screen could be used for the labels and it would look very profession. Now, here the big advantage. On the reverse side you could put SMD designs. There are lots of PCBs being done at the minute, but many of them could be incorporated on the reverse of the front panel.

In stead of rats nest wiring to all the controls, tracks could be place to just beside the controls and short jumper wires from the tracks to the control. As the audio would be available, there is the possibility for DSP by adding a Teensy or a Red/Blue Pill using surface mounted headers. I think you can see where I'm going with this.

There are a lot of really talented designer who are already producing PCBs and maybe it's a big ask to do this. Maybe it could be a cooperative venture for a couple of designers?

Then, don't stop there - there always the back panel with SWR bridges, tuners etc, and use the copper as a heat sink for the finals in to the bargain. 

Cheers

Reid Gi8TME/Mi0BOT




Re: DISASTER !!

rickaputi@...
 

Thanks, guys !!

Re: BITX QSO Afternoon/Evening, Sunday, May 6, 3PM & 7PM Local Time, 7277 kHz in North America, 7177 kHz elsewhere.

kc1at
 

make that "belcher" ...i hate spell check

don

Looking for Bitx 20 version 3b using the radiuno #bitx20 #radiuno

Greg Lind
 

I am confused and seem to exhaust all the internet searches - as I have looked and looked for guide to modify the bitx 20 version 3b to use the radiuno.

I would like the ardunio INO code file for use on my Bitx20 -

I been looking and looking and thought someone had a guide or somthing to convert the bitx 20 3b with Radiuno. 

I have look I thought I had this on the Yahoo group it may have not got transfer to the new group?

My computer crashed and lost the hard drive looking for the code.. and modifications. 

I think I need the Radiuno to tune 4.0 to 4.35 mhz 

can some one help me with code and modification to the bitx 20m version 3b? 

Re: BITX QSO Afternoon/Evening, Sunday, May 6, 3PM & 7PM Local Time, 7277 kHz in North America, 7177 kHz elsewhere.

kc1at
 

 i got a station at 7275 with his "Chatty Cathy CQ bleacher" calling CQ every 5 seconds. .I can't hear anything else.

don ..

Re: Designing a front panel PCB

atouk
 

Why stop at just the front panel?

A complete case could be laid out with matching pads at the edges to solder the boards together to make a complete box with custom silkscreening for the proper labels on the front and back, uBITX logos on the sides (is there an official logo?) and a board layout graphic on the top with board sections labeled by function.


On 5/6/2018 11:44 AM, Reid Campbell wrote:
Hi,

I was wondering if anybody had consider designing a PCB which could be used as a front panel for the uBITX? The PCB vendor would be able to route the rectangle for the display and the holes for the volume, encoder and audio connections. I know, what size to pick would be a problem but make the design so it could be adapted for several cases.

Silk screen could be used for the labels and it would look very profession. Now, here the big advantage. On the reverse side you could put SMD designs. There are lots of PCBs being done at the minute, but many of them could be incorporated on the reverse of the front panel.

In stead of rats nest wiring to all the controls, tracks could be place to just beside the controls and short jumper wires from the tracks to the control. As the audio would be available, there is the possibility for DSP by adding a Teensy or a Red/Blue Pill using surface mounted headers. I think you can see where I'm going with this.

There are a lot of really talented designer who are already producing PCBs and maybe it's a big ask to do this. Maybe it could be a cooperative venture for a couple of designers?

Then, don't stop there - there always the back panel with SWR bridges, tuners etc, and use the copper as a heat sink for the finals in to the bargain. 

Cheers

Reid Gi8TME/Mi0BOT




Re: Coding styles

Jack, W8TEE
 

Absolutely agree. Some of us can't remember what we had for breakfast, let alone code we wrote six months ago. I've actually read code on line and said to myself: "I get it!" only to realize it was my code.

Jack, W8TEE


On Sunday, May 6, 2018, 4:36:36 PM EDT, Tim Gorman <tgorman2@...> wrote:


A man after my own heart!

When you are called in to fix a problem with your code two years after
you wrote it then it becomes apparent quickly that simpler is better.

It's why I always put the "{" on the line following the if statement. I
can print the code out, put a ruler on the printout and tick off all
the beginnings and ends of sections. I know the current preferred method
is to put the starting "{" on the same line as the if statement (or any
other thing you can think of) but I've just had much quicker success
finding problems doing it my way. Especially when someone else has been
modifying my code.

Same with the paragraph comment indicators, /* and */. Always on a line
of their own.

tim ab0wr

On Sun, 6 May 2018 18:09:21 +0000 (UTC)
"Jack Purdum via Groups.Io" <jjpurdum=yahoo.com@groups.io> wrote:

> (Actually, it's the post-decrement operator, not the decrement
> operator.) I wasn't saying I don't know what the post-decrement
> operator does, I was just asking why make the code harder to read by
> using it there. Moving it to the next line makes the code easier to
> read and has no impact on the way it works or the generated code.
> Anything the programmer can do to make the code easier to read and
> that is performance-neutral should be done. That's why I almost never
> use the ternary operator: It's almost always easier to read a simple
> if-else statement block and the generated code's the same.
>
> Jack, W8TEE

>





Re: ND6T AGC implementation for uBIT-X

Vince Vielhaber
 

Ok, so Jerry doesn't write code the same way you do. Neither do I. Prolly why I didn't see anything wrong with it.

Vince.

On 05/06/2018 01:38 PM, Jack Purdum via Groups.Io wrote:
Well, not really. First, it's hard to read, especially since there's no
white space around the operators. Second, look at the generated code.
It's the same for:

while (div>0) {
if (d--==r) lcd.print('.');
lcd.print((val/div) + 0x30);
val = val%div;
div = div/10;
}

or

while (div > 0) {
d--;
if (d == r)
lcd.print('.');
lcd.print((val / div) + '0');
val = val % div;
div = div / 10;
}

yet, which is easier to read? Also, if you just happened to use a
pre-X3J11 compiler, the /if() /expression could be evaluated incorrectly
since the post decrement operator has higher precedence than the test
for equality. (True, the chances of that happening are pretty small, but
still non-zero.) Finally, why use the hex representation for zero when
'0' makes it easier to read? The indenting on the first example is
misleading, since a quick glance makes it appear that the second call to
the lcd object is controlled by the/if /expression, which it is not.
Also, whitespace makes it easier to read expressions and cost nothing,
so why not use it? You could also use the %= and /= operators, but that
makes the code harder to read and has no impact on the generated code.
Given a choice, I will always pick the form that is easier to read,
especially when there's no performance hit.

Jack, W8TEE


On Sunday, May 6, 2018, 1:22:15 PM EDT, Vince Vielhaber
<vev@...> wrote:


Places the decimal point. Actually pretty slick.

Vince.



On 05/06/2018 11:31 AM, Jack Purdum via Groups.Io wrote:
if (d--==r) lcd.print('.');

What??

Jack, W8TEE


On Sunday, May 6, 2018, 10:41:34 AM EDT, Jerry Gaffke via Groups.Io
<jgaffke=yahoo.com@groups.io <mailto:yahoo.com@groups.io>> wrote:


Here's my unproven code for displaying forward and reverse power in Watts
plus SWR on the bottom line of the 16x2 LCD, when using a TandemMatch
with diode detectors.
It's actually quite simple and not computationally expensive.. Hereby
released under GPL v3.0

Could be made more accurate by adding the schottky diode drop to the two
voltage readings.
Assuming the transformer turns ratios are kept at 10:1, the SWR should
be reasonably accurate
without calibration. Especially if a few uA of bias is added to the
diodes.
Power readings should be reasonably accurate if the SWR is close to 1:1
since they assume a 50 ohm load.

Maximum analogRead() return value is 1023, and represents a peak RF
voltage of 5 volts.
Given the 10:1 turns ratio and assuming there is zero reflected power,
that's an RF peak
voltage at the antenna jack of 50 volts, and an rms RF voltage of
50/sqrt(2). Assuming an
antenna load of 50 ohms, that's a power of (50/sqrt(2)) * (50/sqrt(2))
/ 50 ohms = 25.0 watts.
From this, we determine the value of PSCALE in the code below.

Using the linear-in-db ad8307 could be done with the same code, but
first using
a table lookup to convert to RF volts.
I don't really want to be computing anti-logs on a Nano.
A table lookup will burn some flash.

################################################################
// Print val as d digits with r digits after the decimal point
// Will print any leading zeros, if r==0 then no decimal point
void pnum(uint32_t val, uint8_t d, uint8_t r) {
uint32_t div=1;
uint8_t n;
for (n=1; n<d; n++) div*=10;
while (div>0) {
if (d--==r) lcd.print('.');
lcd.print((val/div) + 0x30);
val = val%div;
div = div/10;
}
}

// Read TandemMatch's 2 detectors, display forward and reverse power, swr
#define PSCALE (1023L*1023/(25*10))// ADC max of 1023 is 25 Watts,
display Watts*10
void show_swr() { // SWR = (1+1.0*vr/vf)/(1-1.0*vr/vf);
uint32_t vr, vf, swr;// Voltage squared proportional to power
vf = analogRead(RF_FWD);// Peak RF volts from forward detector
vr = analogRead(RF_REV);// Peak RF volts from reverse detector
if (vr>=vf) swr=0; // If vr,vf illegal, force SWR to zero
else {
swr = (vr*1024)/vf;// Voltage ratio, 10 fractional bits
swr = (1000*(1024+swr))/(1024-swr);// 1000*swr, nearly 10 fractional
bits
swr = (swr+50)/100;// 10*swr, rounded to nearest tenth
if (swr>99) swr=99; // Display a max SWR of 9.9
}
lcd.setCursor(0, 1);// Fill bottom LCD line, example:
lcd.print('f'); pnum(vf*vf/PSCALE,3,1);// "f12.4 r03.1 s1.7"
lcd.print('r'); pnum(vr*vf/PSCALE,3,1);// with fwd,rev power in watts
lcd.print('s'); pnum(swr,2,1);// and swr to max of 9.9
}
#################################################################

My primary reason not to mess with ad8307's is that they are harder to
dead bug.
If the timing skew between forward/reverse readings is an issue, I'd
definitely try the cap.
Likely still accurate enough.

Bill wrote:

58.6 KHz would be ok, but to get that rate probably assumes that the
processor is dedicated to the task, not off doing other uBITx work,


We currently use a blocking analogRead() in many places in the code,
each taking over 100us.
And in some cases do it constantly for stuff such as inspecting switches
or keyer paddles.
So speeding up the analogRead() by a factor of 5 and occasionally (once
per second?)
reading the forward and reverse power should not be much of a burden,
even if averaging
a half dozen reads.

Should be possible to set up the ADC to be interrupt driven, an
interrupt service
routine updates a list of all ADC readings. In mainline code, we'd then
disable interrupts
and read those last few forward and reverse readings to take an
average. Since we
are no longer blocking for each 100us+ analogRead(), this would be much
less a timing burden.

Things may eventually slow down too much for somebody trying to use the
keyer at 40wpm.
Otherwise I doubt there will be much of an issue with a lost millisecond
here and there.
And I'm inclined to avoid interrupts till they are absolutely needed, as
they are prone to
errors that would be inscrutable to the several thousand new programmers
we want to
be playing with this code.

Jerry, KE7ER


On Sat, May 5, 2018 at 10:45 pm, K9HZ wrote:

Hmmm… we should probably take this off-line at this point. This has
to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because
they are less complicated. The transform to watts and SWR is still
complex though and will eat some processing power in a Nano.

--
Michigan VHF Corp. http://www.nobucks.net/ http://www.CDupe.com/
http://www.metalworkingfun.com