User Tools

Site Tools


en-us_commands:analog_input

Differences

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

Link to this comparison view

en-us_commands:analog_input [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:analog_input [2026/09/12 22:54] (current) – 바깥 편집 127.0.0.1
Line 1: Line 1:
-====== Analog Input and Range Conversion ======+====== Analog Input Built-in Commands ======
  
-^ Command ^ Return Value / Purpose ^ +Check the voltagecurrent or temperature input mode configured for your product and channel firstReading a raw value and scaling a value serve different purposes.
-| ''Iscale(xinMin, inMax, outMin, outMax)'' | Converts the integer input range to the desired integer range+
-| ''Iscalef(x, inMin, inMax, outMin, outMax)'' | Converts to floating-point range while retaining fractional values. | +
-| ''analogReadInit(sps)'' | Sets the sampling rate of the analog input module. | +
-| ''analogRead(ch)'' | Reads the raw analog value. | +
-| ''analogReadAvg(ch, samples)'', ''analogReadAvgf(...)'' | Returns integer or floating-point averages. | +
-| ''IanalogFilter(id, raw, samples)'' | Applies moving average to the supplied value. +
-| ''IanalogRead(ch, min, max)'', ''IanalogReadf(...)'' | Converts the measurement to the user range. | +
-| ''analogRead2(ch)'', ''analogRead2Avg(ch, samples)'' | Reads the corrected 4~20mA input. | +
-| ''IanalogRead2(ch, min, max)'', ''IanalogRead2f(...)'' | Converts the 4~20mA value to the user range. |+
  
-<code cpp> +^ Goal ^ Commands ^ 
-void setup() { analogReadInit(IANALOG_SPS_64); } +| Read a raw analog value | [[:en-us_commands:reference:analogread|analogRead()]] | 
-void loop() { +| Average multiple samples | [[:en-us_commands:reference:analogreadavg|analogReadAvg()]] · [[:en-us_commands:reference:analogreadavgf|analogReadAvgf()]] | 
-  float value = IanalogReadf(0, 0.0, 100.0); +| Scale an input range | [[:en-us_commands:reference:ianalogread|IanalogRead()]] · [[:en-us_commands:reference:ianalogreadf|IanalogReadf()]] | 
-} +| Read or scale a 4–20 mA input | [[:en-us_commands:reference:analogread2|analogRead2()]] · [[:en-us_commands:reference:ianalogread2|IanalogRead2()]] · [[:en-us_commands:reference:ianalogread2f|IanalogRead2f()]] | 
-</code>+| Read NTC or PT100 temperature | [[:en-us_commands:reference:ntcread|ntcRead()]] · [[:en-us_commands:reference:ntcreadf|ntcReadf()]] · [[:en-us_commands:reference:pt100read|pt100Read()]] |
  
-===== Command Prototypes =====+On MPAINO, each X analog input channel's DIP setting determines its input mode. Check the [[:en-us_products:mpaino_x|X module details]] for settings and wiring.
  
-^ Return Type ^ Command Prototype ^ +[[:en-us_commands:builtin|← Built-in command list]]
-| ''int32_t'' | ''Iscale(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max)''+
-| ''float'' | ''Iscalef(float x, float in_min, float in_max, float out_min, float out_max)''+
-| ''void'' | ''analogReadInit(uint16_t sps)''+
-| ''int'' | ''analogRead(uint8_t pin)''+
-| ''int32_t'' | ''analogReadAvg(uint8_t ch, uint8_t samples)''+
-| ''float'' | ''analogReadAvgf(uint8_t ch, uint8_t samples)''+
-| ''int32_t'' | ''IanalogFilter(uint8_t id, int32_t raw_value, uint8_t samples)''+
-| ''int32_t'' | ''IanalogRead(uint8_t ch, int32_t min, int32_t max)''+
-| ''float'' | ''IanalogReadf(uint8_t ch, float min, float max)''+
-| ''uint16_t'' | ''analogRead2(uint8_t ch)''+
-| ''int32_t'' | ''analogRead2Avg(uint8_t ch, uint8_t samples)''+
-| ''float'' | ''analogRead2Avgf(uint8_t ch, uint8_t samples)''+
-| ''int32_t'' | ''IanalogRead2(uint8_t ch, int32_t min, int32_t max)''+
-| ''float'' | ''IanalogRead2f(uint8_t ch, float min, float max)''+
- +
-First check the channel, input module voltage/current selection and DIP switch settings. Increasing the averaging count stabilizes values but slows response. +
- +
-[[:en-us_commands:builtin|← Built-in Command List]]+
  
en-us_commands/analog_input.1788785564.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki