This commit is contained in:
James Devine 2016-12-31 02:09:02 +01:00 committed by GitHub
parent 8f9157f424
commit bc91ee702e

View file

@ -1,6 +1,9 @@
//Cosmic Pi histogram program //Cosmic Pi histogram program
//this compiles histograms from the ADC for different HV Bias levels //this compiles histograms from the ADC for different HV Bias levels
//it is used to profile the detection of muons and noise //it is used to profile the detection of muons and noise
//updated to give horizontal row output rather than columns, easier to process
//only prints values from 500 to 1500
//the first set of samples seem to be noisy for some reason (?)
unsigned long start_time; unsigned long start_time;
unsigned long stop_time; unsigned long stop_time;
@ -57,10 +60,28 @@ void setup() {
void loop() { void loop() {
//reads in on channel 0 //reads in on channel 0
Serial.print("index");
Serial.print("; Ch A & B; ");
for (int i = 500; i < 1500; i++) {
//Serial.print(i);
Serial.print(i);
Serial.print("; ");
//Serial.println(histogramb[i]);
//Serial.print("; ");
}
Serial.println();
for (hvset = 0x70; hvset > 0x50; hvset--) { for (hvset = 0x70; hvset > 0x50; hvset--) {
returnValue = bitBang(hvset); // Transmit data returnValue = bitBang(hvset); // Transmit data
for (int i = 0; i < 4096; i++) {
histograma[i] = 0;
histogramb[i] = 0;
}
for (int j = 0; j < 100000; j++) { for (int j = 0; j < 100000; j++) {
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
@ -80,20 +101,33 @@ void loop() {
histogramb[int(values[i + 1000])]++; histogramb[int(values[i + 1000])]++;
} }
} }
for (int i = 0; i < 4096; i++) {
Serial.print(hvset); Serial.print(hvset);
Serial.print("; "); Serial.print("; Ch A; ");
Serial.print(i);
Serial.print("; "); for (int i = 500; i < 1500; i++) {
//Serial.print(i);
Serial.print(histograma[i]); Serial.print(histograma[i]);
Serial.print("; "); Serial.print("; ");
Serial.println(histogramb[i]); //Serial.println(histogramb[i]);
//Serial.print("; ");
} }
for (int i = 0; i < 4096; i++) { Serial.println();
histograma[i] = 0; Serial.print(hvset);
histogramb[i] = 0; Serial.print("; Ch B; ");
for (int i = 500; i < 1500; i++) {
//Serial.print(i);
//Serial.print(histograma[i]);
//Serial.print("; ");
Serial.print(histogramb[i]);
Serial.print("; ");
} }
Serial.println();
//Serial.println(cyclecounter); //Serial.println(cyclecounter);
// delay(2000); // delay(2000);