![]() There are many things that programmers do to make their code understandable. SR converter only runs when count2 = 2, which happens after 2 triggers, and then is set back to 0 by SR converter, so every time 2 triggers occur, next time I poll the Arduino, the arrays should update. In SRConverter(), SRB and backGroundSignal are the exact same things as SRA, only filling up the other 2 arrays, so I left that out. SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE1)) //2MHz speed, most significant bit first, data capture on rising clock ![]() Serial.begin(115200) //Begin Serial Monitor 115200 baud rate put your setup code here, to run once:ĪttachInterrupt(digitalPinToInterrupt(3), myISR, RISING) //interrupt to store data from ADC in serial buffer after trigger event Uint16_t p1ch, p2ch, bch,vdiffp1,vdiffp2 Unsigned long timesince, timemid = 0 //timing times interrupt, timestamp gives time between 2 interrupts, timesince measures whether a false trigger occuredĬhar LF = 10 //tells arduino xojo is done with command Volatile unsigned long timing = 0, timestamp = 0 Int i = 0, j = 0, eventnum = 0, evnum //loop variable Anyway, below is my code, I call every variable in the ISR that updates a volatile variable: volatile int countevent = 0, count2 = 0,count3 = 0 // countevent lets shift register know an event (2 crossings) has happened so save the data, timer counts how long since last interrupt I believe the mechanism by which I refill the arrays is not working. I know this because the timestamp of the two triggers and the amount of triggers that has occurred are also sent serially, and they update every time. My problem is the arrays are not updating every time 2 triggers occur. I then communicate this information to a Raspberry Pi over Serial. after 2 laser triggers occur in a row, 3 arrays should update with ADC information. Hi, I have a project which uses an ISR on a laser trigger.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |