start/stop bit
This commit is contained in:
parent
c4ef53ac6b
commit
cd937ea4d1
18
.cproject
18
.cproject
@ -29,27 +29,13 @@
|
||||
<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="../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=""${workspace_loc:/inverter0/inverter0/src}""/>
|
||||
</option>
|
||||
<option id="dk.xpg.msp430eclipse.compiler.option.includes.paths.113771113" name="Include paths (-I)" superClass="dk.xpg.msp430eclipse.compiler.option.includes.paths" valueType="includePath"/>
|
||||
<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"/>
|
||||
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc.194364093" name="C++ Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc"/>
|
||||
</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="../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=""${workspace_loc:/inverter0/inverter0/src}""/>
|
||||
</option>
|
||||
<option id="dk.xpg.msp430eclipse.assembler.option.general.include.1531893167" name="Include Paths (-I)" superClass="dk.xpg.msp430eclipse.assembler.option.general.include" valueType="includePath"/>
|
||||
<inputType id="dk.xpg.msp430eclipse.tool.assembler.input.975463794" name="Assembler Files" superClass="dk.xpg.msp430eclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="dk.xpg.msp430eclipse.tool.linker.gcc.1458265663" name="MSP430 Linker" superClass="dk.xpg.msp430eclipse.tool.linker.gcc">
|
||||
|
@ -71,13 +71,32 @@ ISR(TIMER0_A1, TA0_ISR_Comp) {
|
||||
__enable_interrupt();
|
||||
}
|
||||
|
||||
|
||||
ISR(PORT1, PORT1_ISR) {
|
||||
uint16_t p1Ifg = P1IFG;
|
||||
if (p1Ifg & BIT3) {
|
||||
// start
|
||||
pulseWidthIdx = 0;
|
||||
TA0CTL = MC_1 | ID_0 | TASSEL_0 | TACLR;
|
||||
} else if (p1Ifg & BIT4) {
|
||||
// stop
|
||||
TA0CTL = MC_0;
|
||||
}
|
||||
}
|
||||
|
||||
void inverterInit() {
|
||||
// start, stop
|
||||
// BIT3: start, BIT4: stop
|
||||
P1OUT &= (BIT3 | BIT4);
|
||||
P1DIR &= (BIT3 | BIT4);
|
||||
P1IES = BIT3;
|
||||
P1IE |= BIT3 | BIT4;
|
||||
|
||||
// bridge direction
|
||||
P1OUT &= ~BIT2;
|
||||
P1OUT |= BIT1;
|
||||
P1DIR |= BIT1 | BIT2;
|
||||
|
||||
// bridge enable (PWM)
|
||||
P2OUT &= ~BIT1;
|
||||
P2DIR |= BIT1;
|
||||
|
||||
@ -91,11 +110,7 @@ void inverterInit() {
|
||||
P1DIR &= ~BIT0;
|
||||
P1SEL |= BIT0;
|
||||
|
||||
// SMCLK out
|
||||
P1DIR |= BIT4;
|
||||
P1SEL |= BIT4;
|
||||
|
||||
TA0CTL = MC_1 | ID_0 | TASSEL_0 | TACLR;
|
||||
TA0CTL = MC_0;
|
||||
TA0CCTL0 = CCIE | OUTMOD_4;
|
||||
TA0CCTL1 = CCIE;
|
||||
TA0CCTL2 = CCIE;
|
||||
@ -104,6 +119,7 @@ void inverterInit() {
|
||||
TA0CCR2 = 1;
|
||||
}
|
||||
|
||||
|
||||
void inverterSetFrequency(uint16_t f) {
|
||||
float ff = (float)f;
|
||||
float slotLength = 2 / (ff * 400e-9 * NUM_OF_SINE_VALUES);
|
||||
|
Loading…
x
Reference in New Issue
Block a user