¿ªÔÆÌåÓý

Flutter Fix


 

No Raduino here, but do have a Nano to play with. ?Here's a code scrap to replace that final clause in doTuning() to give the tuning pot a bit of hysterisis. ?Perhaps somebody could try it out.


  // the tuning knob is at neither extremities, tune the signals as usual
  else if (knob != old_knob){
    static char dir_knob;
    if ( (knob>old_knob) && ((dir_knob==1) || ((knob-old_knob) >5)) ||
         (knob<old_knob) && ((dir_knob==0) || ((old_knob-knob) >5)) )   {
       if (knob>old_knob) {
            dir_knob=1;
            frequency = baseTune + (50l * (knob-5));
       } else {
            dir_knob=0;
            frequency = baseTune + (50l * knob);
       }
       old_knob = knob;
       setFrequency(frequency);
       updateDisplay();
    }
o
   tone(CW_TONE, sideTone);
   tone(6, 1000);


Also, if you want a 1000hz square wave on pin 6 as a test signal, just execute this line somewhere:

? ? tone(6,1000);

That sets up a counter-timer to continuously generate the square wave while the Nano goes off and does other things.

Shut it down with

? ? noTone();


Jerry, KE7ER


Jack Purdum
 

I'm not a fan of "magic numbers" in code, as it makes it harder to read and understand what's going on. So, near the top of the code file, perhaps around line 100, and after the #include preprocessor directives, I'd write:

#define TUNEUP ? ? ? ? ? ? ?1
#define TUNEDOWN ? ? ? ?????0
#define MINCHANGE ? ? ? ? ? 5
#define FREQJUMP ? ? ? ? ?501

Then make small changes to the code:

? // the tuning knob is at neither extremities, tune the signals as usual
? else if (knob != old_knob){
? ? static char dir_knob;
? ? if ( (knob > old_knob) && ((dir_knob == TUNEUP) || ((knob-old_knob) > MINCHANGE)) ||?
? ? (knob < old_knob) && ((dir_knob == TUNEDOWN) || ((old_knob-knob) > MINCHANGE))) ? {
? ? ? ?if (knob > old_knob) {
? ? ? ? ? ? dir_knob = TUNEUP;
? ? ? ? ? ? frequency = baseTune + (FREQJUMP * (knob-MINCHANGE));
? ? ? ?} else {
? ? ? ? ? ? dir_knob = TUNEDOWN;
? ? ? ? ? ? frequency = baseTune - (FREQJUMP * knob); // I changed to minus sign. Correct??
? ? ? ?}
? ? ? ?old_knob = knob;
? ? ? ?setFrequency(frequency);
? ? ? ?updateDisplay();
? ? }
o // Remove??
? ?tone(CW_TONE, sideTone);
? ?tone(6, 1000);

As I have said before, my B40 is in pieces so I cannot test the code.?

The advantage of using symbolic constants is that, if you need to change one, you don't need to use the error-prone global search-and-replace feature of the editor. Simply change the #define at the top of the page, recompile and unload, and you're done. I have not studied the code, so it is likely that you can think of more descriptive terms for each #define. No problem: Make the rename to the constant (convention makes them uppercase) and also in the code.

Jack, W8TEE
From: Jerry Gaffke via Groups.Io <jgaffke@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 2:04 AM
Subject: [BITX20] Flutter Fix

No Raduino here, but do have a Nano to play with. ?Here's a code scrap to replace that final clause in doTuning() to give the tuning pot a bit of hysterisis. ?Perhaps somebody could try it out.

  // the tuning knob is at neither extremities, tune the signals as usual
  else if (knob != old_knob){
    static char dir_knob;
    if ( (knob>old_knob) && ((dir_knob==1) || ((knob-old_knob) >5)) ||
         (knob<old_knob) && ((dir_knob==0) || ((old_knob-knob) >5)) )   {
       if (knob>old_knob) {
            dir_knob=1;
            frequency = baseTune + (50l * (knob-5));
       } else {
            dir_knob=0;
            frequency = baseTune + (50l * knob);
       }
       old_knob = knob;
       setFrequency(frequency);
       updateDisplay();
    }
o
   tone(CW_TONE, sideTone);
   tone(6, 1000);

Also, if you want a 1000hz square wave on pin 6 as a test signal, just execute this line somewhere:
? ? tone(6,1000);
That sets up a counter-timer to continuously generate the square wave while the Nano goes off and does other things.
Shut it down with
? ? noTone();

Jerry, KE7ER



 

The new code from my previous post does away with the constant flicker between adjacent frequencies due to noise in the ADC when the knob is not being rotated, but otherwise leaves functionality and feel exactly as Ashhar had coded it. ?Works on my Nano, I monitored the frequency value through the Arduino serial port. ?Remove the extraneous final 3 lines about the tone and replace them with a closing "}". ?(It was getting late.) ? The new code replaces this part of Ashhar's original code:

  // the tuning knob is at neither extremities, tune the signals as usual
  else if (knob != old_knob){
     frequency = baseTune + (50l * knob);
     old_knob = knob;
     setFrequency(frequency);
     updateDisplay();
  }

It works by inhibiting a reverse in direction of the tuning pot until that reversal has traveled through what would normally be 5 steps in frequency of 50hz each. ?For example, assume we have been tuning up in frequency and stop the knob at 7200.000 khz. ?A bit of noise comes in from the ADC, and the frequency pops up to 7200.050 khz. ?Another bit of noise comes in that would normally bring it back down to 7200.000 khz, but this is ignored because it does not reach the 5 tick threshold. ?A light touch on the knob might bring it a bit further up to 7200.100 khz. ?Reversing the direction of the knob, it travels through 5 steps before any change in frequency occurs, on the 6'th step the frequency goes back down to 7200.050 khz. ?If we leave the knob in that position, a bit of ADC noise might lower it further to 7200.000 khz, but noise will not raise the frequency. ?

I recommend operating with the original code at first until the noise at the pot has been evaluated and minimized with bypass caps and perhaps short shielded wiring. ?Then enable this new code by recompiling the sketch.

The frequency will still move a little bit after taking your hand off the knob, but can only move in one direction. ?If that is unacceptable but you otherwise like the current method of tuning, then perhaps reduce the tuning rate by a factor of two by replacing this line:

? ? ??frequency = baseTune + (50l * knob);

with this

frequency = baseTune + (50l * (knob>>1));


Me, I'll likely go to Don Cantrell's shuttle tuning scheme as described at?
But use an encoder instead of a pot so I can feel a click when it moves between positions.

Jerry, KE7ER


On Mon, Feb 20, 2017 at 11:04 pm, Jerry Gaffke wrote:

No Raduino here, but do have a Nano to play with. ?Here's a code scrap to replace that final clause in doTuning() to give the tuning pot a bit of hysterisis. ?Perhaps somebody could try it out.

?


 

I thought about it pretty hard, and did test the code. ?Worked as posted, makes a smooth transition when changing knob direction. ? A first cut, admittedly a bit inelegant. ??

On Tue, Feb 21, 2017 at 06:31 am, Jack Purdum wrote:

// I changed to minus sign. Correct??

?


Jack Purdum
 

My bad: I didn't look at the code closely enough. The symbolic constant:

#define FREQJUMP ? ? ? ? ?501

should be:

#define FREQJUMP ? ? ? ? ?50L ? ?// Note uppercase 'L'

which is the 50Hz increment that Jerry mentions in his narrative. My error in interpretation also illustrates why it's a good idea to use uppercase letters when using a data type modifier with constants. The 'l' (ell) looks too much like a one '1'.

The alternative line he suggested:

????frequency = baseTune + (50l * (knob>>1));

is based upon the fact that any bitshift to the right divides the value by 2, while a bitshift to the left multiplies the value by two. This makes sense since the computer is doing everything in base 2 arithmetic (e.g., 5 = 101 in binary, and 10 = 1010; bitshifting fills in with zeroes). However, you could also use:

? ? frequency = baseTune + (50l * (knob / 2));

The compiler hiding under the Arduino IDE is the Open Source Gnu C++ compiler. (Yep, it can compile either C or C++ code, which is why most of the libraries are written in C++, yet cause no problems.) The code optimizer in that compiler is pretty good so it would translate the (knob / 2) into the bitshift expression (knob >> 1) either way. I always pick the one that's easiest to read, but both will produce the same output from the code generator. The choice is yours.

I, too, am implementing a rotary encoder for tuning simply because I am also adding a menuing system for some options used with the TFT display instead of the 2x16 LCD display. That's the good news. The bad news is that I had to move from the Nano to a Mega 2560 Pro Mini. While I probably could have squeezed the code into the Nano flash memory space, I was running into ?stack collisions with the heap space (i.e., out of SRAM) so the shift was necessary.

Jack, W8TEE


From: Jerry Gaffke via Groups.Io <jgaffke@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 9:48 AM
Subject: Re: [BITX20] Flutter Fix

The new code from my previous post does away with the constant flicker between adjacent frequencies due to noise in the ADC when the knob is not being rotated, but otherwise leaves functionality and feel exactly as Ashhar had coded it. ?Works on my Nano, I monitored the frequency value through the Arduino serial port. ?Remove the extraneous final 3 lines about the tone and replace them with a closing "}". ?(It was getting late.) ? The new code replaces this part of Ashhar's original code:
  // the tuning knob is at neither extremities, tune the signals as usual
  else if (knob != old_knob){
     frequency = baseTune + (50l * knob);
     old_knob = knob;
     setFrequency(frequency);
     updateDisplay();
  }
It works by inhibiting a reverse in direction of the tuning pot until that reversal has traveled through what would normally be 5 steps in frequency of 50hz each. ?For example, assume we have been tuning up in frequency and stop the knob at 7200.000 khz. ?A bit of noise comes in from the ADC, and the frequency pops up to 7200.050 khz. ?Another bit of noise comes in that would normally bring it back down to 7200.000 khz, but this is ignored because it does not reach the 5 tick threshold. ?A light touch on the knob might bring it a bit further up to 7200.100 khz. ?Reversing the direction of the knob, it travels through 5 steps before any change in frequency occurs, on the 6'th step the frequency goes back down to 7200.050 khz. ?If we leave the knob in that position, a bit of ADC noise might lower it further to 7200.000 khz, but noise will not raise the frequency. ?
I recommend operating with the original code at first until the noise at the pot has been evaluated and minimized with bypass caps and perhaps short shielded wiring. ?Then enable this new code by recompiling the sketch.
The frequency will still move a little bit after taking your hand off the knob, but can only move in one direction. ?If that is unacceptable but you otherwise like the current method of tuning, then perhaps reduce the tuning rate by a factor of two by replacing this line:
? ? ??frequency = baseTune + (50l * knob);
with this
frequency = baseTune + (50l * (knob>>1));

Me, I'll likely go to Don Cantrell's shuttle tuning scheme as described at?
But use an encoder instead of a pot so I can feel a click when it moves between positions.

Jerry, KE7ER

On Mon, Feb 20, 2017 at 11:04 pm, Jerry Gaffke wrote:
No Raduino here, but do have a Nano to play with. ?Here's a code scrap to replace that final clause in doTuning() to give the tuning pot a bit of hysterisis. ?Perhaps somebody could try it out.
?



 

Jack,

I do appreciate you taking an interest in the code snippet I sent out. ?You will likely see a fair bit more hideous code from me in the near future.

I agree about the 50L vs 50l, was minimizing hacks to Ashhar's original. ?I might agree with #define's for 5 and 50L, especially since they get used in more than one place and are constants somebody might want to twiddle. ?But I'd put those #define's just above where they get used, if they only get used in one area of code. ?Otherwise it takes me an hour to connect the dots, and figure out what all those stupid names are. ? Could be just a number, could be some humongous macro. ?A real programmer hits some key sequence and his editor jumps to the definition off in some *.h file, I've never learned those vi tricks.

We'll probably butt heads here some on coding style. ?I'm a digital hardware engineer (FPGA's and VHDL mostly these days) firmly set in my ways, learned to code in C nearly 40 years ago from the K&R book. ? ?When I write code for a uC, I want to know what every line will compile down to. ?(Arduino is new to me, I can see where me and random Arduino libraries are not going to get along very well.) ?Your conventions are the more conventional, and it's ok with me if you rewrite my code into something you are comfortable with. ?Just keep in mind, whoever touches it last gets to maintain it. ? ?;-)

And no, it really should be a "+" in ? ??frequency = baseTune + (50l * knob);


Jerry, KE7ER




On Tue, Feb 21, 2017 at 06:31 am, Jack Purdum wrote:

I'm not a fan of "magic numbers" in code, as it makes it harder to read and understand what's going on. So, near the top of the code file, perhaps around line 100, and after the #include preprocessor directives, I'd write:

?


Jack Purdum
 

Jerry:

Not a problem. Like I said, I wasn't sure that the expression on that one line was correct or not. Since you mentioned that you have run the code on the Nano, I assumed it was, but thought I'd ask...hence the question marks in the comment.

There's no reason to butt heads, as code that compiles and works is the proof in the puddin'. That said, I've been teaching C for over 30 years and I know where most of the stumbling blocks?are for beginning C programmers. I, too, learned from the K&R book and have been using C since 1978...wrote my first C programming book in 1982 and ended up teaching C and C++ at Purdue University. Thirty years and 18 books later, I'm still writing C books and code...it is my favorite language! I only started embedded C programming about 10 years ago, but other than keeping some memory constraints in mind, it's not much different than writing C code for a mainframe.

The K&R convention is to put all symbolic constants and macros at the top of the source file in which they are used. That way, it's pretty much impossible to attempt to use the constant/macro before the preprocessor sees it. Otherwise, code revisions down the road might attempt to use the constant before it's defined, generating a compile time error message. Also, since they are always at the top of the file for me, I don't have to search through the code to find them should they need to be changed. It's a defensive coding strategy that K&R came up with...I can't take credit for it.

The point I was trying to make about the bitshifting is that the compiler is smarter than most of us when it comes to code optimization. Given that most people find it easier to understand (knob / 2) than (knob >> 1), I would write the code using the former. The compiler will generate the code using a bitshift anyway. Since that's the case, I always go for the more easily-understood version. It's been documented that 80% of the cost of software is in testing/debugging, not writing it. Therefore, anything we can do to make the code easier to read is a plus in my book. (Another reason why I try to avoid "magic numbers" in the code.)

You're absolutely correct...the last one who modifies the code is responsible for maintaining it. I'm more than happy to do that for the group. ?

Finally, everyone should feel comfortable in presenting their code here. My job will never be to criticize anyone's code, and that was not my purpose here. I do, however, want to make it as easy as possible for a novice programmer to feel comfortable learning, understanding, and experimenting with C. Indeed, I want to encourage everyone to learn some level of programming and I know that's possible. Anyone who is smart enough to get a license is more than smart enough to learn C. I will do whatever I can to make the code easier to understand and maintain as long as the change works and doesn't impose a performance penalty. The good news is that everyone if free to ignore whatever my changes might be. That bad news is that programming can become addictive!

Jack, W8TEE



From: Jerry Gaffke via Groups.Io <jgaffke@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 11:14 AM
Subject: Re: [BITX20] Flutter Fix

Jack,
I do appreciate you taking an interest in the code snippet I sent out. ?You will likely see a fair bit more hideous code from me in the near future.
I agree about the 50L vs 50l, was minimizing hacks to Ashhar's original. ?I might agree with #define's for 5 and 50L, especially since they get used in more than one place and are constants somebody might want to twiddle. ?But I'd put those #define's just above where they get used, if they only get used in one area of code. ?Otherwise it takes me an hour to connect the dots, and figure out what all those stupid names are. ? Could be just a number, could be some humongous macro. ?A real programmer hits some key sequence and his editor jumps to the definition off in some *.h file, I've never learned those vi tricks.
We'll probably butt heads here some on coding style. ?I'm a digital hardware engineer (FPGA's and VHDL mostly these days) firmly set in my ways, learned to code in C nearly 40 years ago from the K&R book. ? ?When I write code for a uC, I want to know what every line will compile down to. ?(Arduino is new to me, I can see where me and random Arduino libraries are not going to get along very well.) ?Your conventions are the more conventional, and it's ok with me if you rewrite my code into something you are comfortable with. ?Just keep in mind, whoever touches it last gets to maintain it. ? ?;-)
And no, it really should be a "+" in ? ??frequency = baseTune + (50l * knob);

Jerry, KE7ER



On Tue, Feb 21, 2017 at 06:31 am, Jack Purdum wrote:
I'm not a fan of "magic numbers" in code, as it makes it harder to read and understand what's going on. So, near the top of the code file, perhaps around line 100, and after the #include preprocessor directives, I'd write:
?



 

After you two guys decide on your collaboration of coding, I am willing to try it and give you feedback. ?I am at the earliest stages of playing with arduino beyond the Blink and Servo Motor sketches. I am still planning to make Jacks DDS VFO from his Arduino for amateur radio book, and implement it with the Frog Sounds CW Kit. As well as a Arduino antenna analyzer.?

How is this implemented "Shut it down with?noTone();" Is this a keyboard command, or button activated?

Well, at least you know I am good at describing a problem with all the details.

And I got a backup of my code with the tune pin change.


 

Sounds good. ? My head is usually down in the bare metal somewhere, and my coding style will reflect that.

For a good taste, take a look at the KE7ER/pskuc.c down in the files section, search for the "README" to get an overview. ? I was rather proud of that one. ? Though now in 2017 we'd probably be better off spending an extra dollar for an Arm Cortex M3 Arduino compatible: ?? No longer much point in shoehorning standalone PSK31 into a machine with 2kbytes of flash.

Jerry, KE7ER



 

noTone(); is a line of C code that you add to the sketch.

For example, if you hack the Raduino sketch to add these four lines inside the setup() routine:

  pinMode(6, OUTPUT);
  tone(6, 1000);
  delay(5000);
  noTone();
then at power-up you would get 5 seconds of 1khz coming out pin 6 ?of the Nano.

That first line should be in setup(), it tells the Nano that pin 6 is a digital output.
The other three lines could be anywhere, perhaps in the loop() or calibrate() routines.

You should make sure pin 6 is free first. ?I'm not sure, it might be getting used by the 2x16 LCD.?
The LCD and the Si5351 libraries grab their own pins, and that unfortunately is pretty much hidden.

Jerry

On Tue, Feb 21, 2017 at 09:57 am, John Smith wrote:

How is this implemented "Shut it down with?noTone();" Is this a keyboard command, or button activated?

?


Jack Purdum
 

Good grief...$4.50! Unbelievable how cheap things like this are. The Teensy 3.6 is another one: 1Mb of flash, 256K SRAM, and a 180MHz clock for under $30...amazing!

Jack, W8TEE



From: Jerry Gaffke via Groups.Io <jgaffke@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 1:35 PM
Subject: Re: [BITX20] Flutter Fix

Sounds good. ? My head is usually down in the bare metal somewhere, and my coding style will reflect that.
For a good taste, take a look at the KE7ER/pskuc.c down in the files section, search for the "README" to get an overview. ? I was rather proud of that one. ? Though now in 2017 we'd probably be better off spending an extra dollar for an Arm Cortex M3 Arduino compatible: ?? No longer much point in shoehorning standalone PSK31 into a machine with 2kbytes of flash.
Jerry, KE7ER




 

That's shipped out of California.

If you have more weeks than you do dollars, there's cheaper.


On Tue, Feb 21, 2017 at 12:54 pm, Jack Purdum wrote:

Good grief...$4.50!

?


 

John Smith,

Regarding noTone()

Pin 6 is used in the Raduino sketch for "CW_TONE", Ashhar has it set up to send out a sidetone. ?Probably best to let pin 6 be, pin 4 is free though, it gets defined as "TX_LPF_SEL" but that define is never used. ?I tried my code snippet, the compile complained until noTone() was given a pin number to shut down, even though the library can only generate one tone at a time. ?So working code could be had by adding this anywhere inside the setup() routine in the Raduino sketch, including right at the top as shown here

########################

void setup()

{

? ? inMode(4, OUTPUT);

? ? tone(4, 1000);

? ? delay(5000);

? ? noTone(4);

########################

Note that "4" is labeled as "D4" in the Raduino schematics, and is more a name than a number. ?It is actually pin 22 of the Nano. ? The Nano has pin names 0 through 12, though 8,9,10,11,12 are used by the LiquidCrystal library for the 2x16 LCD. ? These are all strictly digital pins, can be input or output, but have states of only high or low. ?The Nano also has pin names A0 through A7, though A4,A5 are used inside the Si5351 library. ?These can be analog inputs to the ADC (such as for reading the the voltage of that tuning pot), or can be used as digital pins.?

If you plan to mess around with Arduino programming, probably a good idea to get another Nano or two. ?They are quite cheap, and it is possible to program them in such a way that they will no longer talk to you. ?Probably don't want to brick the Nano that came with the Raduino.

Jerry



On Tue, Feb 21, 2017 at 10:48 am, Jerry Gaffke wrote:

noTone(); is a line of C code that you add to the sketch.

For example, if you hack the Raduino sketch to add these four lines inside the setup() routine:

  pinMode(6, OUTPUT);
  tone(6, 1000);
  delay(5000);
  noTone();
then at power-up you would get 5 seconds of 1khz coming out pin 6 ?of the Nano.

That first line should be in setup(), it tells the Nano that pin 6 is a digital output.
The other three lines could be anywhere, perhaps in the loop() or calibrate() routines.

You should make sure pin 6 is free first. ?I'm not sure, it might be getting used by the 2x16 LCD.?
The LCD and the Si5351 libraries grab their own pins, and that unfortunately is pretty much hidden.

?


 

Whoops, had a copy-and-paste error. ?That first line should be: ? ?pinMode(4, OUTPUT);

Also, while that first line is typically in the ?setup() ?routine, the other three lines could be most anywhere, and need not be together.

On Tue, Feb 21, 2017 at 02:55 pm, Jerry Gaffke wrote:

inMode(4, OUTPUT);

?


Jack Purdum
 

To reinforce what Jerry is saying, pin names 0 and 1 on the Nano are used to communicate with the PC via the Serial object, so it's best to leave them as is if you expect to do any debugging. Pin 2 and 3 are the only external interrupt pins on the Nano, so leaving those free if you can is a good idea in many cases. (My code, for example, uses interrupts rather than polling for the rotary encoder.) The A4 and A5 pins Jerry mentioned are used in multiple libraries as they are part of the I2C and other interfaces. A common mistake when using the ADC pins is to use 1024 in some form of equation because that is 2 to the 10th power. However, keep in mind that zero is a valid value, so the range is 0-1023. (That is, the max value is not 1024.)

In Jerry's setup() code, the 'p' got dropped. It should be:

? ? pinMode(4, OUTPUT);

Finally, if you are using interrupts in your code, using delay() or the Serial object will mess things up because they call their own interrupt routines.

Jack, W8TEE


From: Jerry Gaffke via Groups.Io <jgaffke@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 5:55 PM
Subject: Re: [BITX20] Flutter Fix

John Smith,
Regarding noTone()
Pin 6 is used in the Raduino sketch for "CW_TONE", Ashhar has it set up to send out a sidetone. ?Probably best to let pin 6 be, pin 4 is free though, it gets defined as "TX_LPF_SEL" but that define is never used. ?I tried my code snippet, the compile complained until noTone() was given a pin number to shut down, even though the library can only generate one tone at a time. ?So working code could be had by adding this anywhere inside the setup() routine in the Raduino sketch, including right at the top as shown here
########################
void setup()
{
? ? inMode(4, OUTPUT);
? ? tone(4, 1000);
? ? delay(5000);
? ? noTone(4);
########################
Note that "4" is labeled as "D4" in the Raduino schematics, and is more a name than a number. ?It is actually pin 22 of the Nano. ? The Nano has pin names 0 through 12, though 8,9,10,11,12 are used by the LiquidCrystal library for the 2x16 LCD. ? These are all strictly digital pins, can be input or output, but have states of only high or low. ?The Nano also has pin names A0 through A7, though A4,A5 are used inside the Si5351 library. ?These can be analog inputs to the ADC (such as for reading the the voltage of that tuning pot), or can be used as digital pins.?
If you plan to mess around with Arduino programming, probably a good idea to get another Nano or two. ?They are quite cheap, and it is possible to program them in such a way that they will no longer talk to you. ?Probably don't want to brick the Nano that came with the Raduino.
Jerry


On Tue, Feb 21, 2017 at 10:48 am, Jerry Gaffke wrote:
noTone(); is a line of C code that you add to the sketch.
For example, if you hack the Raduino sketch to add these four lines inside the setup() routine:
  pinMode(6, OUTPUT);
  tone(6, 1000);
  delay(5000);
  noTone();
then at power-up you would get 5 seconds of 1khz coming out pin 6 ?of the Nano.

That first line should be in setup(), it tells the Nano that pin 6 is a digital output.
The other three lines could be anywhere, perhaps in the loop() or calibrate() routines.

You should make sure pin 6 is free first. ?I'm not sure, it might be getting used by the 2x16 LCD.?
The LCD and the Si5351 libraries grab their own pins, and that unfortunately is pretty much hidden.

?



Jack Purdum
 

John:

I have an article coming out in QST on an Arduino antenna analyzer. The bad news is that I don't know when it will be printed; only that it will be "by Feb next year". That said, it's built on an "Arduino Sandwich" that has the TFT display on the bottom which plugs into a custom PCB in the middle, and the AD9850 and Mega 2560 Pro Mini on the top. (See photo.) The display is 3.5" and has pretty good resolution. (Second pix.) QRP Guys will be selling the board. My club did a build of this AA and I wrote an assembly manual to go with it. The code will be published in QST.

I'm hoping that I may be able to squeeze the basic AA into the BITX40, along with the other things I want to add to the rig. I'll post the code when everything is finished.

Jack, W8TEE


From: John Smith via Groups.Io <johnlinux77@...>
To: [email protected]
Sent: Tuesday, February 21, 2017 12:57 PM
Subject: Re: [BITX20] Flutter Fix

After you two guys decide on your collaboration of coding, I am willing to try it and give you feedback. ?I am at the earliest stages of playing with arduino beyond the Blink and Servo Motor sketches. I am still planning to make Jacks DDS VFO from his Arduino for amateur radio book, and implement it with the Frog Sounds CW Kit. As well as a Arduino antenna analyzer.?
How is this implemented "Shut it down with?noTone();" Is this a keyboard command, or button activated?
Well, at least you know I am good at describing a problem with all the details.
And I got a backup of my code with the tune pin change.



 

I will be sure to check out the analyzer when it comes out. By the time you guys get this bit of code organized where I can just copy and paste it in, I should be done putting mine in an enclosure. A basic black spray painted rectangle holiday tin. I used a nibbler for the LCD cutout and it looks a thousand times better than some others jagged Dremel cut outs.

I once killed a Uno by plugging in the USB cable while it was still plugged in to 12V. I knew better, but just didn't notice it first. I will be thinking about that when I upload the new sketch. And I do have a spare Nano.

Side note: Make it easy on yourself and change the pots for the knobs you have. On mine I thought I would be slick and use a 100K ?for nicer tuning. But nope, the higher resistance pot had a high resistance response on the incoming signal. No radio signals, just random birdies. Swapping it out to a smaller size diameter 10K pot put it back like it was with the original part.


 

Comrades!

Do you think we should move the software related issues to another list? Just asking, I am not advocating it. The nature of open software code discussions is such that it will give jeepers to the 'rest of us'. Those on the linux kernel list will vouch for this. the discussions are often wild and engaged and some times scarily technical.?

- f

On Wed, Feb 22, 2017 at 12:49 PM, John Smith via Groups.Io <johnlinux77@...> wrote:

I will be sure to check out the analyzer when it comes out. By the time you guys get this bit of code organized where I can just copy and paste it in, I should be done putting mine in an enclosure. A basic black spray painted rectangle holiday tin. I used a nibbler for the LCD cutout and it looks a thousand times better than some others jagged Dremel cut outs.

I once killed a Uno by plugging in the USB cable while it was still plugged in to 12V. I knew better, but just didn't notice it first. I will be thinking about that when I upload the new sketch. And I do have a spare Nano.

Side note: Make it easy on yourself and change the pots for the knobs you have. On mine I thought I would be slick and use a 100K ?for nicer tuning. But nope, the higher resistance pot had a high resistance response on the incoming signal. No radio signals, just random birdies. Swapping it out to a smaller size diameter 10K pot put it back like it was with the original part.



 

Ashhar Farhan wrote:
Comrades!

Do you think we should move the software related issues to another list? Just asking, I am not advocating it. The nature of open software code discussions is such that it will give jeepers to the 'rest of us'. Those on the linux kernel list will vouch for this. the discussions are often wild and engaged and some times scarily technical.

- f
Hi Ashhar,
I for one would like to keep the Bitx-40 software discussions on this list, there is always the delete key for those who are not inclined to dabble with the messages about software. Those of us who are not programmers but are interested in how the code can be used will learn what can or cannot be achieved. I am having fun learning how git works for example. See you can teach an old dog a few tricks:-)

Best 73 Alf vk2yac


Jack Purdum
 

All:

While software is "my thing", I would really prefer to keep it tied into this group. A spin off might see a big-frog-little-pond effect for us, I think it's important for us software nerds to keep pace with all that you're doing in hardware. Things I'm trying to do in software (e.g., capacitive touch keyer, TFT display, etc.) is going to result from changes in the hardware. Dennis (W6DQ) and I are working hard on some software changes (me) that play into the hardware (Dennis). I think it's important for both of us to know issues/features/strengths/weaknesses of the B40. (I'm calling it that cuz I'm lazy.)

Anyway, I vote to not isolate us, but keep us in the fold.

Jack, W8TEE



From: alf <fpdbase@...>
To: [email protected]
Sent: Wednesday, February 22, 2017 6:03 AM
Subject: Re: [BITX20] Flutter Fix

Ashhar Farhan wrote:
> Comrades!
>
> Do you think we should move the software related issues to another
> list? Just asking, I am not advocating it. The nature of open software
> code discussions is such that it will give jeepers to the 'rest of
> us'. Those on the linux kernel list will vouch for this. the
> discussions are often wild and engaged and some times scarily technical.
>
> - f
>
Hi Ashhar,
? ? ? ? ? ? ? ? ? I for one would like to keep the Bitx-40 software
discussions on this list, there is always the delete key for those who
are not inclined to dabble with the messages about software. Those of us
who are not programmers but are interested in how the code can be used
will learn what can or cannot be achieved. I am having fun learning how
git works for example.? See you can teach an old dog a few tricks:-)

Best 73 Alf vk2yac