7 Commits

8 changed files with 83 additions and 28 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "hottislib"]
path = hottislib
url = git@bitbucket.org:wollud1969/hottislib.git
url = git@gitlab.com:wolutator/hottislib.git

BIN
doc/2016-10-15_120Grad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
doc/2016-10-15_works.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

39
src/hmi.c Normal file
View File

@ -0,0 +1,39 @@
/*
* hmi.c
*
* Created on: Oct 15, 2016
* Author: wn
*/
#include <stdint.h>
#include "hmi.h"
#include "inverterCtrl.h"
const uint32_t HMI_CYCLE = 50;
const uint32_t HMI_START_DELAY = 30;
void hmiInit() {
}
void hmiExec(void *handle) {
static uint8_t state = 0;
switch (state) {
case 0:
inverterCtrlSetFrequency(50);
state = 1;
break;
case 1:
break;
default:
state = 0;
break;
}
}

19
src/hmi.h Normal file
View File

@ -0,0 +1,19 @@
/*
* hmi.h
*
* Created on: Oct 15, 2016
* Author: wn
*/
#ifndef HMI_H_
#define HMI_H_
extern const uint32_t HMI_CYCLE;
extern const uint32_t HMI_START_DELAY;
void hmiInit();
void hmiExec(void *handle);
#endif /* HMI_H_ */

View File

@ -21,12 +21,11 @@
volatile uint8_t pulseWidthIdx = 0;
volatile bool direction = true;
volatile uint32_t tick;
const uint32_t INVERTERCTRL_START_STEP1_DELAY = 1;
const uint32_t INVERTERCTRL_START_STEP2_DELAY = 10;
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
tick++;
if (direction) {
if (pulseWidthIdx == 0) {
P2OUT |= BIT3;
@ -72,30 +71,19 @@ void inverterCtrlInit() {
// smclk out
P1DIR |= BIT4;
P1SEL |= BIT4;
tick = 0;
TA1CTL = MC_0;
TA1CCTL0 = CCIE | OUTMOD_4;
TA1CCR0 = 0;
P2OUT &= ~BIT2;
volatile uint32_t w;
for (w = 0; w < 100000; w++);
// remove reset from PWNs
P2OUT |= BIT2;
for (w = 0; w < 100000; w++);
TA1CTL = MC_1 | ID_0 | TASSEL_2 | TACLR;
}
void inverterCtrlStartStep1(void *handle) {
P2OUT |= BIT2;
}
void inverterCtrlStartStep2(void *handle) {
TA1CTL = MC_1 | ID_0 | TASSEL_2 | TACLR;
TA1CCTL0 = CCIE | OUTMOD_4;
TA1CCR0 = 0;
}
void inverterCtrlSetFrequency(uint16_t f) {
float ff = (float)f;

View File

@ -10,7 +10,14 @@
#include <stdint.h>
extern const uint32_t INVERTERCTRL_START_STEP1_DELAY;
extern const uint32_t INVERTERCTRL_START_STEP2_DELAY;
void inverterCtrlInit();
void inverterCtrlSetFrequency(uint16_t f);
void inverterCtrlStartStep1(void *handle);
void inverterCtrlStartStep2(void *handle);
#endif /* INVERTERCTRL_H_ */

View File

@ -14,7 +14,7 @@
#include "time.h"
#include "PontCoopScheduler.h"
#include "inverterCtrl.h"
#include "hmi.h"
@ -33,13 +33,15 @@ int main() {
timeInit();
schInit();
inverterCtrlInit();
hmiInit();
// schAdd(displayExec, NULL, 0, DISPLAY_CYCLE);
schAdd(inverterCtrlStartStep1, NULL, INVERTERCTRL_START_STEP1_DELAY, 0);
schAdd(inverterCtrlStartStep2, NULL, INVERTERCTRL_START_STEP2_DELAY, 0);
schAdd(hmiExec, NULL, HMI_START_DELAY, HMI_CYCLE);
__enable_interrupt();
inverterCtrlSetFrequency(50);
while (1) {