Skip to content
Snippets Groups Projects
Commit f7b1841e authored by Michael DM Dryden's avatar Michael DM Dryden
Browse files

Add delay between WE activation and CE. Fixes #1

parent 256c0629
Branches
Tags
1 merge request!1Develop
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
......@@ -362,17 +362,20 @@ void volt_exp_start(void){
* Connects measurement cell to rest of circuit.
*/
#if BOARD_VER_MAJOR == 1 && BOARD_VER_MINOR == 1
ioport_set_port_level(IOPORT_PORTB, PIN3_bm|PIN4_bm|PIN5_bm, PIN3_bm|PIN4_bm|PIN5_bm);
ioport_set_port_level(IOPORT_PORTB, PIN3_bm|PIN4_bm|PIN5_bm, PIN3_bm|PIN4_bm);
#endif
#if BOARD_VER_MAJOR == 1 && BOARD_VER_MINOR == 2
ioport_set_port_level(IOPORT_PORTB, PIN2_bm|PIN3_bm|PIN4_bm|PIN5_bm, PIN2_bm|PIN4_bm|PIN5_bm);
ioport_set_port_level(IOPORT_PORTB, PIN2_bm|PIN3_bm|PIN4_bm|PIN5_bm, PIN2_bm|PIN4_bm);
#endif
delay_ms(100); // Make sure WE circuit is connected before control voltage applied
ioport_set_pin_level(PIN_POT_CE, 1);
if (g_short == 1)
ioport_set_port_level(IOPORT_PORTB, PIN3_bm, PIN3_bm);
ioport_set_pin_level(PIN_POT_2ELECTRODE, 1);
else
ioport_set_port_level(IOPORT_PORTB, PIN3_bm, 0);
ioport_set_pin_level(PIN_POT_2ELECTRODE, 0);
}
void volt_exp_stop(void){
......@@ -380,13 +383,16 @@ void volt_exp_stop(void){
* Disconnects measurement cell.
*/
#if BOARD_VER_MAJOR == 1 && BOARD_VER_MINOR == 1
ioport_set_port_level(IOPORT_PORTB, PIN3_bm|PIN4_bm|PIN5_bm, 0);
ioport_set_port_level(IOPORT_PORTB, PIN3_bm|PIN5_bm, 0);
#endif
#if BOARD_VER_MAJOR == 1 && BOARD_VER_MINOR == 2
ioport_set_port_level(IOPORT_PORTB, PIN2_bm|PIN3_bm|PIN4_bm|PIN5_bm, 0);
ioport_set_port_level(IOPORT_PORTB, PIN2_bm|PIN3_bm|PIN5_bm, 0);
#endif
ioport_set_port_level(IOPORT_PORTB, PIN3_bm, PIN3_bm);
delay_ms(100); // Make sure WE is last to disconnect
ioport_set_pin_level(PIN_POT_WE, 0);
ioport_set_pin_level(PIN_POT_2ELECTRODE, 1);
}
#if BOARD_VER_MAJOR == 1 && BOARD_VER_MINOR >= 2
......
......@@ -45,6 +45,11 @@
#define POT_GAIN_100M 7
#endif
#define PIN_POT_CE IOPORT_CREATE_PIN(PORTB,5)
#define PIN_POT_2ELECTRODE IOPORT_CREATE_PIN(PORTB,3)
#define PIN_POT_CTRL IOPORT_CREATE_PIN(PORTB,2)
#define PIN_POT_WE IOPORT_CREATE_PIN(PORTB,4)
#define POT_OCP 0
#define POT_POTENT 1
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment