Hi, on line 98 it says FALLING. I have a tester with the code here to check the time from output trigger on pin 9 to the signal back on pin 3. I think I may be ahead of myself here but it is off by 600 uS. When delay is 0 it reports 600. Probably this is fine tuning and must wait for DAC to be working. Also I need confirmation this code would be accurate?
Here is shot of the charge pulses and the pin 6 - 12 of DAC.
Thanks, Tom
// variable delay output for testing main board Us Delay line
// with display
int pot1 = A3; // select the input pin for the pot (changed for this version because of lcd)
int delayValue = 0; // variable to store the value coming from the sensor
unsigned long analogReadInterval = 1000;//read pot and map
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// set the LCD address to 0x3f for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
void setup() {
Serial.begin(9600);
lcd.begin(20, 4); // initialize the lcd for 20 chars 4 lines, turn on backlight
lcd.setCursor(2, 0); // lcd display setup of unchanging headings
lcd.print("Us Delay:"); // print fixed characters
attachInterrupt(digitalPinToInterrupt(3),pulse, FALLING); //added this line to have any pulse out**********
pinMode(7,OUTPUT);
}
void loop()
{
delayValue = analogRead(pot1);
delayValue = map(delayValue, 0, 1023, 0, 5100);
lcd.setCursor(12, 0);
lcd.print(" "); //print blank spaces to clear old data
lcd.setCursor(12, 0);
lcd.print(delayValue);
delay (500);
}
void pulse()
{
delayMicroseconds(delayValue);
digitalWrite(7,HIGH);
delayMicroseconds(200); // modify the pulse length to see what is sensed by main board*******
digitalWrite(7,LOW);
}