Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
DC2693A.ino
Go to the documentation of this file.
1 /*!
2 Linear Technology DC2693A Demonstration Board
3 LTC5556: Dual Programmable Downconverting Mixer with IF DVGAs
4 
5 @verbatim
6 
7 The LTC5556 dual programmable gain downconverting mixer
8 is ideal for diversity and MIMO receivers that require
9 precise gain setting. Each channel incorporates an active
10 mixer and a digital IF VGA with 15.5dB gain control range.
11 The IF gain of each channel is programmed in 0.5dB steps
12 through the SPI. A reduced power mode is also available
13 for each channel.
14 
15 @endverbatim
16 
17 http://www.analog.com/en/products/rf-microwave/mixers/single-double-triple-balanced-mixers/ltc5556.html
18 
19 Copyright 2018(c) Analog Devices, Inc.
20 
21 All rights reserved.
22 
23 Redistribution and use in source and binary forms, with or without
24 modification, are permitted provided that the following conditions are met:
25  - Redistributions of source code must retain the above copyright
26  notice, this list of conditions and the following disclaimer.
27  - Redistributions in binary form must reproduce the above copyright
28  notice, this list of conditions and the following disclaimer in
29  the documentation and/or other materials provided with the
30  distribution.
31  - Neither the name of Analog Devices, Inc. nor the names of its
32  contributors may be used to endorse or promote products derived
33  from this software without specific prior written permission.
34  - The use of this software may or may not infringe the patent rights
35  of one or more patent holders. This license does not release you
36  from the requirement that you obtain separate licenses from these
37  patent holders to use this software.
38  - Use of the software either in source or binary form, must be run
39  on or directly connected to an Analog Devices Inc. component.
40 
41 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
42 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
43 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
45 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
47 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 */
52 
53 /*! @file
54  @ingroup LTC5556
55 */
56 
57 #include "LTC5556.h"
58 #include <SPI.h>
59 #include "LT_SPI.h"
60 #include "UserInterface.h"
61 #include "Linduino.h"
62 
63 // Function Declarations
64 
65 // Print the title block
66 void LTC5556_print_title();
67 
68 // Print the initial prompt
70 
71 //! Initialize Linduino
72 //! @return void
73 void setup() {
74  // Configure the SPI port for 4MHz SCK
76 
77  // Initialize the serial port to the PC
78  Serial.begin(115200);
79 
80  // Displays the title
82 
83  // Displays the initial prompt
85 }
86 
87 //! Repeats Linduino loop
88 //! @return void
89 void loop() {
90  // The user input command
91  uint8_t user_command;
92 
93  // The register value read back from the LTC5556
94  uint16_t output_register;
95 
96  // Variable for decoding mixer 1's register value
97  uint8_t byte_1;
98 
99  // Variable for decoding mixer 2's register value
100  uint8_t byte_2;
101 
102  if (Serial.available()) {
103  // Read the user command
104  user_command = read_int();
105 
106  // Print the command to the screen
107  Serial.println(user_command);
108  switch (user_command){
109  case 1:
110  // Run the duplicate settings function
111  output_register = LTC5556_dupl_settings();
112  Serial.println(F("\n\n\nLTC5556 settings:\n"));
113 
114  // Decode the resulting value
115  LTC5556_decode_output(output_register);
116  break;
117  case 2:
118  // Run the different settings function
119  output_register = LTC5556_diff_settings();
120 
121  // Pick off the least significant 8 bits for decoding
122  byte_1 = output_register & 0xFF;
123 
124  // Pick off the most significant 8 bits for decoding
125  byte_2 = output_register >> 8;
126 
127  Serial.println(F("\n\n\nLTC5556 Mixer 1 settings:\n"));
128 
129  // Decode the resulting value
130  LTC5556_decode_output(byte_1);
131  Serial.println(F("\n\n\nLTC5556 Mixer 2 settings:\n"));
132 
133  // Decode the resulting value
134  LTC5556_decode_output(byte_2);
135  break;
136  default:
137  Serial.println(F("\n\nIncorrect Option\n"));
138  }
139  Serial.println(F("\n*****************************************************************\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"));
141  }
142 }
143 
144 //! Prints the title block
145 //! @return void
147  Serial.println(F("*****************************************************************"));
148  Serial.println(F("* DC2693A Demonstration Program *"));
149  Serial.println(F("* *"));
150  Serial.println(F("* This program demonstrates how to send data to the LTC5556. *"));
151  Serial.println(F("*****************************************************************"));
152 }
153 
154 //! Prints the initial prompt
155 //! @return void
157  Serial.println(F("\n1. Same settings for Channels 1 and 2"));
158  Serial.println(F("2. Different settings for Channels 1 and 2\n"));
159  Serial.print(F("Enter a command: "));
160 }
161 
unsigned char user_command
uint16_t LTC5556_diff_settings()
Function to apply unique settings for each LTC5556 channel.
Definition: LTC5556.cpp:136
static void loop()
Repeats Linduino loop.
Definition: DC2693A.ino:89
Copyright 2018(c) Analog Devices, Inc.
uint8_t LTC5556_dupl_settings()
Function to duplicate settings for both LTC5556 channels.
Definition: LTC5556.cpp:97
Header File for Linduino Libraries and Demo Code.
static void LTC5556_print_title()
Prints the title block.
Definition: DC2693A.ino:146
void LTC5556_decode_output(uint8_t output_register)
Decode the register value read from the LTC5556.
Definition: LTC5556.cpp:293
static void setup()
Initialize Linduino.
Definition: DC2693A.ino:73
static void LTC5556_print_prompt()
Prints the initial prompt.
Definition: DC2693A.ino:156
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
Definition: LT_SPI.cpp:151
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
int32_t read_int()