ATtiny 414 Pulsing IR at 38Khz

Looking to use a MCU IC ATTiny414 to modulate an IR led signal at 38Khz, pulsed at 600us on and 900us off.

Is this the general Idea?

  1. Init the chip/timer of to 38Khz
  2. Set the output pin High at that frequency
  3. delay for 600us
  4. Set the pin Low
  5. delay for 900us

Can’t find any exact matches as suggestions to code this. So I’m trying to piece together other solutions from here and others. Need help adapting the set up (that code is for an Arduino. I have to use a ATtiny412.

556-ATTINY412-SSNR - 8-bit Microcontrollers - MCU 105C, 5.5V, Green, 20MHz, SOIC8, T&R
Mouser Datasheet: mouser.com/datasheet/2/268/40001911A-1220759.pdf

IF this is the right approach.

const byte IRLED = 2; // Timer 2 "A" output: OC2A

void setup() {
pinMode (IRLED, OUTPUT);

// set up Timer 2 for 38khz - NEED HELP to adapt this Arduino to ATtiny414

TCCR2A = _BV (COM2A0) | _BV(WGM21); // CTC, toggle OC2A on Compare Match
TCCR2B = _BV (CS20); // No prescaler
OCR2A = 209; // compare A register value (210 * clock speed)
// = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095
} // end of setup

void loop() {
//the IR receiver is expecting “on” 600us and “off” 900us
digitalWrite(IRLED, HIGH); //turn on the IR LED
delayMicroseconds(900);
digitalWrite(IRLED, LOW); //turn off the IR LED
delayMicroseconds(600);

} //end of loop

No arduino core for that chip. All the peripherals are totally different from traditional AVRs, youll need to use atmel studio and really stufy the datasheet. Much more complicated, and not relevant for this forum becayse not supported on arduino ide.

Maybe avrfreaks forum?

Darn, I had bought a large number of these...but, I guess I should try another MCU IC, ATtiny or otherwise...

I'm looking to code a Microchip IC to control and pulse a whole bunch of these IR LEDs for a large interactive, art installation. The similarly large number of IR receivers need the emitters at 38 Khz, on 600us and off 900us

Dr Azzy...Since my first attempt is completely wrong....any suggestions on a cheap MCU IC and the code to get it pulsing? I am trying to stay working within Arduino

If you're looking in the ATTiny size range, any of the ones listed as supported by my ATTinyCore (see sig) would be a fine choice - they all have traditional AVR style peripherals and are supported in the Arduino IDE via my core.

The 841 is an excellent chip, with 2 of those nice 16-bit timers (like timer1 on the '328p), dual hardware serial, and so on.... but I don't have a good enough idea of what you're working with to make a definitive recommendation.

Economics wise, it might be worth considering just throwing el-cheapo pro mini clones at it - they're insanely cheap for what you get.