Date   
Re: Coding styles

 

First coding ~ was typing games out of Hot CoCo magazine into everything from 4k to 64k color computers with my son….color basic…

Then first job coding was a little columnar based RPG on AS/400’s…..if you can see the girl in the red dress….then you were good to go….

But, I immediately pushed myself to head of the pack and was an early adopter of free form RPG, a quasi- ‘real’ language with sort of procedures….

In my travels….I found two kinds of programmers….hoarders and sharers…..

Those who think they are so slick they can write code that no one else can maintain….therefore maintaining a sense of false job security….some for a while (these are your stressful, suicidal coders)…..always on call over night to maintain their nightmares…..not much into sharing anything…..

And then I found those who eagerly shared the latest whizz bang routine they had come up with…..along with the documentation to allow you to comfortably use it….so it was always easy to share what you did with them….

Probably some of the hard to maintain code is from laziness….(from experienced lazy programmers…..new programmers might be given a little slack….but not after any intro like this), and some might be from rushed deadlines in the business world and self imposed deadlines in hobby stuff….but, I found most of the hard to maintain code in the business world….came from greedy people…..

The one thing extra I would add…..is add those comments when you write the code…..too many reasons to list to do this….far worse than NO comments is the comments that are added after the fact…..maybe reciting the business rule….not what was actually coded…and following not set pattern or style…

That was then….wonder what any code I might write today will look like….

anyway….just my thoughts

Craig
KM4YEC


On May 7, 2018, at 2:08 PM, ajparent1/KB1GMX <kb1gmx@...> wrote:

As a bleeding edger...  CP/M 1.3, 1.4 and 2.2,  Smallc,  BDS C and even Pascal.
My copy of K&E has a Bell system cover and marginal notes from K!  I Used to call
on them back when and it was a gift, one I treasure.   However space was never
an issue as I was running hard disks before many.  I may add that system is
still in use as I can bang out good code fast on it (large library and old code
reserve) and a 10mhz Z80 kind does the job.

When I want to show the kiddies I fire up the the microPDP 11/23 (its smaller)
and run Unix V6 and show how far we have not gone.

Coding style.  I try to keep the code English as adverse to "reads like Greek".
Many many years in assembler and macro assemble if I could not figure it
out six months later either it needed more comments or I was trying to be
too slick.  So all the C I wrote/write is every effort to be plain, structured
and consistent in style even if I'm doing different than last project.  One
area is data structures shat I see these days is very hard to decrypt due
to layers of layers.  Yes, I know its C++, sometimes leaving out the ++ part
makes it cleaner other times It is handy to make it better packaged.  I'm
used to writing for small systems as in embedded and often resource limited.
Arduino feels big to me!

Oh, 64x16 must be a PT VDM-1 video or similar, Stiill have a system using that.
I've accumulated systems over the years astating with my first build back in '74.

Allison

Re: Coding styles

Ashhar Farhan
 

C88? That was a very very long long ago... I remember ads for it, probably it was in Dr.Dobbs?
- f


On Mon, 7 May 2018, 21:57 Mark Pilant, <mark@...> wrote:
My number 1 rule about coding is:
     Expect / assume someone else will have to modify or maintain the
     code being written.  This means: *comment* the code.

I can't tell you how much I *hate* the statement "the code is the
comments".  Even the code I write for myself, I still put in lots of
comments.  Having them makes it soooo much easier later on when I need
to make changes.

My number 2 rule about coding is:
     Use the same coding style of the existing code when making changes.
     Trying to follow and understand code written using different coding
     styles can be really hard, and lead to misunderstanding and errors.

Probably the best example I have is one piece of assembly code I wrote
years ago.  The code itself was only about 25-30 lines of assembly code,
but there was another page of comments explaining how the code actually
worked because there was a lot of bit manipulation and "odd" instructions
because they were faster than the expected instruction.   (This was the
main protection checking function in the OpenVMS kernel [dating myself]
if anyone is wondering, and it had to be really fast.)

73

- Mark  N1VQW




Re: 4pin mic wiring

Gary Anderson
 

Hi Ivo,
Sunil's pictures show he is using 1K ohm resistors.
https://i1.wp.com/amateurradiokits.in/wp-content/uploads/2018/03/Mounting-Led-TX-RX.jpg?ssl=1

I don't know the exact specs on the LED included in the kit,
but assuming a standard  estimate of ~2V forward voltage for red/green LED, and a 12V supply:
(12V-2V)/1k Ohms = 10mA of current through the diode. 

Regards,
Gary

Re: Coding styles

ajparent1/KB1GMX <kb1gmx@...>
 

I forgot my first rule of programming and computers.

0+1=10 (all binary) , never ignore the carry flag or were you testing it?

Side effect of being a PDP-8 user at one time.


Allison

Re: Coding styles

ajparent1/KB1GMX <kb1gmx@...>
 

As a bleeding edger...  CP/M 1.3, 1.4 and 2.2,  Smallc,  BDS C and even Pascal.
My copy of K&E has a Bell system cover and marginal notes from K!  I Used to call
on them back when and it was a gift, one I treasure.   However space was never
an issue as I was running hard disks before many.  I may add that system is
still in use as I can bang out good code fast on it (large library and old code
reserve) and a 10mhz Z80 kind does the job.

When I want to show the kiddies I fire up the the microPDP 11/23 (its smaller)
and run Unix V6 and show how far we have not gone.

Coding style.  I try to keep the code English as adverse to "reads like Greek".
Many many years in assembler and macro assemble if I could not figure it
out six months later either it needed more comments or I was trying to be
too slick.  So all the C I wrote/write is every effort to be plain, structured
and consistent in style even if I'm doing different than last project.  One
area is data structures shat I see these days is very hard to decrypt due
to layers of layers.  Yes, I know its C++, sometimes leaving out the ++ part
makes it cleaner other times It is handy to make it better packaged.  I'm
used to writing for small systems as in embedded and often resource limited.
Arduino feels big to me!

Oh, 64x16 must be a PT VDM-1 video or similar, Stiill have a system using that.
I've accumulated systems over the years astating with my first build back in '74.

Allison

Re: SWR

Tim Gorman
 

Since the ADC on the nano is muxed, i.e. not every channel has its own
ADC, it takes time for the ADC to be connected to a specific channel
and for that channel to settle to a correct reading. So you do lose
time slots while this is occuring. It's why a random read takes 2 to 3
times longer than successive reads from the same channel.

At least that's how I read the specs.

And you are right about letting the ADC in the peripheral just run
continuously. I don't consider SWR to be a critical item. You can
measure reverse power when you need to. And you can do the same for
forward power if you want. SWR isn't going to tell you anything extra
over just the two measurements themselves.

tim ab0wr

On Mon, 7 May 2018 11:40:02 -0500
"K9HZ" <@Doc_Bill> wrote:

Correct, but it is more important that, in the case of SWR that the
forward power and the reverse power be synced in time. Thats where
the Arduino fails and you would want to do it off the Arduino. With
ten random variables that don't need to be time related, you can just
let the A/D run continuously and just grab data from the conversion
register when you need it. They run in parallel with instruction
processing so no time slots are lost.


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

email: @Doc_Bill

Re: For those keeping track of uBITX shipping times #ubitx

Ashhar Farhan
 

I just had an ice cream with ehsan. He said they will ship may 6th orders tomorrow.
- f

On Mon, 7 May 2018, 22:25 Keith McQueen, <kb7m@...> wrote:
Ordered April 29
Shipped May 4
Delivered DHL May 7


Keith
KB7M

Re: #ubitx Powel Levels after SImple Mods #ubitx

KE6BB
 

Good summary post, Mark.  I have been considering each (and all) of these methods as well, and was wondering what the sum of these would be.  My uBitX came last week, and i am just now starting to modify it.
--
Mark,
KE6BB

Re: Coding styles

Jeff Gazdacko
 

I always defer to google's style guide, which if I'm remembering correctly is similar to K&R's usage.


On Sun, May 6, 2018 at 11:51 PM, Jerry Gaffke via Groups.Io <jgaffke@...> wrote:
You guys take this so seriously.
Maybe you should find a hobby.   ;-)

Though I understand, I'm afflicted by the same malady.
Just a slightly different strain.
Here's a fix, no need to ever again deal with my coding style (one of many possible tools):
    http://uncrustify.sourceforge.net/ 

If you object to K&R style, there's a lot of it out there for you to sic crustify on.
Here's a few million lines to get you started:
    https://github.com/torvalds/linux

> You can also use Ctrl-T to format your code to a common C coding style.

I assume that's for the Arduino IDE, whose editor I mostly avoid.
Here's various tricks for vi/vim users:
    https://stackoverflow.com/questions/2355834/how-can-i-autoformat-indent-c-code-in-vim

Here's a discussion of the various indentation styles:
    https://softwareengineering.stackexchange.com/questions/99543/what-is-the-difference-between-kr-and-one-true-brace-style-1tbs-styles
They can't agree either.
But somebody in there did a study of error rates in code using the various styles.
Note that K&R style won, at least by a little bit.
Though perhaps that's because folks using the K&R style
are more likely to have read K&R (highly recommended).

I was quite serious about that back pocket thing.
If I have a difficult algorithm to work on, I code it tight so I can see
as much of the work at one time as possible.  Preferably so it all fits
on one side of a sheet of typing paper.  Better yet, half of one side.
Then pull it out at odd times during the day, jot notes when new insights come.
Works for me.

Didn't anybody have any comments about on how better to compute SWR? 

Jerry, KE7ER


On Sun, May 6, 2018 at 05:31 pm, Jack Purdum wrote:
Braces or brackets? Braces mark statement/function blocks while brackets are most often used with array sizes. The old K&R style was to leave the opening brace on the same line as the expression block, and then align the closing brace with the expression block start. I think that was done to get more lines on the screen when a 25 line display was common. Today, most seem to place the opening brace on its own line. If the block spans more than a page, the latest IDE shows the opening expression.

You can also use Ctrl-T to format your code to a common C coding style.
 


Re: Amateur Radio Kits Case Arrived - 5 STARS * * * * * -#ubitx

K9HZ <bill@...>
 

Yeah i got one too.  Nice but some things are not what you would call perfect (circuit boards). Also i sure wish they would learn about lock washers in India...


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


email:  bill@...

 


On May 7, 2018, at 12:00 PM, Lawrence Macionski via Groups.Io <am_fm_radio@...> wrote:

I ordered a uBITX case from https://amateurradiokits.in/store/ BITX Store by Sunil. on March 23,2018.
I reported he was shipping 50 cases when I contacted him last week regarding a DHL upgrade to shipping.
My case was shipped DHL 2018-05-04 from India
Arrived KANSAS USA DHL 2018-04-07 1100 hr local.
Case is beautiful.. Siemens Gray..
Note the case comes with:
10K linear pot
Main tuning knob
Small knob (volume)
Push on - power switch
Fuse Holder
DC socket
DC connector
SO239 connector
Speaker 8 ohm
Screws for PCB and case
Plastic and Brass standoffs.
Acrylic Cover for LCD -(Window)
4 pin Mic socket.
PCB for USB sockets
USB socket
DB 9 socket -for accessories on rear panel
3 extra PCB boards...
PCB mounting for Rotary encoder
PCB mounting for Power switch and fuse
PCB USB and DB9 socket.
Additionally, a red/green T/R LED, tywraps- heat shrink tubing, tywrap mounting adhesive blocks, additional connectors, plastic feet and a front stand for tilting unit.
WHAT A VALUE FOR THE MONEY!!!!- silk screened case, shielded metal construction, all the extra's you need to complete the build!!!

Now- let's mention the packing.. Mine arrived DHL unpacked as follows:
TYVAC DHL envelope- India to Kansas 3 Days. 0.5 Kg weight
Unit was DOUBLE wrapped in small air bubble sheets, completely encased in clear 2" wide clear tape..amounted to 3/4-1 inch bubble wrap all sides.
Once 2 layers of bubble wrap was removes the unit was encased in a high density stryafoam box with 1/2 thick sides and taped shut.
Upon opening the Styrofoam box, the case was then neatly wrapped in a plastic bag.
The uBITX case was finally exposed but required unscrewing the top cover to continue unpacking.
Inside the box double wrapped in newspaper is a ziplock sandwich bag filled with all the small accessories included it the price.
Some of the items (the Display Window) were protected in yet another layer of newspaper.

  1. QUALITY of CASE                                                    * * * * *    5 stars
  2. Professional Appearance                                      * * * * *    5 stars
  3. Additional components to complete build          * * * * *    5 stars
  4. Additional PCB's included                                     * * * * *    5 stars
  5. STURDYNESS OF  CASE                                         * * * * *    5 stars
  6. PACKING QUALITY                                                  * * * * *    5 stars
  7. VALUE of purchase                                                * * * * *    5 stars
  8. Will I buy Again?                                                     * * * * *    5 stars
  9. Will I recommend?                                                 * * * * *    5 stars


God love all the other case builders, and those that "roll" their own..Better men than I.  This is the ROLLS ROYCE STANDARD you need to consider. Especially recommended for a  group- club builds when replication and quality is desired.

Respectfully Submitted-
Larry W8LM
ARRL Life Member - Licensed 52 Years.
Past President, 2 terms -VFW post 3115 Amateur Radio Club, WØVFW -Wichita, KANSAS





Amateur Radio Kits Case Arrived - 5 STARS * * * * * -#ubitx

Lawrence Macionski <am_fm_radio@...>
 

I ordered a uBITX case from https://amateurradiokits.in/store/ BITX Store by Sunil. on March 23,2018.
I reported he was shipping 50 cases when I contacted him last week regarding a DHL upgrade to shipping.
My case was shipped DHL 2018-05-04 from India
Arrived KANSAS USA DHL 2018-04-07 1100 hr local.
Case is beautiful.. Siemens Gray..
Note the case comes with:
10K linear pot
Main tuning knob
Small knob (volume)
Push on - power switch
Fuse Holder
DC socket
DC connector
SO239 connector
Speaker 8 ohm
Screws for PCB and case
Plastic and Brass standoffs.
Acrylic Cover for LCD -(Window)
4 pin Mic socket.
PCB for USB sockets
USB socket
DB 9 socket -for accessories on rear panel
3 extra PCB boards...
PCB mounting for Rotary encoder
PCB mounting for Power switch and fuse
PCB USB and DB9 socket.
Additionally, a red/green T/R LED, tywraps- heat shrink tubing, tywrap mounting adhesive blocks, additional connectors, plastic feet and a front stand for tilting unit.
WHAT A VALUE FOR THE MONEY!!!!- silk screened case, shielded metal construction, all the extra's you need to complete the build!!!

Now- let's mention the packing.. Mine arrived DHL unpacked as follows:
TYVAC DHL envelope- India to Kansas 3 Days. 0.5 Kg weight
Unit was DOUBLE wrapped in small air bubble sheets, completely encased in clear 2" wide clear tape..amounted to 3/4-1 inch bubble wrap all sides.
Once 2 layers of bubble wrap was removes the unit was encased in a high density stryafoam box with 1/2 thick sides and taped shut.
Upon opening the Styrofoam box, the case was then neatly wrapped in a plastic bag.
The uBITX case was finally exposed but required unscrewing the top cover to continue unpacking.
Inside the box double wrapped in newspaper is a ziplock sandwich bag filled with all the small accessories included it the price.
Some of the items (the Display Window) were protected in yet another layer of newspaper.

  1. QUALITY of CASE                                                    * * * * *    5 stars
  2. Professional Appearance                                      * * * * *    5 stars
  3. Additional components to complete build          * * * * *    5 stars
  4. Additional PCB's included                                     * * * * *    5 stars
  5. STURDYNESS OF  CASE                                         * * * * *    5 stars
  6. PACKING QUALITY                                                  * * * * *    5 stars
  7. VALUE of purchase                                                * * * * *    5 stars
  8. Will I buy Again?                                                     * * * * *    5 stars
  9. Will I recommend?                                                 * * * * *    5 stars


God love all the other case builders, and those that "roll" their own..Better men than I.  This is the ROLLS ROYCE STANDARD you need to consider. Especially recommended for a  group- club builds when replication and quality is desired.

Respectfully Submitted-
Larry W8LM
ARRL Life Member - Licensed 52 Years.
Past President, 2 terms -VFW post 3115 Amateur Radio Club, WØVFW -Wichita, KANSAS





Re: For those keeping track of uBITX shipping times #ubitx

Keith McQueen
 

Ordered April 29
Shipped May 4
Delivered DHL May 7


Keith
KB7M

Re: Coding styles

w7hd.rh <w7hd.rh@...>
 

I always put a summary comment at the top describing the overall function of the program, then a descriptive comment just before each function.  If I'm doing it for my students, then I comment heavily.

I, too, used K&R C back in 1975 while working for Pacific NW Bell.  We had a DEC 11/45 and I personally had a Z80-based microcomputer with Smith C running MP/M (multi-user version of CP/M).   Did my first satellite-tracking program on the Z80 in Basic and assembler.

And yes, I used a Kaypro!  Had to write a comm program for it as part of my next job, so did that in assembler.  It used a 300-baud modem to communicate with a remote unit about 100 miles away.  That reduced travel time considerably :-)

--
Ron W7HD - NAQCC#7587 OMISS#9898 KX3#6966 LinuxUser#415320
Editor OVARC newsletter

Re: Coding styles

Arv Evans
 

Tim, and others...

Coders and coding "style" is similar to farmers, if you get two of them together you
have 3 opinions and no agreement on anything.    8-)

Been there, done that.

Arv
_._


On Mon, May 7, 2018 at 10:43 AM, Tim Gorman <tgorman2@...> wrote:
Terse? Our mainframe fortran compiler saw spaces as just null space.
I'll never forget the time the teacher gave us a fortran program with
all spaces removed and had us try to figure out what it was doing.

*That* was terse

tim ab0wr

On Mon, 07 May 2018 07:58:57 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

> Some C coders won't see that as humor.
> That's how they code.
> And if you work with it enough to where it is no longer gibberish,
> the more compact representation might be understood more quickly.
>
> There are different styles between programming languages as well as
> within programming languages. The more esoteric ones can become
> insanely compact, doing in a line what would take a page in others. I
> still remember the shock back in my school days when taking a class
> covering Snobol after first getting my feet wet with Fortran. 
>
> Jerry
>




Re: Coding styles

Tim Gorman
 

Terse? Our mainframe fortran compiler saw spaces as just null space.
I'll never forget the time the teacher gave us a fortran program with
all spaces removed and had us try to figure out what it was doing.

*That* was terse

tim ab0wr

On Mon, 07 May 2018 07:58:57 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

Some C coders won't see that as humor.
That's how they code.
And if you work with it enough to where it is no longer gibberish,
the more compact representation might be understood more quickly.

There are different styles between programming languages as well as
within programming languages. The more esoteric ones can become
insanely compact, doing in a line what would take a page in others. I
still remember the shock back in my school days when taking a class
covering Snobol after first getting my feet wet with Fortran. 

Jerry

Re: SWR

Tim Gorman
 

Arv,

I appreciate the info but using external ADC units don't require much
support from the main processor. And even at the 100khz bus speed don't
load the processor down when they aren't accessed repetitively as
critical operation elements.

tim ab0wr

On Mon, 7 May 2018 09:55:59 -0600
"Arv Evans" <arvid.evans@...> wrote:

Tim AB0WR

I2C as used with Arduino boards is usually defined for relatively
slow (100 KHz) speed.

I2C defines several speed grades but the term baud rate is quite
unusual in this
context. The speed grades (standard mode: *100 kbit/s*, full speed:
*400 kbit/s*,
fast mode: *1 mbit/s*, high speed: 3,*2 Mbit/s*) are maximum ratings.
<https://www.i2c-bus.org/speed/>

I2C or TWI being a serial bus the data is clocked at the individual
bit rate, or no more
than 12500 eight-bit bytes per second. Parallel-to-serial conversion
and serial-to-
parallel conversion can also eat up a lot of machine cycles if it is
done with software
instead of using built-in UART type autonomous functions.

The issue of Arduino running out of cycles needed to do its work is
usually a false
problem. Code can be arranged such that the important parts get the
most attention. Sometimes using interrupts is a good approach and at
other times just
calling important subroutines multiple times around the execution
loop will suffice.

Attached hardware can also be problematic if it requires a lot of CPU
cycles from
the host processor to support it. Servicing slow attached hardware
can sometimes
be handled by breaking down its demands for service into small
function calls and
spreading the load out to times when the host processor is not doing
critical tasks.

Adding sub-processors or smart attached hardware is another option
that sometimes
helps to speed things up. In these cases the bus interface speed and
bandwidth
may become the roadblock unless functional load balancing is done to
make the
best possible efficiency in data flow between devices. If only two
devices are used
and need to talk to each other it may be faster to use parallel
communications
instead of a serial bus. Interrupt driven parallel bus systems
should be much more
efficient than traditional serial bus systems.

Code layout involves optimization for speed where speed is needed.
Relying on
compiler optimization is sometimes not enough to make CPU cycles
available when and where they are needed.

In the "bad-old-days" of sub-1_MHz processors that took 6 or more
cycles to do
anything we did things like cycle counting and time parameterization
of our code.
Thank goodness we rarely need to do that in today's world of
single-cycle execution and 16 MHz or faster processors. But...the
method is still valid if you
need to do something involving critical real-time like operations.
Making a flow
diagram and penciling in CPU cycles for each function takes time and
effort but
can be helpful in certain critical situations.

Arv
_._


On Sun, May 6, 2018 at 7:54 PM, Tim Gorman <tgorman2@...> wrote:

Why is the i2c so much slower? When using the adafruit ads1015 the
entire analog to digital conversion is completely off-loaded from
the nano. All you have to do is read the registers in the ads1015.
There is a small amount of overhead in the i2c communication
protocol but it isn't significant from what I can see.

It isn't a matter of how fast the analog to digital conversion can
be done because you don't have to read the voltage repetitively as
fast as you can. You can't adjust a tuner faster than the nano can
read it from an i2c adc.

There was an earlier thread where it was argued that off-loading
everything you could from the nano to an attached processor provided
more cycles for things the nano *has* to accomplish. I would think
that would surely include doing analog-to-digital conversion.

tim ab0wr

Re: SWR

K9HZ <bill@...>
 

Correct, but it is more important that, in the case of SWR that the forward power and the reverse power be synced in time.  Thats where the Arduino fails and you would want to do it off the Arduino.  With ten random variables that don't need to be time related, you can just let the A/D run continuously and just grab data from the conversion register when you need it. They run in parallel with instruction processing so no time slots are lost. 


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


email:  bill@...

 


On May 7, 2018, at 10:49 AM, Tim Gorman <tgorman2@...> wrote:

If you are reading multiple variables, such as forward and reverse
power, then it becomes a big question of resources on-chip vs resources
off-chip.

For instance, I want to read PA current and reverse power. That's two
analog ports on the nano vs none for an i2c peripheral. If I also want
forward power then it becomes three analog ports vs none for an i2c
peripheral. If I also want PA temperature then it's four analog ports
vs none for an i2c peripheral. Reading multiple analog ports through
the nano muxed ADC doesn't appear to be much faster than doing i2c
reads from peripherals.

tim ab0wr

On Sun, 6 May 2018 22:15:37 -0500
"K9HZ" <bill@...> wrote:

If you are only reading one variable, it’s much better to use the
Nano’s A/D.  There is no syncing to do… just let it run continuously
and read whats ever in the register.





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 <http://www.villagrandpiton.com/>

Like us on Facebook!  <https://www.facebook.com/VillaGrandPiton/>



Moderator – North American QRO Group at Groups.IO.



email:   <mailto:bill@...> bill@...





From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Jerry
Gaffke via Groups.Io Sent: Sunday, May 6, 2018 9:39 PM
To: BITX20@groups.io
Subject: Re: [BITX20] SWR



Here's the datasheet:
   http://www.ti.com/lit/ds/symlink/ads1015.pdf
Pages 20-23 are of interest.
Looks to me like it is on the order of 10 bytes transferred via the
i2c bus for each ADC read, since we have to switch channels between
reads to choose forward vs reflected power. At 100 khz, that's 10us *
10 * 8bits/byte = 800 us. That's an order of magnitude slower than
reading the Nano's ADC using a an analogRead() call, around 100us.

It is possible to speed the i2c bus up from 100 khz to 400 khz,
But we can speed up the Nano ADC reads by a factor of 5, fiddling
with the ADC clock prescaler.

So using the Nano's ADC is much faster than using this i2c ADC chip
Now if you found a good SPI ADC chip, that might be a different story.

Jerry





---
This email has been checked for viruses by AVG.
http://www.avg.com




Re: 45Mhz crystal filter specification

Arv Evans
 

Jerry

Thanks for the information.  Being a dual-log detector the AD8302 could be advantageous
for any application that needs two simultaneous measurements ( input versus output ) or
( both ends of a component or circuit ) or ( forward and reflected power ). 


Arv
_._


On Sun, May 6, 2018 at 10:52 PM, Jerry Gaffke via Groups.Io <jgaffke@...> wrote:
The AD8302 is an interesting part, been around a couple decades now, about as long as the AD8307.
Curious that it doesn't get used more often by hams, virtually no google hits on projects using it.
Perhaps because most of us do our best to avoid thinking much about complex impedances. 

Ebay has the AD8302 for a buck, they're $20 on mouser.
But even if slightly out of spec, a vector network analyzer for $1 is not a bad deal.
Appears it won't be able to tell you if it was R+jX or R-jX.

The ebay AD8307's that I have show all the markings of legit parts.
If they are fallouts, I'd think Analog Devices would step on whoever's sourcing them.
But they've been getting sold cheaply for years now.

Jerry



On Sun, May 6, 2018 at 03:54 pm, K9HZ wrote:
Yet another reason I opted for the AD8302 for my tuner…  FREE R+jX…


Re: SWR

Jerry Gaffke
 

Power is proportional to the square of the voltage read from a diode detector, so that's just an extra multiply.
The Nano does an 8x8 hardware multiply in 2 clock ticks, so maybe a dozen ticks for 16x16, or 1us.

Vs a lookup table in flash to convert dBm to Watts, most hams will prefer a display in Watts.
Nano flash is in short supply, but it has lots of microseconds.
And the supply of $0.30 AD8307's is not guaranteed. 
Advantage here is that the AD8307 can detect ridiculously low power levels
if you can keep all those other noise sources from sneaking in.

Works either way, not too big a deal.
Could easily lay the board out for both, the additional area consumed is less than a toroid.

Jerry


On Mon, May 7, 2018 at 08:58 am, Kees T wrote:
So what would be the minimum compute requirement on an existing Nano ? Maybe read 2 analog inputs directly from 2 AD8307s  with only a scaling factor for Stockton Bridge coupler loss. Multiply that by 1dBm per 25mV (linear spec for the AD8307) and you have the Forward and Reflected power in dBm into a 50 ohm load.  Look up the "power" in Watts or tape a small chart on the bottom of the uBITX.

Re: Coding styles

Mark Pilant
 

My number 1 rule about coding is:
Expect / assume someone else will have to modify or maintain the
code being written. This means: *comment* the code.

I can't tell you how much I *hate* the statement "the code is the
comments". Even the code I write for myself, I still put in lots of
comments. Having them makes it soooo much easier later on when I need
to make changes.

My number 2 rule about coding is:
Use the same coding style of the existing code when making changes.
Trying to follow and understand code written using different coding
styles can be really hard, and lead to misunderstanding and errors.

Probably the best example I have is one piece of assembly code I wrote
years ago. The code itself was only about 25-30 lines of assembly code,
but there was another page of comments explaining how the code actually
worked because there was a lot of bit manipulation and "odd" instructions
because they were faster than the expected instruction. (This was the
main protection checking function in the OpenVMS kernel [dating myself]
if anyone is wondering, and it had to be really fast.)

73

- Mark N1VQW