From 76bca5f03923ee6b63b6ddb4ae0a900cbf7a442e Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Sat, 2 Apr 2022 17:19:16 +0200 Subject: [PATCH] add translatoric axis --- avrIOhelper/io-helper.h | 3 ++ main.c | 1 + spule.c | 79 ++++++++++++++++++++++++++++++++++++++++++------- spule.h | 1 + 4 files changed, 73 insertions(+), 11 deletions(-) diff --git a/avrIOhelper/io-helper.h b/avrIOhelper/io-helper.h index 211aa08..693b102 100644 --- a/avrIOhelper/io-helper.h +++ b/avrIOhelper/io-helper.h @@ -93,6 +93,7 @@ void ioHelperEdgeDetector(void); // Schrittmotoren richtung #define MOTOR_TAENZER_DIR BitPH4 +#define MOTOR_TRANS_DIR BitPB6 #define LED_INIT BitPE3 #define LED_ABZUG BitPL6 @@ -147,6 +148,8 @@ void ioHelperEdgeDetector(void); #define BTN_SPULENWECHSEL BitPinK0 #define BTN_INIT BitPinF4 + #define IN_TAENZER_HOME BitPinF0 +#define IN_SPULE_HOME BitPinF1 #endif diff --git a/main.c b/main.c index 93c0ecb..04d400b 100644 --- a/main.c +++ b/main.c @@ -109,6 +109,7 @@ int main() set_Output(LED_FEHLER, ON); + timer1_init(); //translation timer3_init(); //abzug timer4_init(); //taenzer timer5_init(); //spule diff --git a/spule.c b/spule.c index 5de7743..4bbdbcd 100644 --- a/spule.c +++ b/spule.c @@ -1,6 +1,25 @@ #include +#include +#include #include "avrIOhelper/io-helper.h" + +int32_t spule_trans_pos = 0; +uint8_t spule_trans_homed = 0; + +void timer1_init() +{ + TCCR1A |= (1<