en-us_commands:analog_output_pwm
This is an old revision of the document!
Analog Output and PWM
| Command | Description |
|---|---|
analogWriteInit(ch, top, prescaler) | Sets the resolution and prescaler of the output timer. |
analogWriteFreq(ch, hz), analogWriteMax(ch) | Sets the frequency or checks the maximum value. |
IanalogWriteInit(ch, max, min, mode) | Initializes the MPAINO analog output range. |
IanalogWrite(ch, min, max, value), IanalogWritef(…) | Converts the user value to the output range. |
analogWrite2(ch, value), IanalogWrite2(…) | Converts the 4~20mA output. |
PWM(pin, value, bit16) | Outputs 8-bit or 16-bit PWM. |
FDPWM(pin, hz, duty) | Sets the frequency and duty cycle. |
NPWM_BEGIN(pin, hz, duty, count), NPWM(pin) | Outputs the specified number of pulses. |
PWMOFF(pin, off), PWM_RESET() | Stops an individual PWM output or all PWM outputs. |
void setup() { IanalogWriteInit(0, 65535, 0, false); } void loop() { IanalogWritef(0, 0.0, 100.0, 50.0); }
Command Prototypes
| Return Type | Command Prototype |
|---|---|
void | analogWriteInit(uint8_t ch, uint16_t top = 65535, uint16_t prescaler = 1) |
uint16_t | analogWriteFreq(uint8_t ch, uint32_t frequencyHz) |
uint16_t | analogWriteMax(uint8_t ch) |
void | IanalogWriteInit(uint8_t ch, uint32_t maxValue = 65535UL, uint32_t minValue = 0, bool mode = false) |
void | IanalogWrite(uint8_t ch, int32_t min, int32_t max, int32_t value) |
void | IanalogWritef(uint8_t ch, float min, float max, float value) |
void | analogWrite2(uint8_t ch, uint16_t value) |
void | IanalogWrite2(uint8_t ch, int32_t min, int32_t max, int32_t value) |
void | IanalogWrite2f(uint8_t ch, float min, float max, float value) |
void | PWM(uint8_t pin, uint16_t val, bool onDutybit16 = false) |
void | FDPWM(uint8_t pin, int32_t intHz, float Duty) |
void | PWM_RESET() |
void | NPWM_BEGIN(uint8_t pin, uint32_t intHz, float Duty, uint32_t N) |
void | NPWM(uint8_t pin) |
void | PWMOFF(uint8_t pin, bool POff) |
First check the output channel's voltage/current mode and load wiring. PWM, high-speed pulses, analogWrite() and callback timers may share hardware timers.
en-us_commands/analog_output_pwm.1788785564.txt.gz · Last modified: by 127.0.0.1
