My apologies, I saw DAC and thought you meant an analog signal.
If you look at the Zero product page under Inputs and Output it does state: "Pins that can be used for PWM output are: 3, 4, 5, 6, 8, 9, 10, 11, 12, 13 using analogWrite() function". I have no answer as to why that is other than the fact that those pins are intended strictly for SPI usage.
The analogWrite() function doesn't work with the pins on the SPI header. The pin definitions for these pins in the Zero's "variant.cpp" file state: not on PWM.
MartinL:
The analogWrite() function doesn't work with the pins on the SPI header. The pin definitions for these pins in the Zero's "variant.cpp" file state: not on PWM.
That's not to say you can't use these pins for PWM though. It's possible to get PWM output, but this requires register manipulation.
Can I use PWM by simply changing the variant.cpp? I don't like register manipulating.
Can this be solved in the next Arduino version? These pins can be used as digital I/O pins too, so in the same way, using as PWM should be possible too.
It turns out that the MOSI and SCK pins can be multiplexed to timer 5, which isn't allocated to any other pins. MISO however, uses the same timers as analogWrite() on D6 and D11. The following code changes to the "variant.cpp" file will give you analogWrite() on the MOSI and SCK pins:
MartinL:
It turns out that the MOSI and SCK pins can be multiplexed to timer 5, which isn't allocated to any other pins. MISO however, uses the same timers as analogWrite() on D6 and D11. The following code changes to the "variant.cpp" file will give you analogWrite() on the MOSI and SCK pins:
MartinL:
It turns out that the MOSI and SCK pins can be multiplexed to timer 5, which isn't allocated to any other pins. MISO however, uses the same timers as analogWrite() on D6 and D11. The following code changes to the "variant.cpp" file will give you analogWrite() on the MOSI and SCK pins:
On my Windows machine it's currently located here: C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.4\variants\arduino_zero\variant.cpp.
MartinL:
On my Windows machine it's currently located here: C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.4\variants\arduino_zero\variant.cpp.
I have Windows XP and there is no variant.cpp How it that possible? (I made these files visible in exporer).
avandalen:
No, nothing like this, there is no variant.cpp file.
I have a new laptop now (Windows 10), variant.cpp is at:
C:\Users\Albert\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.6\variants\arduino_zero\variant.cpp