This commit is contained in:
parent
6886cdc54e
commit
6ed8774baf
1 changed files with 37 additions and 5 deletions
|
|
@ -8,12 +8,17 @@
|
||||||
//Strig A out -> 10Hz, sync with trigout
|
//Strig A out -> 10Hz, sync with trigout
|
||||||
//Strig B out -> 10Hz, sync with trigout
|
//Strig B out -> 10Hz, sync with trigout
|
||||||
//inputs - to check detection is working
|
//inputs - to check detection is working
|
||||||
//Flag 0
|
//Flag 0 - digital pin 3
|
||||||
//Flag 1
|
//Flag 1 - digital pin 4
|
||||||
//Flag 2
|
//Flag 2 - digital pin 5
|
||||||
|
|
||||||
//Serial output at 115200
|
//Serial output at 115200
|
||||||
|
|
||||||
|
//STM32 flag output detection
|
||||||
|
bool flag0 = false;
|
||||||
|
bool flag1 = false;
|
||||||
|
bool flag2 = false;
|
||||||
|
|
||||||
|
|
||||||
//variables
|
//variables
|
||||||
int evt0;
|
int evt0;
|
||||||
|
|
@ -86,7 +91,13 @@ digitalWrite(TRIG,0);
|
||||||
digitalWrite(STRIGA,0);
|
digitalWrite(STRIGA,0);
|
||||||
digitalWrite(STRIGB,0);
|
digitalWrite(STRIGB,0);
|
||||||
|
|
||||||
Serial.begin(115200);
|
//attach interrupts
|
||||||
|
attachInterrupt(2, Flag0ISR, RISING);
|
||||||
|
attachInterrupt(3, Flag1ISR, RISING);
|
||||||
|
attachInterrupt(4, Flag2ISR, RISING);
|
||||||
|
|
||||||
|
|
||||||
|
Serial.begin(115200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
@ -280,7 +291,28 @@ analogWrite(DAC0, psusetpoint);
|
||||||
|
|
||||||
Serial.print("The loop took ");
|
Serial.print("The loop took ");
|
||||||
Serial.println(duration);
|
Serial.println(duration);
|
||||||
|
if (flag0==true) Serial.println("Saw Flag 0");
|
||||||
|
if (flag1==true) Serial.println("Saw Flag 1");
|
||||||
|
if (flag2==true) Serial.println("Saw Flag 2");
|
||||||
|
flag0=false;
|
||||||
|
flag1=false;
|
||||||
|
flag2=false;
|
||||||
|
|
||||||
|
|
||||||
stop_time = micros();
|
stop_time = micros();
|
||||||
duration = stop_time - start_time;
|
duration = stop_time - start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Flag0ISR()
|
||||||
|
{
|
||||||
|
flag0=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Flag1ISR()
|
||||||
|
{
|
||||||
|
flag1=true;
|
||||||
|
}
|
||||||
|
void Flag2ISR()
|
||||||
|
{
|
||||||
|
flag2=true;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue