This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//read the temperature of the integrated sensor on the Arduino DUE | |
float trans = 3.3/4096; | |
float offset = 0.8; | |
float factor = 0.00256; | |
int fixtemp = 27; | |
void setup() { | |
Serial.begin(9600); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//plug the Cosmic Pi Analogue PCB in to the arduino directly, make sure you've disconnected the VBias pin and powered the SiPM's | |
//via an alternative power supply | |
//This code reads A1 and A3 in free running mode. If the values are higher than threshold, it outputs the cumulative number of events | |
//and the time since the last event in milliseconds. | |
//the commented out part at the bottom can be used to output the actual data and is what we've been using to make some plots. | |
//this whole thing runs in a loop and is a long way from true realtime. | |
//J. Devine 29/08/16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint16_t bufa; // 4 buffers of 256 readings | |
uint16_t bufb; // 4 buffers of 256 readings | |
bool firstrun = 0; | |
int t; //time since last event | |
float maxcount; | |
float slowfreq; //second frequency measure, | |
//int f; | |
int evt; //event | |
void setup() { | |
Serial.begin(115200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
//this test works when testing with boards 1 and 2 | |
//set the threshold as a 1 time value, max is 3.3V (voltage reference removed from protos) | |
//crashes due to 50Hz noise | |
//input thresholds not checked 100% | |
//minimum input signal duration 40ns for coincidence. | |
//at 40ns incident coincidence the output lasts for 150ns - plenty for the DUE to capture. | |
//Hardware is more reliable than DUE's noise immunity. | |
//Note the MAX5387LAUD+ doesn't support I2C readback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Cosmic Pi Power supply open loop controller | |
//sets a value to the PSU and then increments it every n seconds. | |
//MAX1923 chip, with the following resistor values for feedback: | |
//R6 = 25k | |
//R5 = 200k | |
//R8 = 10k | |
//the old routine has been amended to fix the endian type (now correct) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//flash the red/blue LED on the cosmic Pi analogue board when | |
//it's connected directly to the Arduino DUE | |
void setup() { | |
Serial.begin(115200); | |
Serial.println("Cosmic Pi Status: Alive"); | |
//pinMode(13, OUTPUT); | |
pinMode(A1, OUTPUT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Cosmic Pi Power supply open loop controller | |
//sets a value to the PSU and then increments it every n seconds. | |
//MAX1923 chip, with the following resistor values for feedback: | |
//R6 = 25k | |
//R5 = 200k | |
//R8 = 10k | |
//the old routine has been amended to fix the endian type (now correct) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Code borrowed from http://forum.arduino.cc/index.php?topic=289190.0 | |
Awesome work Mark T!*/ | |
__attribute__ ((section (".ramfunc"))) | |
void _EEFC_ReadUniqueID( unsigned int * pdwUniqueID ) | |
{ | |
unsigned int status ; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#undef HID_ENABLED | |
// Arduino Due ADC->DMA->USB 1MSPS | |
// by stimmer | |
// from http://forum.arduino.cc/index.php?topic=137635.msg1136315#msg1136315 | |
// Input: Analog in A0 | |
// Output: Raw stream of uint16_t in range 0-4095 on Native USB Serial/ACM | |
// on linux, to stop the OS cooking your data: | |
// stty -F /dev/ttyACM0 raw -iexten -echo -echoe -echok -echoctl -echoke -onlcr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#undef HID_ENABLED | |
// Arduino Due ADC->DMA->USB 1MSPS | |
// by stimmer | |
// from http://forum.arduino.cc/index.php?topic=137635.msg1136315#msg1136315 | |
// Input: Analog in A0 | |
// Output: Raw stream of uint16_t in range 0-4095 on Native USB Serial/ACM | |
// on linux, to stop the OS cooking your data: | |
// stty -F /dev/ttyACM0 raw -iexten -echo -echoe -echok -echoctl -echoke -onlcr |