ESP32 Frequenzgenerator mit Rampe
Rampe 700kHz zu 1 Hz
Haltebereich 5 Sekunden
//*FASTEST IMPULSE TEST ON ESP32
//====< VARIABLES >==== int OUT_PIN = 4; long nCycles_Start = 1; long nCycles_Stop = 10000000; long nCycles_Step = 1; long nCycles_Pulse = 1; long iCycles=0;
unsigned long msStart = 0; unsigned long msHold = 5000; //====</ VARIABLES >====
//BitMask //0b11111=GPIO 0, 1, 2, 3, 4, //0b10000=GPIO4
//=============< SETUP >============
void setup(){ //--------< setup() >--------
//< GPIO > //pinMode(OUT_PIN, OUTPUT); //digitalWrite(OUT_PIN, LOW); // PULS_OFF DEFAULT //</ GPIO >
//ESP32 config io gpio_config_t io_conf;
//ESP32 config io to output io_conf.mode = GPIO_MODE_OUTPUT;
//Bitmask GPIO4 as Output io_conf.pin_bit_mask = 0b10000;
//Set BitMask gpio_config(&io_conf);
Serial.begin(115200); Serial.println("\n FASTEST IMPULSE TEST ON ESP32");
msStart=millis();
//--------</ setup() >-------- } //=============</ SETUP >============
//=============< Main_Loop >============
void loop(){ //--------< Main Loop() >--------
//*with write on/off //*ImpulsWidth=50-60ns jitter 1/10 //*PeriodeWidth=140ns (136-156) jitter 1/10
if((millis()-msStart) > msHold){ //< increase > if( nCycles_Pulse > nCycles_Stop) { nCycles_Pulse = nCycles_Start ;} //reset else { nCycles_Pulse = nCycles_Pulse+1; } //</ increase >
msStart=millis(); }
///--< Impulse >-- for (iCycles=nCycles_Start; iCycles <= nCycles_Pulse; iCycles=iCycles + nCycles_Step){ //PIN GPIO4->ON GPIO.out_w1ts = 0b10000; }
for (iCycles=nCycles_Start; iCycles <= nCycles_Pulse; iCycles=iCycles + nCycles_Step){ //PIN GPIO4->OFF GPIO.out_w1tc = 0b10000; } ///--</ Impulse >--
//--------</ Main Loop() >-------- } //=============</ Main_Loop >============
|