Pulse width maximum 3µs

Hello,

I want to build a SENT frame, for this a pulse width of max. 3µs is needed. Unfortunately, I do not come here under on the required 3µs. I hope you can help me.

int i = 0;
byte bin[88] = {0b0001 << 0b0100, 0b0001 << 0b0100, 0b0001 << 0b0100, 0b0001 << 0b0100, 0b0001 << 0b0100, 0b0001 << 0b0100, 0b0001 << 0b0100, 0b0000, 0b0001 << 0b0100, 0b0000, 0b0001 << 0b0100, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0001, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0001 << 0b0100, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000, 0b0000}; // dauer eines Status 4µs





ISR(TIMER1_COMPA_vect)// alle 63µs
{
  //PORTD= bin[i/*TCNT0*/];  // UNO
  PORTH = bin[/*i/*/TCNT0]; // MEGA
  //i++; 
  /*if (i >= 87)
  {
    i = 0;
  }*/
}

ISR(TIMER0_COMPA_vect) // alle 4ms
{
  TCNT0 = 0;
  //i=0;
}


void setup()
{
  noInterrupts();//stop interrupts
#ifdef SLOW_CLOCK
  noInterrupts();
  CLKPR = _BV(CLKPCE);  // enable change of the clock prescaler
  //CLKPR = _BV(CLKPS0);  // divide frequency by 2
  interrupts();
#endif

  //set Timer1 333,5kHz
  TCCR1A = _BV(COM1A0) ;            //toggle OC1A on compare match
  OCR1A = 5;   //top value for counter, 7 = 1MHz 23=333,5kHz
  TCCR1B = _BV(WGM12) | _BV(CS11); //CTC mode, prescaler clock/1
  TCNT1 = 0;
  TIMSK1 = bit(OCIE1A);            //interrupt on Compare A Match

  //TIMER0
  TCCR0A = (1 << COM2A0);//_BV(COM0A0) + (1 << WGM01) + (1 << WGM00); //; (1 << COM2A0);
  TCCR0B = (1 << CS01);//_BV(WGM02) + _BV(CS01); //(1 << CS01);
  OCR0A = 80;
  OCR0B = 40;
  TCNT0 = 0;
  TIMSK0 = bit(OCIE0A);

  DDRD = 0b11111111;
  DDRB = 0b11111111;
  DDRH = 0b11111111;
  PORTD = 0b00000000;
  DDRD |= (1 << PD3);



  interrupts();
}

void loop()
{

}

What is a "SENT frame" ?

...R

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.