نحوه دریافت دیتای بیش از ۱۰ بیت توسط واحد adc-نحوه دریافت کلی دیتای چند ده بیتی و تفکیک هر بیت

مهندس معین عزیز در صورتی که در آردوینو بخوابم دیتای ۱۸ بیتی دریافت کنیم میشه لطفاً ایده بدید برای دریافت دیتای ۱۸ بیتی.حالا مهندس این کد برای دیتای ۱۲ بیتی هست میشه لطفاً درباره تابع shiftin توضیحی بدید و اینکه کمی درباره این کد توضیح بدید ممنون میشم
و اینکه واحد adc برای دریافت مثلاً ۱۸ بیت چطور باید رفتار کند

مهندس کیفیت تصویر رو خود سیستم نمانک به شدت پایین آورده من براتون اینجا ارسال میکنم

const int CLOCK_PIN = 5;
const int DATA_PIN = 6;
const int BIT_COUNT = 25;

void setup() {
//setup our pins
pinMode(DATA_PIN, INPUT);
pinMode(CLOCK_PIN, OUTPUT);

//give some default values
digitalWrite(CLOCK_PIN, HIGH);

Serial.begin(9600);
}

void loop() {
unsigned long reading = readPosition();

Serial.print("Reading: ");
Serial.print(reading, DEC);

delay(1000);
}

//read the current angular position
int readPosition() {
// Read the same position data twice to check for errors
unsigned long sample1 = shiftIn(DATA_PIN, CLOCK_PIN, BIT_COUNT);
unsigned long sample2 = shiftIn(DATA_PIN, CLOCK_PIN, BIT_COUNT);

delayMicroseconds(25); // Clock mus be high for 20 microseconds before a new sample can be taken

if (sample1 != sample2) {
Serial.print(“Samples dont match: sample1=”);
Serial.print(sample1);
Serial.print(“, sample2=”);
Serial.println(sample2);
}

return sample1;
}

//read in a byte of data from the digital input of the board.
unsigned long shiftIn(const int data_pin, const int clock_pin, const int bit_count) {
unsigned long data = 0;

for (int i=0; i<bit_count; i++) {
data <<= 1;
digitalWrite(clock_pin, LOW);
delayMicroseconds(1);
digitalWrite(clock_pin, HIGH);
delayMicroseconds(1);

data |= digitalRead(data_pin);

}

return data;
}