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