Until now, we are measuring the tension of the battery by moving the motor. Now, we made a new layout and we should switch on a resistor at PIN 9 before we are measuring the battery.
We are using an Atmel Chip and Atmel Studio.
Your task: Change the code to get it work. You will get the whole source code but no real sample. We will do the test here.
Part of the code right now:
static void motor_on (void)
[login to view URL] = MOTOR_PIN_bm;
/*! \brief PWM on/off time (milliseconds) */
#define MOTOR_PWM_MS 20
/*! \brief Initial on-time (milliseconds) */
#define MOTOR_START_HALF_MS 40
/*! \brief Timeout to wait for lock-pin to change from output to input (in microseconds) */
#define LOCK_PIN_CHANGE_TIMEOUT 10
/*! ADC to measure voltage on VCC */
#define MY_ADC (&ADCA)
static volatile bool_t adc_running = false;
static volatile bool_t adc_vcc_low = false;
/*! \brief This variable is set, if the internal pull up on SW_LOCK_CLOSED is activated */
static volatile u8 lock_pin_enabled = 0;
/* DEBUG */
static volatile u16 adc_vcc_avg = 0;
static volatile u8 adc_vcc_avg_counter = 0;
Hello I am an electrical engineer and have worked on many projects based on ATMEL. I developed automated welding machine, electrolyzer, CVCF and so on. Basically I have no problem with ATMEL. Thank you