changed mcu

This commit is contained in:
Wolfgang Hottgenroth 2016-09-27 22:01:30 +02:00
parent fc7582017e
commit c4ef53ac6b
8 changed files with 54 additions and 147 deletions

View File

@ -20,17 +20,22 @@
<folderInfo id="dk.xpg.msp430eclipse.configuration.app.debug.1419592438." name="/" resourcePath="">
<toolChain id="dk.xpg.msp430eclipse.toolchain.gcc.app.debug.153746332" name="MSP430 GCC Toolchain" superClass="dk.xpg.msp430eclipse.toolchain.gcc.app.debug">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="dk.xpg.msp430eclipse.targetplatform.msp430.1369996948" isAbstract="false" name="MSP430 Cross-Target" osList="all" superClass="dk.xpg.msp430eclipse.targetplatform.msp430"/>
<builder buildPath="${workspace_loc:/Inverter0}/Debug" id="dk.xpg.msp430eclipse.target.gnu.builder.1633370096" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="MSP430 GNU Make Builder" superClass="dk.xpg.msp430eclipse.target.gnu.builder"/>
<builder buildPath="${workspace_loc:/Inverter0}/Debug" id="dk.xpg.msp430eclipse.target.gnu.builder.1633370096" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="MSP430 GNU Make Builder" superClass="dk.xpg.msp430eclipse.target.gnu.builder">
<outputEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Debug"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Release"/>
</outputEntries>
</builder>
<tool id="dk.xpg.msp430eclipse.tool.compiler.gcc.1609866167" name="MSP430 C Compiler" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc">
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.optimization.level.none" id="dk.xpg.msp430eclipse.compiler.option.optimization.level.1638221170" name="Optimization Level" superClass="dk.xpg.msp430eclipse.compiler.option.optimization.level" valueType="enumerated"/>
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.debugging.level.default" id="dk.xpg.msp430eclipse.compiler.option.debugging.level.423105011" name="Debugging Level" superClass="dk.xpg.msp430eclipse.compiler.option.debugging.level" valueType="enumerated"/>
<option id="dk.xpg.msp430eclipse.compiler.option.includes.paths.113771113" name="Include paths (-I)" superClass="dk.xpg.msp430eclipse.compiler.option.includes.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Inverter0/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Inverter0/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Inverter0/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/src}&quot;"/>
<listOptionValue builtIn="false" value="../Inverter0/hottislib"/>
<listOptionValue builtIn="false" value="../Inverter0/hottislibformsp430"/>
<listOptionValue builtIn="false" value="../Inverter0/src"/>
<listOptionValue builtIn="false" value="../inverter0/hottislib"/>
<listOptionValue builtIn="false" value="../inverter0/hottislibformsp430"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/inverter0/src}&quot;"/>
</option>
<option id="dk.xpg.msp430eclipse.compiler.option.language.standard.1069227926" name="Standard" superClass="dk.xpg.msp430eclipse.compiler.option.language.standard" useByScannerDiscovery="false" value="dk.xpg.msp430eclipse.compiler.option.language.standard.gnu99" valueType="enumerated"/>
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.2144495992" name="C Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input"/>
@ -38,9 +43,12 @@
</tool>
<tool id="dk.xpg.msp430eclipse.tool.assembler.gcc.1721201165" name="MSP430 Assembler" superClass="dk.xpg.msp430eclipse.tool.assembler.gcc">
<option id="dk.xpg.msp430eclipse.assembler.option.general.include.1531893167" name="Include Paths (-I)" superClass="dk.xpg.msp430eclipse.assembler.option.general.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/src}&quot;"/>
<listOptionValue builtIn="false" value="../Inverter0/hottislib"/>
<listOptionValue builtIn="false" value="../Inverter0/hottislibformsp430"/>
<listOptionValue builtIn="false" value="../Inverter0/src"/>
<listOptionValue builtIn="false" value="../inverter0/hottislib"/>
<listOptionValue builtIn="false" value="../inverter0/hottislibformsp430"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inverter0/inverter0/src}&quot;"/>
</option>
<inputType id="dk.xpg.msp430eclipse.tool.assembler.input.975463794" name="Assembler Files" superClass="dk.xpg.msp430eclipse.tool.assembler.input"/>
</tool>
@ -51,9 +59,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="hottislibformsp430|hottislib|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="hottislib"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="hottislibformsp430"/>
<entry excluding="src|hottislib|hottislibformsp430" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1
msp430/DeviceSerialNumber=
msp430/MSP430TARGETMCU=msp430g2553
msp430/MSP430TARGETMCU=msp430g2452
msp430/MSPDebugConnection=USB
msp430/MSPDebugDriver=rf2500
msp430/MSPDebugProtocol=SBW

View File

@ -1,24 +0,0 @@
/*
* gpioCfg.c
*
* Created on: 29.08.2016
* Author: wn
*/
#include <msp430g2553.h>
#include "gpio.h"
tPinCfg pinCfg[PINS_END] = {
{PORT1, BIT7, PIN_OUT, LOW}, //A
{PORT1, BIT6, PIN_OUT, LOW}, //B
{PORT2, BIT1, PIN_OUT, LOW}, //C
{PORT2, BIT3, PIN_OUT, LOW}, //D
{PORT2, BIT4, PIN_OUT, LOW}, //E
{PORT2, BIT5, PIN_OUT, LOW}, //F
{PORT2, BIT2, PIN_OUT, LOW}, //G
{PORT2, BIT0, PIN_OUT, HIGH}, //0
{PORT1, BIT5, PIN_OUT, HIGH}, //1
{PORT1, BIT2, PIN_OUT, HIGH}, //2
{PORT1, BIT0, PIN_IN_PULLUP, LOW}, // BUTTON_1
{PORT1, BIT1, PIN_OUT, LOW}, // LED_1
};

View File

@ -1,31 +0,0 @@
/*
* gpioCfg.h
*
* Created on: 18.09.2016
* Author: wn
*/
#ifndef GPIOCFG_H_
#define GPIOCFG_H_
#include "gpio.h"
typedef enum {
PINS_FIRST,
SEG_A = PINS_FIRST,
SEG_B,
SEG_C,
SEG_D,
SEG_E,
SEG_F,
SEG_G,
DIGIT_0,
DIGIT_1,
DIGIT_2,
BUTTON_1,
LED_1,
PINS_END
} tPin;
#endif /* GPIOCFG_H_ */

View File

@ -8,7 +8,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <msp430g2553.h>
#include <msp430g2452.h>
#include <isr_compat.h>
#include "inverter.h"
@ -44,13 +44,13 @@ volatile uint8_t activeOffset = 0;
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
ISR(TIMER0_A0, TA0_ISR_Ovrfl) {
if (pulseWidthIdx == 0) {
}
uint16_t pw = pulseWidths[pulseWidthIdx + activeOffset];
if (pw != 0) {
TA1CCR1 = pw;
TA0CCR1 = pw;
P2OUT |= BIT1;
}
@ -60,13 +60,13 @@ ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
}
}
ISR(TIMER1_A1, TA1_ISR_Comp) {
ISR(TIMER0_A1, TA0_ISR_Comp) {
__disable_interrupt();
uint16_t taiv = TA1IV;
if (taiv & TA1IV_TACCR1) {
uint16_t taiv = TA0IV;
if (taiv & TA0IV_TACCR1) {
P2OUT &= ~BIT1;
} else if ((taiv && TA1IV_TACCR2) && (pulseWidthIdx == 0)) {
P1OUT ^= (BIT1 | BIT0);
} else if ((taiv && TA0IV_TACCR2) && (pulseWidthIdx == 0)) {
P1OUT ^= (BIT1 | BIT2);
}
__enable_interrupt();
}
@ -74,29 +74,39 @@ ISR(TIMER1_A1, TA1_ISR_Comp) {
void inverterInit() {
P1OUT &= ~BIT0;
P1OUT &= ~BIT2;
P1OUT |= BIT1;
P1DIR |= BIT0 | BIT1;
P1DIR |= BIT1 | BIT2;
P2OUT &= ~BIT1;
P2DIR |= BIT1;
P2OUT &= ~BIT0;
P2DIR |= BIT0;
P2SEL |= BIT0;
// TA0OV1 out
P1OUT &= ~BIT5;
P1DIR |= BIT5;
P1SEL |= BIT5;
TA1CTL = MC_1 | ID_0 | TASSEL_2 | TACLR;
TA1CCTL0 = CCIE | OUTMOD_4;
TA1CCTL1 = CCIE;
TA1CCTL2 = CCIE;
TA1CCR0 = 0;
TA1CCR1 = 0;
TA1CCR2 = 1;
//TACLK in
P1OUT &= ~BIT0;
P1DIR &= ~BIT0;
P1SEL |= BIT0;
// SMCLK out
P1DIR |= BIT4;
P1SEL |= BIT4;
TA0CTL = MC_1 | ID_0 | TASSEL_0 | TACLR;
TA0CCTL0 = CCIE | OUTMOD_4;
TA0CCTL1 = CCIE;
TA0CCTL2 = CCIE;
TA0CCR0 = 0;
TA0CCR1 = 0;
TA0CCR2 = 1;
}
void inverterSetFrequency(uint16_t f) {
float ff = (float)f;
float slotLength = 2 / (ff * 200e-9 * NUM_OF_SINE_VALUES);
float slotLength = 2 / (ff * 400e-9 * NUM_OF_SINE_VALUES);
uint16_t sl = (uint16_t)slotLength;
uint8_t currentOffset = (activeOffset == 0) ? NUM_OF_SINE_VALUES : 0;
@ -107,7 +117,7 @@ void inverterSetFrequency(uint16_t f) {
__disable_interrupt();
activeOffset = currentOffset;
TA1CCR0 = sl;
TA0CCR0 = sl;
pulseWidthIdx = 0;
__enable_interrupt();
}

View File

@ -5,13 +5,12 @@
* Author: wn
*/
#include <msp430g2553.h>
#include <msp430g2452.h>
#include <stdint.h>
#include <intrinsics.h>
#include <stdlib.h>
#include <stdbool.h>
#include "time.h"
#include "inverter.h"
@ -21,11 +20,10 @@ int main() {
// highest possible system clock
DCOCTL = DCO0 | DCO1 | DCO2;
BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
BCSCTL2 = 0;
BCSCTL2 = DIVS_1;
BCSCTL3 = 0;
timeInit();
inverterInit();
__enable_interrupt();

View File

@ -1,34 +0,0 @@
/*
* time.c
*
* Created on: 20.05.2014
* Author: wn
*/
#include <msp430g2553.h>
#include <isr_compat.h>
#include <stdint.h>
#include "time.h"
#include "PontCoopScheduler.h"
volatile uint32_t timestamp;
ISR(TIMER0_A0, TA0_ISR) {
timestamp++;
schUpdate();
}
void timeInit() {
timestamp = 0;
TA0CCR0 = 32;
TA0CCTL0 = CCIE;
TA0CTL = MC_1 | ID_0 | TASSEL_1 | TACLR;
}
uint32_t getMillis() {
return timestamp;
}

View File

@ -1,18 +0,0 @@
/*
* time.h
*
* Created on: 20.05.2014
* Author: wn
*/
#ifndef TIME_H_
#define TIME_H_
#include <stdint.h>
void timeInit();
uint32_t getMillis();
#endif /* TIME_H_ */