/* This program written by Alastair GW0AJU. The code presented here for an all HF tri-band digital vfo. The program code is set in this listing as the lower ham band 80m, 40m, and 20m band, with either CW or SSB. In all cases, the code uses a 9MHz intermediate frequency for reception, and also for SSB exciter. However for CW transmissions, the digital VFO is placed directly onto the dial frequency as the digital vfo is used as the carrier oscillator for TX mode, thus CW keying the digital vfo for CW tx onto the output dial frequency setting, then the digital vfo adjusted for reception onto a 9MHz intermediate frequency setting. An i/o bus expander of the pcf8754 type is used to access to an output LED panel indicator, while also giving a logic output for ham band antenna switching on three of the i/o bus pins, P0, P1 and P2. The carrier mode switching is also present on the i/o bus, on pins P3 for CW and P4 for SSB, the morse key and PTT line is also imaged on i/o pin P5. Pins P3 for CW and P4 for SSB can also switch the I.F. carrier mode filtering. It is suggested that in order to accurately use the twi display and i/o bus expander, use a twi searching program to find the network address of each unit. Ardunio board used = Ardiuno Uno original date 13th April 2017 */ //********** liquid display setup ********* #include "si5351.h" Si5351 si5351; #include #include #include #define I2C_ADDR 0x27 // <<- Add your address here. #define Rs_pin 0 #define Rw_pin 1 #define En_pin 2 #define BACKLIGHT_PIN 3 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); int PCF = 32; // TWI bus location for the pcf8754 i/o 8bit bus expander chip ( 32 = 0x20 ) //*********** arduino uno eeprom setup ************* #include long start_freq; long address; //*********** rotary encoder dial setup ************** int clk_location = 2; int dt_location = 3; //******************** morse key and tx_rx relay ************** int cw_key_ptt = 4; // pin 4 for cw key connection int test_cw_key_ptt; int check_cw_key_ptt = HIGH; int test_key = LOW; //********* logic switch for vfo step change ***************** int vfo_step_DA = 5; // logic pin d0 for vfo step change int vfo_step_DB = 6; // logic pin d1 for vfo step change int DA; int DB; int HDA; int HDB; //********** 80m, 40m and 20m band select switch ************** int band_change_DA = 7; int band_change_DB = 8; int BDA = HIGH; int BDB = HIGH; int BDC = HIGH; int BDD = HIGH; //***************** carier mode selection **************** int carrier_mode_sense = 13; // sense CW or LSB, CW over-ride switch input int CW_SSB; int test_CW_SSB = HIGH; int check_CW_SSB = LOW; int band_mode = 0; unsigned long cio = 9E6 - 1500; // use LSB for sideband reversal unsigned long cio_freq_set = 0; // ******************************************************* int run_once = 1; float result = 0; unsigned long IF_LO; unsigned long freq; long dial_step; unsigned long carrier_centre; unsigned long frequency = 0; unsigned long VFO_freq_set = 0; float dial_post = 0; long last_Set = 0; int move_dial = 0; int dial_delay_clk = 0; int dial_delay_anti_clk = 0; int dial_delay_movement = 0; int start_line = 0; //********** start of arduino DDS VFO control program ********* //This function will write a 4 byte (32bit) long to the eeprom at //the specified address to address + 3. void EEPROMWritelong(int address, long value) { //Decomposition from a long to 4 bytes by using bitshift. //One = Most significant -> Four = Least significant byte byte four = (value & 0xFF); byte three = ((value >> 8) & 0xFF); byte two = ((value >> 16) & 0xFF); byte one = ((value >> 24) & 0xFF); //Write the 4 bytes into the eeprom memory. EEPROM.write(address, four); EEPROM.write(address + 1, three); EEPROM.write(address + 2, two); EEPROM.write(address + 3, one); } //This function will return a 4 byte (32bit) long from the eeprom //at the specified address to address + 3. long EEPROMReadlong(long address) { //Read the 4 bytes from the eeprom memory. long four = EEPROM.read(address); long three = EEPROM.read(address + 1); long two = EEPROM.read(address + 2); long one = EEPROM.read(address + 3); //Return the recomposed long by using bitshift. return ((four << 0) & 0xFF) + ((three << 8) & 0xFFFF) + ((two << 16) & 0xFFFFFF) + ((one << 24) & 0xFFFFFFFF); } void setup() { si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0); // first zero in above command indicates a 25MHz Xtal used, second zero there is no frequency correction used si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLA); si5351.pll_reset(SI5351_PLLA); si5351.set_pll(SI5351_PLL_FIXED, SI5351_PLLB); si5351.pll_reset(SI5351_PLLB); // set a 3dBm drive from DDS board si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_6MA); si5351.drive_strength(SI5351_CLK1, SI5351_DRIVE_6MA); si5351.drive_strength(SI5351_CLK2, SI5351_DRIVE_6MA); si5351.output_enable(SI5351_CLK0, 1); // Tx/Rx vfo si5351.output_enable(SI5351_CLK1, 1); // bfo si5351.output_enable(SI5351_CLK2, 0); // not used pin si5351.update_status(); Serial.begin(9600); // error correction in program code use only pinMode(clk_location, INPUT); // pin 2 rotary encoder pinMode(dt_location, INPUT); // pin 3 rotary encoder pinMode(cw_key_ptt, INPUT); // pin 4 morse key pinMode(vfo_step_DA, INPUT); // pin 5 logic pin d0 for vfo step change pinMode(vfo_step_DB, INPUT); // pin 6 logic pin d1 for vfo step change pinMode(band_change_DA, INPUT); // pin 7 logic pin d0 for band change pinMode(band_change_DB, INPUT); // pin 8 logic pin d1 for band change pinMode(carrier_mode_sense, INPUT); // pin 13 CW over-ride switch on low active // ********* start up display messages ************ Wire.begin(); lcd.begin (16,2); // <<-- our LCD is a 20x4, change for your LCD if needed // LCD Backlight ON lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home(); // go home on LCD lcd.setCursor(0,0); // first line of display lcd.print("HF 80m 40m 20m"); lcd.setCursor(0,1); lcd.print("Digital VFO v2"); delay(1500); lcd.clear(); lcd.home(); lcd.setCursor(0,0); // first line of display lcd.print("program code by"); lcd.setCursor(0,1); lcd.print("Alastair GW0AJU"); delay(1500); lcd.clear(); lcd.home(); //*************** initialise the memory on first time boot up ***************** address = 0; long pwr_up_eighty_metre = 3560000; //Starting at the first byte on the eeprom. start_freq = EEPROMReadlong(address); if (start_freq > 3500000 && start_freq < 4000000) { carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; } else { EEPROMWritelong(address, pwr_up_eighty_metre); address = 0; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; } address = 4; long pwr_up_forty_metres = 7023000; //Starting at the first byte on the eeprom. start_freq = EEPROMReadlong(address); if (start_freq > 7000000 && start_freq < 7300000) { carrier_centre = EEPROMReadlong(address); } else // if (start_freq < 1800000 && start_freq > 2000000) { EEPROMWritelong(address, pwr_up_forty_metres); address = 4; carrier_centre = EEPROMReadlong(address); } address = 8; long pwr_up_twenty_metre = 14060000; //Starting at the first byte on the eeprom. start_freq = EEPROMReadlong(address); if (start_freq > 14000000 && start_freq < 14350000) { carrier_centre = EEPROMReadlong(address); } else { EEPROMWritelong(address, pwr_up_twenty_metre); address = 8; carrier_centre = EEPROMReadlong(address); } //***************** last used memory recall and carrier mode starup ****************** CW_SSB = digitalRead(carrier_mode_sense); BDA = digitalRead(band_change_DA); BDB = digitalRead(band_change_DB); if (BDA == HIGH && BDB == LOW && CW_SSB == LOW) // 40metres band { band_mode = 1; address = 0; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("80m"); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("CW"); Wire.beginTransmission(PCF); Wire.write(B00110110); // 40m , CW Wire.endTransmission(); } else if (BDA == HIGH && BDB == LOW && CW_SSB == HIGH) { band_mode = 1; address = 0; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("80m"); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("LSB"); Wire.beginTransmission(PCF); Wire.write(B00101110); // 40m , USB Wire.endTransmission(); } if (BDA == HIGH && BDB == HIGH && CW_SSB == LOW ) // 20metre band { band_mode = 1; address = 4; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("40m"); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("CW"); Wire.beginTransmission(PCF); Wire.write(B00110101); // 20m , CW Wire.endTransmission(); } else if (BDA == HIGH && BDB == HIGH && CW_SSB == HIGH) { band_mode = 1; address = 4; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("40m "); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("LSB"); Wire.beginTransmission(PCF); Wire.write(B00101101); // 20m , USB Wire.endTransmission(); } if (BDA == LOW && BDB == HIGH && CW_SSB == LOW) // 15metre band { band_mode = 2; address = 8; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("20m "); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("CW"); Wire.beginTransmission(PCF); Wire.write(B00110011); // 15m , CW Wire.endTransmission(); } else if (BDA == LOW && BDB == HIGH && CW_SSB == HIGH ) { band_mode = 2; address = 8; carrier_centre = EEPROMReadlong(address); frequency = carrier_centre; lcd.home(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("20m "); // set message for band operation lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("USB"); Wire.beginTransmission(PCF); Wire.write(B00101011); // 15m , USB Wire.endTransmission(); } vfo_step_change(); // routine for change the vfo step 10Hz, 100Hz, or 1KHz dial_post = carrier_centre; // display show centre channel frequency of Radio set operation band_change(); // start up check of band in use at stsrt up point of arduino dial_frequency(); } //************* void loop *********************** void loop() { radio_panel_change(); // detect vahnge in ham band or carrier mode getEncoderTurn(); // rotary encoder sub-routine for rotary movement of dial setting } //*************** start of program code sub-routines **************** //***************** radio panel change ************** void radio_panel_change() { HDA = digitalRead(vfo_step_DA); HDB = digitalRead(vfo_step_DB); BDC = digitalRead(band_change_DA); // old state of switch BDD = digitalRead(band_change_DB); // old state of switch test_cw_key_ptt = digitalRead(cw_key_ptt); // old state of cw_key_ptt check_cw_key_ptt = test_cw_key_ptt; CW_SSB = digitalRead(carrier_mode_sense); check_CW_SSB = CW_SSB; if ( BDC != BDA || BDD != BDB ) // ham band change { BDA = BDC; BDB = BDD; band_change(); panel_display(); carrier_mode(); dial_frequency(); } if ( HDA != DA || HDB != DB ) // vfo step change { DA = HDA; DB = HDB; vfo_step_change(); } if ( check_cw_key_ptt == LOW ) // ptt and morse key change { tx(); panel_display(); } if ( check_cw_key_ptt == HIGH ) // ptt and morse key change { rx(); panel_display(); } if ( check_CW_SSB != test_CW_SSB ) // carrier mode change { test_CW_SSB = check_CW_SSB; carrier_mode(); panel_display(); } } //********************* display dial frequency ************* void dial_frequency() { dial_post = carrier_centre; // display show centre channel frequency of Radio set operation lcd.home(); lcd.setCursor(0,0); lcd.print("vfo="); lcd.setCursor(4,0); lcd.print(" "); lcd.setCursor(4,0); lcd.print(dial_post/1E3,3); lcd.setCursor(13,0); lcd.print("KHz"); } // *************** LED front panel of radio indication routine ******************* void panel_display() { // the i2c parallel o/p interface bus chip pulls down to light led // D0 = band one, D1 = band two, D2 = band three, D3 = CW, D4 = SSB, D5 = Tx on ( led off = Rx mode ) // un-used outputs D6, D7 o/p are held high by the i2c bus chip o/p //**************************** 80m indication ************************* if ( BDA == HIGH && BDB == LOW && check_cw_key_ptt == HIGH && CW_SSB == HIGH) // 80m, Rx, LSB { Wire.beginTransmission(PCF); Wire.write(B11101110); // 80m, Rx, LSB Wire.endTransmission(); } if ( BDA == HIGH && BDB == LOW && check_cw_key_ptt == LOW && CW_SSB == HIGH) // 80m, Tx, LSB { Wire.beginTransmission(PCF); Wire.write(B11001110); // 80m, Tx, LSB Wire.endTransmission(); } if ( BDA == HIGH && BDB == LOW && check_cw_key_ptt == HIGH && CW_SSB == LOW) // 80m, Rx, CW { Wire.beginTransmission(PCF); Wire.write(B11110110); // 80m, Rx, CW Wire.endTransmission(); } if ( BDA == HIGH && BDB == LOW && check_cw_key_ptt == LOW && CW_SSB == LOW) // 80m, Tx, CW { Wire.beginTransmission(PCF); Wire.write(B11010110); // 80m, Tx, CW Wire.endTransmission(); } //*********************** 40m indication ******************************** if ( BDA == HIGH && BDB == HIGH && check_cw_key_ptt == HIGH && CW_SSB == HIGH) // 40m, Rx, LSB { Wire.beginTransmission(PCF); Wire.write(B11101101); // 40m, Rx, LSB Wire.endTransmission(); } if ( BDA == HIGH && BDB == HIGH && check_cw_key_ptt == LOW && CW_SSB == HIGH) // 40m, Tx, LSB { Wire.beginTransmission(PCF); Wire.write(B11001101); // 40m, Tx, LSB Wire.endTransmission(); } if ( BDA == HIGH && BDB == HIGH && check_cw_key_ptt == HIGH && CW_SSB == LOW) // 40m, Rx, CW { Wire.beginTransmission(PCF); Wire.write(B11110101); // 40m, Rx, CW Wire.endTransmission(); } if ( BDA == HIGH && BDB == HIGH && check_cw_key_ptt == LOW && CW_SSB == LOW) // 40m, Rx, CW { Wire.beginTransmission(PCF); Wire.write(B11010101); // 40m, Tx, CW Wire.endTransmission(); } //*************************** 20m indication *************************************** if ( BDA == LOW && BDB == HIGH && check_cw_key_ptt == HIGH && CW_SSB == HIGH) // 20m, Rx, USB { Wire.beginTransmission(PCF); Wire.write(B11101011); // 20m, Rx, USB Wire.endTransmission(); } if ( BDA == LOW && BDB == HIGH && check_cw_key_ptt == LOW && CW_SSB == HIGH) // 20m, Tx, USB { Wire.beginTransmission(PCF); Wire.write(B11001011); // 20m, Tx, USB Wire.endTransmission(); } if ( BDA == LOW && BDB == HIGH && check_cw_key_ptt == HIGH && CW_SSB == LOW) // 20m, Rx, CW { Wire.beginTransmission(PCF); Wire.write(B11110011); // 20m, Rx, CW Wire.endTransmission(); } if ( BDA == LOW && BDB == HIGH && check_cw_key_ptt == LOW && CW_SSB == LOW) // 20m, Rx, CW { Wire.beginTransmission(PCF); Wire.write(B11010011); // 20m, Tx, CW Wire.endTransmission(); } } //*************** receive and transmit control routines ********* void rx() { check_cw_key_ptt = digitalRead(cw_key_ptt); // old state of cw_key_ptt CW_SSB = digitalRead(carrier_mode_sense); if ( check_cw_key_ptt == HIGH && CW_SSB == HIGH) { IF_LO = carrier_centre + 9E6; // Rx vfo L.O. output for 9MHz I.F. USB if (last_Set != IF_LO) { frequency = IF_LO; sendFrequency(); last_Set = IF_LO; } } if ( check_cw_key_ptt == HIGH && CW_SSB == LOW ) { IF_LO = carrier_centre + 9E6; // Rx vfo L.O. output for 9MHz I.F. CW if (last_Set != IF_LO) { frequency = IF_LO; // the output of the dds oscillator is switch off then on, // to avoid fm sweep across the band while CW keying si5351.output_enable(SI5351_CLK0, 0); // Tx/Rx vfo o/p switched off before freq change sendFrequency(); si5351.output_enable(SI5351_CLK0, 1); // Tx/Rx vfo o/p switch on after freq change last_Set = IF_LO; } } } void tx() { check_cw_key_ptt = digitalRead(cw_key_ptt); // old state of cw_key_ptt CW_SSB = digitalRead(carrier_mode_sense); if ( check_cw_key_ptt == LOW && CW_SSB == HIGH) { IF_LO = carrier_centre + 9E6; // Tx vfo L.O. output for 9MHz I.F. USB if (last_Set != IF_LO) { frequency = IF_LO; sendFrequency(); last_Set = IF_LO; } } if ( check_cw_key_ptt == LOW && CW_SSB == LOW ) { IF_LO = (carrier_centre); // Tx vfo L.O. to output dial frequency if (last_Set != IF_LO) { frequency = IF_LO; // the output of the dds oscillator is switch off then on, // to avoid fm sweep across the band while CW keying si5351.output_enable(SI5351_CLK0, 0); // Tx/Rx vfo o/p switched off before freq change sendFrequency(); si5351.output_enable(SI5351_CLK0, 1); // Tx/Rx vfo o/p switch on after freq change last_Set = IF_LO; } } } //***************************** carrier mode change **************************** void carrier_mode() { if (CW_SSB == HIGH && band_mode == 2)// usb { cio = 9E6 + 1500; // Rx L.O. output for 9MHz I.F. USB send_BFO(); lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("USB"); } else if (CW_SSB == HIGH && band_mode == 1)// lsb { cio = 9E6 - 1500 ; // Rx L.O. output for 9MHz I.F. LSB send_BFO(); lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("LSB"); } else if (CW_SSB == LOW )// cw { cio = 9E6 - 600; // use -600Hz for a audio tone of 600Hz on CW Rx send_BFO(); lcd.setCursor(6,1); lcd.print(" "); lcd.setCursor(6,1); lcd.print("CW"); } dial_post = carrier_centre; // display show centre channel frequency of Radio set operation lcd.home(); lcd.setCursor(0,0); lcd.print("vfo="); lcd.setCursor(5,0); lcd.print(dial_post/1E3,3); lcd.print("KHz"); } //*********************** band cahnge ********************************* void band_change() { // ********************** 40metre ham band ******************** if (BDA == HIGH && BDB == LOW ) // 80metre band { band_mode = 1; // set the 80m band to lsb for ssb address = 0; carrier_centre = EEPROMReadlong(address); sendFrequency(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("80m"); } //********************** 20metre ham band ************************** if (BDA == HIGH && BDB == HIGH ) // 40metre band { band_mode = 1; // set the 40m band to lsb for ssb address = 4; carrier_centre = EEPROMReadlong(address); sendFrequency(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("40m"); } //************************ 15metre ham band *********************** if (BDA == LOW && BDB == HIGH ) // 20metre band { band_mode = 2; // set the 20m band to usb for ssb address = 8; carrier_centre = EEPROMReadlong(address); sendFrequency(); lcd.setCursor(0,1); lcd.print(" "); lcd.setCursor(0,1); lcd.print("20m"); } dial_frequency(); } //************** dial vfo step change ****************** void vfo_step_change() { if (DA == HIGH && DB == LOW) { dial_step = 5000; // 1KHz vfo increment dial_delay_movement = 5; lcd.setCursor(10,1); lcd.print(" "); lcd.setCursor(12,1); lcd.print("1KHz"); } else if (DA == HIGH && DB == HIGH) { dial_step = 100; // 100Hz vfo increment dial_delay_movement = 3; lcd.setCursor(10,1); lcd.print(" "); lcd.setCursor(11,1); lcd.print("100Hz"); } else if (DA == LOW && DB == HIGH) { dial_step = 10; // 10Hz vfo increment dial_delay_movement = 1; lcd.setCursor(10,1); lcd.print(" "); lcd.setCursor(12,1); lcd.print("10Hz"); } } //******** detection of rotary dial movement and change of carrier frequency ************ void getEncoderTurn() // rotary encoder sub-routine for rotary movement { if (digitalRead(clk_location) == HIGH) // anti clock wise direction { dial_delay_clk = 0; delay(3); if (digitalRead(clk_location) == LOW) { dial_delay_anti_clk = dial_delay_anti_clk + 1; if ( dial_delay_anti_clk == dial_delay_movement ) // change the number 18 to a higher value for smoother operation { result = -1; // down band movement carrier_centre = carrier_centre + (result * dial_step); dial_post = carrier_centre; lcd.setCursor(4,0); lcd.print(" "); lcd.setCursor(4,0); lcd.print(dial_post/1E3,3); lcd.setCursor(13,0); lcd.print("KHz"); dial_delay_anti_clk = 0; } } } else if (digitalRead(dt_location) == HIGH) // clock wise direction { dial_delay_anti_clk = 0; delay(3); if (digitalRead(dt_location) == LOW) { dial_delay_clk = dial_delay_clk + 1; if ( dial_delay_clk == dial_delay_movement ) // change the number 18 to a higher value for smoother operation { result = 1; // up band movement carrier_centre = carrier_centre + (result * dial_step); dial_post = carrier_centre; lcd.setCursor(4,0); lcd.print(" "); lcd.setCursor(4,0); lcd.print(dial_post/1E3,3); lcd.setCursor(13,0); lcd.print("KHz"); dial_delay_clk = 0; } } } if (BDA == HIGH && BDB == LOW) // 80m { address = 0; EEPROMWritelong(address, carrier_centre); } else if (BDA == HIGH && BDB == HIGH) // 40m { address = 4; EEPROMWritelong(address, carrier_centre); } else if (BDA == LOW && BDB == HIGH) // 20m { address = 8; EEPROMWritelong(address, carrier_centre); } } // **************************************************************************************** // ************* frequency VFO control from dial change ***************** // *********** frequency control of the si5351 DDS device for TX / Rx vfo ********* void sendFrequency() { VFO_freq_set = frequency * 100ULL; si5351.set_freq(VFO_freq_set, SI5351_CLK0); si5351.update_status(); } //************************************************************************** // Carrier insursion oscillator, BFO void send_BFO() { cio_freq_set = cio * 100ULL; si5351.set_freq(cio_freq_set, SI5351_CLK1); si5351.update_status(); } //************************************************************************** //************ hadware test for the panel mechanical switching gear ******** // put the " button_test() " in the "void loop()" as the only sub-routine to test the switches. void button_test() { BDA = digitalRead(band_change_DA); BDB = digitalRead(band_change_DB); if (BDA == HIGH) { lcd.setCursor(0,0); lcd.print("BDA=1"); } else { lcd.setCursor(0,0); lcd.print("BDA=0"); } if (BDB == HIGH) { lcd.setCursor(0,1); lcd.print("BDB=1"); } else { lcd.setCursor(0,1); lcd.print("BDB=0"); } DA = digitalRead(vfo_step_DA); DB = digitalRead(vfo_step_DB); if (DA == HIGH) { lcd.setCursor(6,0); lcd.print("DA=1"); } else { lcd.setCursor(6,0); lcd.print("DA=0"); } if (DB == HIGH) { lcd.setCursor(6,1); lcd.print("DB=1"); } else { lcd.setCursor(6,1); lcd.print("DB=0"); } int CC = digitalRead(carrier_mode_sense); if (CC == HIGH) { lcd.setCursor(11,0); lcd.print("CK=1"); } else { lcd.setCursor(11,0); lcd.print("CK=0"); } } //**************************** end of program code ****************************