Description
hw_dac_output_id = hw_dac_output_add(name, initial_value) (from AM/AP 3.5)
hw_dac_output_id = hw_dac_output_add(hw_id, initial_value)
hw_dac_output_add is used to add a DAC hardware output to your instrument.
Named
Available from AM/AP 3.5.
Give your hardware objects a name (.e.g. 'Power button' or 'Strobe LED').
Air Manager will present the user with a view where the assignment of pins can be done.
Arguments
hw_dac_output_id = hw_dac_output_add(name, initial_value)
# |
Argument |
Type |
Description
|
1 |
name |
String |
A functional name to define the DAC output.
|
2 |
initial_value |
Number |
The initial state of the DAC output. Ranges from 0.0 (GND) to 1.0 (VCC)
|
Return value
Argument |
Type |
Description
|
hw_output_id |
ID |
This value can be used for further reference. Functions such as hw_dac_output_set can use this hw_dac_output_id. Its good practice to store this hw_dac_output_id in your logic code.
|
Example
-- Create a new DAC output, and drive the output right between GND and VCC
outp_id = hw_dac_output_add("My analog output", 0.5)
-- Nah, rather have the output on a higher voltage
hw_dac_output_set(outp_id, 0.9)
Hardware Id's
Hardware Id's are not preferred, try to use named hardware instead.
Define the used pin(s) right away.
This is not preferred, since changing of pin assignment can only be done by changing the instrument/panel lua script.
Arguments
hw_dac_output_id = hw_dac_output_add(hw_id, initial_value)
# |
Argument |
Type |
Description
|
1 |
hw_id |
String |
The is the reference to the DAC output. You can choose to bind to an existing Hardware ID (Hardware_id_list).
|
2 |
initial_value |
Number |
The initial state of the DAC output. Ranges from 0.0 (GND) to 1.0 (VCC)
|
Return value
Argument |
Type |
Description
|
hw_output_id |
ID |
This value can be used for further reference. Functions such as hw_dac_output_set can use this hw_dac_output_id. Its good practice to store this hw_dac_output_id in your logic code.
|
Example
-- Bind to HW port A, pin 3, and drive the output right between GND and VCC
outp_id = hw_dac_output_add("HW_PORT_A3", 0.5)
-- Nah, rather have the output on a higher voltage
hw_dac_output_set(outp_id, 0.9)