User Tools

Site Tools


en-us_commands:analog_output_pwm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en-us_commands:analog_output_pwm [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:analog_output_pwm [2026/09/12 23:27] (current) – 바깥 편집 127.0.0.1
Line 1: Line 1:
-====== Analog Output and PWM ======+====== Analog output and PWM ======
  
-^ Command ^ Description ^ +Select output initialization, value conversion, or PWM functions for the product's supported channels.
-| ''analogWriteInit(ch, top, prescaler)'' | Sets the resolution and prescaler of the output timer. | +
-| ''analogWriteFreq(chhz)'', ''analogWriteMax(ch)'' | Sets the frequency or checks the maximum value. | +
-| ''IanalogWriteInit(chmax, 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|+
  
-<code cpp> +===== Analog Output =====
-void setup() { +
-  IanalogWriteInit(0, 65535, 0, false); +
-+
-void loop() { +
-  IanalogWritef(0, 0.0, 100.0, 50.0); +
-+
-</code>+
  
-===== Command Prototypes =====+  * [[:en-us_commands:reference:analogwriteinit|analogWriteInit()]] — Sets the resolution and prescaler of the output timer. 
 +  * [[:en-us_commands:reference:analogwritefreq|analogWriteFreq()]] — Sets the PWM frequency of the specified output channel. 
 +  * [[:en-us_commands:reference:analogwritemax|analogWriteMax()]] — Returns the maximum value available for the specified output channel. 
 +  * [[:en-us_commands:reference:ianalogwriteinit|IanalogWriteInit()]] — Sets the maximum, minimum and mode of the MPAINO analog output. 
 +  * [[:en-us_commands:reference:ianalogwrite|IanalogWrite()]] — Converts a user integer value to the analog output range and outputs it. 
 +  * [[:en-us_commands:reference:ianalogwritef|IanalogWritef()]] — Converts a user floating-point value to the analog output range and outputs it.
  
-^ Return Type ^ Command Prototype ^ +===== 4~20mA Output =====
-| ''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 wiringPWM, high-speed pulses, ''analogWrite()'' and callback timers may share hardware timers.+  * [[:en-us_commands:reference:analogwrite2|analogWrite2()]] — Outputs a raw value for 4~20mA conversion on the specified channel. 
 +  * [[:en-us_commands:reference:ianalogwrite2|IanalogWrite2()]] — Converts a user integer value to the 4~20mA output range. 
 +  * [[:en-us_commands:reference:ianalogwrite2f|IanalogWrite2f()]] — Converts a user floating-point value to the 4~20mA output range.
  
-[[:en-us_commands:builtin|← Built-in Command List]]+===== PWM Output ===== 
 + 
 +  * [[:en-us_commands:reference:pwm|PWM()]] — Outputs 8-bit or 16-bit PWM on the specified pin. 
 +  * [[:en-us_commands:reference:fdpwm|FDPWM()]] — Outputs PWM at the specified frequency and duty cycle. 
 +  * [[:en-us_commands:reference:pwmoff|PWMOFF()]] — Stops or re-enables PWM output on the specified pin. 
 +  * [[:en-us_commands:reference:pwm_reset|PWM_RESET()]] — Resets all PWM states managed by the core. 
 + 
 +===== Pulse Output ===== 
 + 
 +  * [[:en-us_commands:reference:npwm_begin|NPWM_BEGIN()]] — Prepares pulse output with the specified frequency, duty cycle and pulse count. 
 +  * [[:en-us_commands:reference:npwm|NPWM()]] — Outputs the prepared number of pulses. 
 + 
 +[[:en-us_commands:builtin|← Built-in function list]]
  
en-us_commands/analog_output_pwm.1788785564.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki