Reem Bayoumy
Newbie level 1
- Joined
- Dec 27, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Estonia
- Activity points
- 9
Code:
#include <msp430g2553.h>
int step;
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
// Configure CPU clock
if (CALBC1_16MHZ==0xFF)
{
while(1);
}
DCOCTL = 0;
BCSCTL1 = CALBC1_16MHZ; // Set DCO
DCOCTL = CALDCO_16MHZ; // If calibra
P1DIR |= BIT2; // Set P1.2 to output direction
P1OUT &= BIT2; // Set the pin off
P1DIR |= BIT4; // Set P1.6 to output direction
P1OUT &= BIT4; // Set the pin off
// TA0CCR0 = 1; // Count limit
// TA0CCTL0 = CCIE; // Enable Timer A0 interrupts, bit 4=1
// TA0CTL = TASSEL_2 + MC_1 + ID_0; // Timer A0 with ACLK, count UP
//
// TA1CCR0 = 5; // Count limit
// TA1CCTL1 = CCIE; // Enable Timer A1 interrupts, bit 4=1
// TA1CTL = TASSEL_2 + MC_1 + ID_0; // Timer A1 with ACLK, count UP
_BIS_SR(GIE);
while (1) {
step = 0;
switch(step)
{
case 0:
P1OUT &= BIT2; // set P1.2 OFF
P1OUT &= BIT4; // Set P1.4 OFF
step= 1;
case 1:
P1OUT &= ~BIT2 , //step Low
// P1OUT =0;
P1OUT |= BIT4, //dir HIGH
__delay_cycles(3);
// P1OUT =1;
step= 2;
case 2:
P1OUT |= BIT4;//dir HIGH
// P1OUT =1;
__delay_cycles(3);
P1OUT |= BIT2, //dir HIGH
// P1OUT =1;
__delay_cycles(16);
step= 3;
case 3:
P1OUT &= ~BIT2; //dir low
__delay_cycles(16);
// P1OUT =1;
// __delay_cycles(16);
P1OUT &= ~BIT4 ;//dir LOW
// P1OUT =0;
break;
}
but something Error with the code i need help
https://www.sparkfun.com/products/11876
**broken link removed**
Last edited by a moderator: