You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ESP32对应Arduino中DDRC寄存器的等效寄存器查询

ESP32 qC 对应Arduino DDRC寄存器的等效寄存器是什么?

我正在做一个声学悬浮的DIY项目,用的是ESP32 qC,现在遇到个问题:不知道它和Arduino里的DDRC寄存器对应的等效寄存器是哪个。下面是我参考的Arduino代码:

//made by milespeterson101
//published on 6/17/2022
//heres the code (: 

byte TP = 0b10101010; // Every other port receives the inverted signal
void setup() {
  DDRC = 0b11111111; // Set all analog ports to be outputs
  
  // Initialize Timer1
  noInterrupts(); // Disable interrupts
  
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  OCR1A = 200; // Set compare register (16MHz / 200 = 80kHz square wave -> 40kHz full wave)
  
  TCCR1B |= (1 << WGM12); // CTC mode
  TCCR1B |= (1 << CS10); // Set prescaler to 1 ==> no prescaling
  TIMSK1 |= (1 << OCIE1A); // Enable compare timer interrupt
  
  interrupts(); // Enable interrupts
}
ISR(TIMER1_COMPA_vect) {
  PORTC = TP; // Send the value of TP to the outputs
  TP = ~TP; // Invert TP for the next run
}
void loop() {
  // Code ends here (: 
}

这个代码来自一个公开的声学悬浮实验项目,我原本以为不用修改就能在ESP32 qC上运行,结果卡在了寄存器对应这一步,希望大家能帮忙指点一下,提前感谢!

内容的提问来源于stack exchange,提问作者Codoban Ioan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 13:01:19