0x08 |
Base Register Address |
This module provides support for Pulse Width Modulation (PWM) output.
Nomenclature
The seesaw PWM Function Registers are defined using a generic nomenclature as follows:
- PWM Number - Specifies a specific PWM output (pin).
- PWM Value - Specifies the PWM duty cycle.
- PWM Frequency - Specifies the PWM frequency.
See the Port Specific Details section below for further information.
Register Address |
Register Name |
Register Size |
Access |
0x01 |
PWM_VAL |
3 bytes |
W |
0x02 |
PWM_FREQ |
3 bytes |
W |
Byte 0 |
Byte 1 |
Byte 2 |
PWM Number |
PWM Value MSB |
PWM Value LSB |
Sets the PWM Value for a specified PWM Number. The first byte written is the PWM Number. The next two bytes are the 16 bit PWM Value, most significant byte (MSB) followed by least significant byte (LSB).
Byte 0 |
Byte 1 |
Byte 2 |
PWM Number |
PWM Frequency MSB |
PWM Frequency LSB |
Sets the PWM Frequency for a specified PWM Number. The first byte written is the PWM Number. The next two bytes are the 16 bit PWM Frequency, most significant byte (MSB) followed by least significant byte (LSB).
SAMD
PWM outputs are available on pins PA04, PA05, PA06, and PA07. The PWM Number for each is shown in the table below.
PWM Number |
Output Pin |
0 |
PA04 |
1 |
PA05 |
2 |
PA06 |
3 |
PA07 |
The full 16 bit PWM Value is used. This value should be an unsigned integer ranging from 0 for full off to 65535 for full on.
The PWM Frequency is a 16 bit unsigned integer value which specifies the frequency in hertz (Hz).
ATtiny
The PWM Number is the Arduino GPIO pin number.
Currently, only the MSB of the 16 bit PWM Value is used. This is due to the 8 bit limit of analogWrite() used internally. However, a full 16 bit value should be sent from 0 for full off to 65535 for full on.
The PWM Frequency is a 16 bit unsigned integer value which specifies the frequency in hertz (Hz). (NOTE: uses tone() internally)
Text editor powered by tinymce.