1 MHz digital signal

Hey all!

I am using an Arduino Due, and I was wondering if I could produce a digital signal (50% duty cycle) with it.

I was looking to use a low level method, but I'm not sure what all the options are.

Also, I couldn't find the register list in the datasheet for the chip, so if you know where that is please let me know what page it's on.

Thanks!

Do you have the “Overview” document or the actual datasheet.

In the DS look in the “User interface” section of each peripheral.

As for the square wave, do you want the program to do anything else at the same time? If not then a simple loop should work, if so then maybe a hardware timer.

maybe an example might actually be helpful and since that latter method is required in 99% of real world applications, 1mhz on tarduino pin 9 (avr pb1):

void setup() {
  DDRB=2;
  TCCR1B=9;
  TCCR1A=0x50;
  OCR1AL=7;
}

john1993:
maybe an example might actually be helpful and since that latter method is required in 99% of real world applications

Alas the OP was talking about the DUE so AVR example is no good.

@OP Try google searching "ARDUINO DUE PWM FREQUENCY" as I seem to remember someone doing a library to change this.

ooops… i need to read posts more carefully. im sure the same way works on sam but with different registers and numbers. unfortunately im not up to speed on arm but some time in the spec sheet will probably work.

or like graynomad says do it bit bang. then the blink program will do it with pin number and while loop. idk.