Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

ESP32 Frequenzgenerator mit Rampe 700 Khz zu 1 Hz

09.12.2022 (👁1650)
ESP32 Frequenzgenerator mit Rampe

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 >============