Hi,
I have been going thru all of the libraries associated with DC806A (Linduino demo board) trying to find where the "cs" (Chip Select pin) is actually connected too on the arduino end. It seems the LT_SPI library is where they refer to this pin and set it up as an output but I can't anywhere find what Digital Output they refer to so that I can change it or just connect to it.
After 2 weeks and new grey hairs, my project is late, my customer unhappy, I'm learning alot and I understand you guys like us to learn ourselves but please can someone help me ?????
#include <Arduino.h>
#include <stdint.h>
#include "Linduino.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "LT_I2C.h"
#include "QuikEval_EEPROM.h"
#include "LTC1867.h"
#include <SPI.h>
#include <Wire.h>
//! Initialize Linduino
void setup()
{
char demo_name[]="DC806"; //!< Demo Board Name stored in QuikEval EEPROM
uint16_t adc_code;
quikeval_I2C_init(); // Configure the EEPROM I2C port for 100kHz
quikeval_SPI_init(); // Configure the spi port for 4MHz SCK
quikeval_SPI_connect(); // Connect SPI to main data port
Serial.begin(115200); // Initialize the serial port to the PC
print_title();
demo_board_connected = discover_demo_board(demo_name);
if (demo_board_connected)
{
restore_calibration();
LTC1867_read(LTC1867_CS, BUILD_COMMAND_SINGLE_ENDED[0], &adc_code); // Wakes up ADC if it was in sleep mode
print_prompt();
}
}
void loop(){
//! Read Channels in Single-Ended mode with Ch7 as COM
//! @return void
void menu_3_read_single_ended_com7()
{
uint8_t user_command;
uint8_t adc_command; // The LTC1867 command byte
uint16_t adc_code = 0; // The LTC1867 code
float adc_voltage; // The LTC1867 voltage
while (1)
{
if (uni_bi_polar == LTC1867_UNIPOLAR_MODE)
Serial.println(F("Single-Ended (COM=CH7), Unipolar mode:"));
else
Serial.println(F("Single-Ended (COM=CH7), Bipolar mode:"));
Serial.println(); // Display single-ended menu
Serial.println(F("*************************"));
Serial.println();
Serial.println(F("CH7 as COM\n"));
Serial.println(F("0-CH0"));
Serial.println(F("1-CH1"));
Serial.println(F("2-CH2"));
Serial.println(F("3-CH3"));
Serial.println(F("4-CH4"));
Serial.println(F("5-CH5"));
Serial.println(F("6-CH6"));
Serial.println(F("7-ALL"));
Serial.println(F("m-Main Menu"));
Serial.print(F("Enter a Command: "));
user_command = read_int(); // Read the single command
if (user_command == 'm')
return;
Serial.println(user_command);
Serial.println();
if (user_command == 7)
{
Serial.println(F("ALL with CH7 as COM"));
adc_command = BUILD_COMMAND_SINGLE_ENDED_COM7[0] | uni_bi_polar; // Build ADC command for channel 0 with channel 7 as a common pin
LTC1867_read(LTC1867_CS, adc_command, &adc_code); // Throws out last reading
delay(100);
uint8_t x; //!< iteration variable
for (x = 0; x <= 6; x++) // Read all channels in single-ended mode with channel 7 as a common pin
{
adc_command = BUILD_COMMAND_SINGLE_ENDED_COM7[(x + 1) % 7] | uni_bi_polar;
LTC1867_read(LTC1867_CS, adc_command, &adc_code);
if (uni_bi_polar == LTC1867_UNIPOLAR_MODE)
adc_voltage = LTC1867_unipolar_code_to_voltage(adc_code, LTC1867_lsb, LTC1867_offset_bipolar_code);
else
adc_voltage = LTC1867_bipolar_code_to_voltage(adc_code, LTC1867_lsb, LTC1867_offset_bipolar_code);
Serial.println();
Serial.print(F(" ****"));
Serial.print(F("CH"));
Serial.print(x);
Serial.print(F(" with CH7 as COM: "));
Serial.print(adc_voltage, 4);
Serial.println(F("V"));
}
}
else
{
adc_command = BUILD_COMMAND_SINGLE_ENDED_COM7[user_command]| uni_bi_polar;
Serial.println();
Serial.print(F("ADC Command: B"));
Serial.println(adc_command, BIN);
LTC1867_read(LTC1867_CS, adc_command, &adc_code); // Throws out last reading
delay(100);
LTC1867_read(LTC1867_CS, adc_command, &adc_code);
Serial.print(F("Received Code: 0x"));
Serial.println(adc_code, HEX);
if (uni_bi_polar == LTC1867_UNIPOLAR_MODE)
adc_voltage = LTC1867_unipolar_code_to_voltage(adc_code, LTC1867_lsb, LTC1867_offset_bipolar_code);
else
adc_voltage = LTC1867_bipolar_code_to_voltage(adc_code, LTC1867_lsb, LTC1867_offset_bipolar_code);
Serial.println();
Serial.print(F(" ****"));
Serial.print(F("CH"));
Serial.print(user_command);
Serial.print(F(": "));
Serial.print(adc_voltage, 4);
Serial.println(F("V"));
}
}
}
There is other code that I have left out cause it's just so huge and irrelivant to what I am trying to do.
Below is my code so far (it does not compile and may have silly errors but it's not finished, until I can wire it up properly, I can't test.
So anyone who knows where this unit8_t CS (unit8_t cs pin (in libraries) ) is defined and can help, please do. Even if i have to pay you