in line 49, int i=0, i got the error
Code:
#include <msp430g2553.h>
#include <stdio.h>
#define OTROWS P1OUT
#define ROW1 BIT0
#define ROW2 BIT1
#define ROW3 BIT2
#define ROW4 BIT3
#define ALLROWS (ROW4 | ROW3 |ROW2 |ROW1)
#define INCOLS P1IN
#define COL1 BIT4
#define COL2 BIT5
#define COL3 BIT6
#define COL4 BIT7
#define ALLCOLS (COL4 | COL3 | COL2 |COL1)
// Declarations
int rownum, keynum, ROWS;
int main()
{
WDTCTL = WDTPW + WDTHOLD; // Stop Watch Dog Timer
P1DIR = 0x00; // Set port 1 all inputs
P1DIR |= ALLROWS; // Set all rows as output
P1REN |= ALLCOLS; // Enable resistors for all columns
P1OUT |= ALLCOLS; // Make those resistors pullups
P1IES |= ALLCOLS; // Interrupt edge selec, hi to lo
P1IE |= ALLCOLS; // Enable interrupt on all columns
P1IFG &= ~ALLCOLS; // Clear all interrupt flags on the columns
P2DIR |= BIT5;
int i=0;
__enable_interrupt(); //enable interrupts
OTROWS &= ~(ALLROWS); //Assert low on all rows low to detect any key stroke interrup
__delay_cycles(200);
while(1) {// main loop empty
P2OUT ^=BIT5,
// call the following delay keynum number of times
int i=0;
for(i=0;i<=keynum;i++);
{
if (i==keynum)break; //this tell the loop to stop after the flash reaches the number entered
__delay_cycles(200000);
}
}
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
__delay_cycles(200);
OTROWS |= ALLROWS;//Make all rows high
__delay_cycles(200);
keynum=0;
for(rownum=0; rownum<=4; rownum++) //Start scanning the KP
{
//start a 1 in first roww and shift left rownum times, and XOR
OTROWS = ((ROW1<<rownum) ^ ALLROWS); __delay_cycles(200);
if(!(INCOLS & COL1)) {keynum=4*rownum +1;}
if(!(INCOLS & COL2)) {keynum=4*rownum +2;}
if(!(INCOLS & COL3)) {keynum=4*rownum +3;}
if(!(INCOLS & COL4)) {keynum=4*rownum +4;}
OTROWS &= ~ALLROWS; __delay_cycles(200); //Make all rows low to for next key stroke interrupt
P1IFG &= ~ALLCOLS; __delay_cycles(200); //Clear the interrupt flags
__delay_cycles(200);
}
}
can anyone give me tips on how to fix this?