0% found this document useful (0 votes)
166 views

ADS1262 Issue

The document describes a loop that operates a DAC, ADS1262 ADC, TFT display, and SD card in sequence. It sets the DAC value, displays it on the TFT, takes an ADC reading with the ADS1262, displays the voltage on the TFT, and writes the DAC value and voltage to the SD card. It repeats this process, incrementing the DAC value each time, until it reaches the final value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
166 views

ADS1262 Issue

The document describes a loop that operates a DAC, ADS1262 ADC, TFT display, and SD card in sequence. It sets the DAC value, displays it on the TFT, takes an ADC reading with the ADS1262, displays the voltage on the TFT, and writes the DAC value and voltage to the SD card. It repeats this process, incrementing the DAC value each time, until it reaches the final value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

for(j=initvalue;j<=finalvalue;j+=x)

// In the loop, TFT-ADS1262-SD Card operate in sequence


{
dacvalue=((j*5)/65535);
writeValue(j);
dacvalue1=dacvalue*1000;
tft.fillRect(30,130,70,28,ILI9341_BLACK); // Writing on TFT
tft.setCursor(30,130);
tft.println(dacvalue1);

SPI.setDataMode(SPI_MODE1); // SPI Mode 1 selected for ADS1262


delay(20);
digitalWrite(A5, HIGH); // CS of TFT High
delay(20);
digitalWrite(3, LOW); // CS of ADS1262 low, ADS1262 will
operate
delay(30);

ADC_Error:
volatile int data;
if((digitalRead(ADS1262_DRDY_PIN)) == LOW) // monitor Data ready(DRDY
pin)d
{
SPI_RX_Buff_Ptr = PC_ADS1262.ads1262_Read_Data(); // read 6 bytes conversion register
Responsebyte = true ;
Serial.println("ADS1262 Working");
}
else
{
tft.fillRect(166,130,70,16,ILI9341_BLACK);
tft.setCursor(166,130);
tft.setTextColor(ILI9341_RED);
tft.println("Error"); //value of output voltage
tft.setTextColor(ILI9341_WHITE);
goto ADC_Error;
}

if(Responsebyte == true)
{
for(p = 0; p <5; p++)
{
SPI_RX_Buff[SPI_RX_Buff_Count++] = *(SPI_RX_Buff_Ptr + p);
}
Serial.println("ADS1262 Working1");
Responsebyte = false;
}

if(SPI_RX_Buff_Count >= 5)
{
Serial.println("ADS1262 Working2");
ads1262_rx_Data[0]= (unsigned char)SPI_RX_Buff[1]; // read 4 bytes adc count
ads1262_rx_Data[1]= (unsigned char)SPI_RX_Buff[2];
ads1262_rx_Data[2]= (unsigned char)SPI_RX_Buff[3];
ads1262_rx_Data[3]= (unsigned char)SPI_RX_Buff[4];

uads1262Count = (signed long) (((unsigned long)ads1262_rx_Data[0]<<24)|((unsigned


long)ads1262_rx_Data[1]<<16)|(ads1262_rx_Data[2]<<8)|ads1262_rx_Data[3]);
//get the raw 32-bit adc count out by shifting

sads1262Count = (signed long) (uads1262Count); // get signed value


resolution = (double)((double)VREF/pow(2,31)); //resolution= Vref/(2^n-1) , Vref=2.5,
//n=no of bits
volt_V = (resolution)*(float)sads1262Count; // voltage = resolution * adc count
volt_mV = volt_V*1000; // voltage
in mV

tft.fillRect(166,130,70,16,ILI9341_BLACK);
tft.setCursor(166,130);
tft.println(volt_mV); //value of output voltage
Serial.println("volt_V:");
Serial.println(volt_V);
}
SPI_RX_Buff_Count = 0;

digitalWrite(3, HIGH); // CS of
ADS1262 High
delay(20);
digitalWrite(53, LOW); // SD_CS low
delay(20);
SPI.setDataMode(SPI_MODE0); // Again SPI Mode 0 selected
delay(20);
myFile = SD.open(filename, FILE_WRITE);
if(myFile)
{

myFile.print(dacvalue1);
myFile.print("\t");
myFile.println(volt_mV);
myFile.close();
}
else Serial.println("error opening test.txt");
Serial.print(dacvalue1);
Serial.print("\t");
Serial.println(volt_mV);

digitalWrite(53, HIGH); // SD_CS High


delay(20);
digitalWrite(A5, LOW); // TFT_CS low
delay(20); // Again loop rotate and TFT comes in picture
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy