Hello, I am attempting to initialize an analog output on an ADI port for a custom electronics project (I am in VEXU). However, I have had no luck getting this to work. I have tried all of the following things in PROS:
Attempt 1:
pros::ADIAnalogOut output('A');
while(true) {
output.set_value(4095);
pros::delay(1000);
output.set_value(2047);
pros::delay(1000);
output.set_value(0);
pros::delay(1000);
}
Attempt 2:
pros::c::adi_port_set_config('A', E_ADI_ANALOG_OUT);
while(true) {
pros::c::adi_port_set_value('A', 4095);
pros::delay(1000);
pros::c::adi_port_set_value('A', 2047);
pros::delay(1000);
pros::c::adi_port_set_value('A', 0);
pros::delay(1000);
}
Attempt 3 is the same as attempt 2, except the port was configured as E_ADI_LEGACY_PWM
instead.
I measured the output of the ADI port using my DMM. All three code attempts resulted in the same behavior. Here are the results of DC mode and True RMS mode.
On DC mode:
All set_values
from 1-4095 result in 0.266V, and a set_value
of 0 results in 0.124V
On True RMS mode:
All set_values
from 1-4095 result in 0.66V, and a set_value
of 0 results in 0.124V
I do not believe it is the port or brain, as I experienced this behavior on all ports of 2 brains, and verified that a digital output worked fine on all ports. Not sure what is going on here. I’ve been staring at the PROS kernel source code for the past day and everything seems correct there, so I’m not sure what the problem could be. Any help would be much appreciated.