질문게시판 > 헤더파일 디버깅하는데 자꾸 에러가 나네요..

TODAY230 TOTAL2,698,035
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 질문게시판 | 헤더파일 디버깅하는데 자꾸 에러가 나네요..

페이지 정보

작성자 남민기 작성일2018-12-12 17:50 조회9,369회 댓글2건

본문

	

#define KEY_DN 1;

#define EV_DN 2;

#define EV_UP 4;

#define EV_LONGDN 8;

#define EV_DBCLICK 16;

 

 

typedef struct key_tag_type{

 

volatile char *INPORT;

char pin;

volatile int8_t key;

volatile int8_t tmr;

} key_tag;

 

void hook_key(key_tag *k);

int8_t getEV(key_tag *k);

void init_key(key_tag *k, volatile char *PORTX, int8_t pin_num, uint8_t term);

 

 

-------------------------------------------------------------------------------------------------------------

 

expected ')' before ';' token 

 

해당 에러가 뜨는데

스트럭트 쪽에서 에러가 나는 것 같더라고요. 문법은 맞는 것 같은데 이유가 있을까요..

  • BASIC4MCU 작성글 SNS에 공유하기
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기

댓글 2

조회수 9,369

master님의 댓글

master 작성일

전체 소스파일 첨부해야지 컴파일 해볼 수 있습니다.

남민기님의 댓글

남민기 댓글의 댓글 작성일

#define F_CPU 16000000
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

#include "LCD.h"
#include "key.h"

#define MIN_TERM 8
#define MAX_TERM 60
#define _DEBOUNCEC 60
#define _LONG_HOLD 1000
#define _DC_GAP 250


static int8_t _debounce_ticks;
static int8_t _long_hold_ticks;
static int8_t _dc_gap_ticks;

//모스부호 ,/ 0 = null / 1= . / 2 = ㅡ /
int A[4] = { 1,2,0,0 },
B[4] = { 2,1,1,1 },
C[4] = { 2,1,2,1 },
D[4] = { 2,1,1,0 },
E[4] = { 1,0,0,0 },
F[4] = { 1,1,2,1 },
G[4] = { 2,2,1,0 },
H[4] = { 1,1,1,1 },
I[4] = { 1,1,0,0 },
J[4] = { 1,2,2,2 },
K[4] = { 2,1,2,0 },
L[4] = { 1,2,1,1 },
M[4] = { 2,2,0,0 },
N[4] = { 2,1,0,0 },
O[4] = { 2,2,2,0 },
P[4] = { 1,2,2,1 },
Q[4] = { 2,2,1,2 },
R[4] = { 1,2,1,0 },
S[4] = { 1,1,1,0 },
T[4] = { 2,0,0,0 },
U[4] = { 1,1,2,0 },
V[4] = { 1,1,1,2 },
W[4] = { 1,2,2,0 },
X[4] = { 2,1,1,2 },
Y[4] = { 2,1,2,2 },
Z[4] = { 2,2,1,1 };


//function declaration
int curr = 0; int num = 1;
int index = 1;
int LoadBuffer = 0;
void Port_init();
char key_scan(void);
char Character(int[]);
void LoadBufferReset(void);
char GetBN(void);
int morse[4];
int chanel=0;


int main(void)
{
char sceneNo = '0', sceneNo0 = '0';

int ciper = 0; //자릿수
Port_init();
_delay_ms(50); //cache
LCD_initialize();
int cnt_arr = 0;

LCD_clear();


_delay_ms(10);

//main stage
LCD_string(0x80, "1.ENG to MORSE");
LCD_string(0xc0, "2.MORto ENG Ini2");


while(chanel == 0){
//get a button main
sceneNo = GetBN();
if(sceneNo == sceneNo0) continue;
switch(sceneNo)
{

case '1':

LCD_string(0x80,"--ch0ch0");
break;

case '2':

LCD_string(0x80,"ch0ch0ch0");
break;

case '3':
LCD_clear();
EGtoMS();

break;

case '6' :
LCD_clear();
LCD_string(0x80, "1.ENG to MORSE");
LCD_string(0xc0, "2.MORto ENG Home");
break;

}





}//while



return 0;

}//main




void Port_Init(void)
{
DDRE = 0x00; //BUTTON
PORTE = 0x00;

DDRF = 0xff;
PORTF = 0x00;

DDRB = 0xff; //LCD
PORTB = 0x00;
DDRD = 0xff;
PORTD = 0x00;
DDRF = 0xff;
PORTF = 0x00;

DDRE = 0xff;


}
 

 char GetBN(void)
 {
unsigned char p = 0x00;

if((PINE & 0x01) == 0){

return '1';
_delay_ms(100); while(PINE & 0x01); _delay_ms(100); //채터링방지용

}

if((PINE & 0x02) == 0){

return '2';
_delay_ms(100); while(PINE & 0x02); _delay_ms(100); //채터링방지용

}
if((PINE & 0x04) == 0){
_delay_ms(100);
return '3';
_delay_ms(100); while(PINE & 0x04); _delay_ms(100); //채터링방지용

}
if((PINE & 0x08) == 0){

return '4';
_delay_ms(100); while(PINE & 0x08); _delay_ms(100); //채터링방지용

}
  if((PINE & 0x10) == 0){

return '5';
_delay_ms(100); while(PINE & 0x10); _delay_ms(100); //채터링방지용

}
if((PINE & 0x20) == 0){

return '6';
_delay_ms(100); while(PINE & 0x20); _delay_ms(100); //채터링방지용

}

return '0';

 }

 
 void EGtoMS(void){_delay_ms(500);
chanel = 1;

LCD_clear();
 
// LCD_command(0x0e);
Eng();


 }
 
 void Eng(void){
LCD_clear();
LCD_string(0x80, "Enter Message");LCD_string(0x8f,"?");
char spell[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
int i = 0;

char Strings[20];
int j = 0;

int force = 0;
while(chanel==1){

//스펠링이 들어갈 곳.

 
char btn=GetBN();
//force = 0;

switch(btn){
case '1':
if(i==0){
i=26;
}
i--;
spelling(i);
if(force<3){
_delay_ms(500);
force++;}
else {_delay_ms(200);}
break;


case '2':
if(i==25){
i=-1;
}
i++;
spelling(i);
if(force<3){
_delay_ms(500);
force++;}
else {_delay_ms(200);}
break;

case '3':
Strings[j] = spell[i];
j++;
LCD_string(0xc0,Strings);
_delay_ms(1000);
break;

case '5':
for (int k = 0; k <26; k++) { //string 초기화
Strings[k] = ' ';
}
j=0;
LCD_string(0xc0,Strings);
break;

case '6':
chanel = 0;
break;

}//switch

}//while


 }
 
 void spelling(char arr){

char arr1 = arr+65;
switch(arr1){
case'A':
LCD_string(0x8f,"A");
break;
case'B':
LCD_string(0x8f,"B");
break;
case'C':
LCD_string(0x8f,"C");
break;
case'D':
LCD_string(0x8f,"D");
break;
case'E':
LCD_string(0x8f,"E");
break;
case'F':
LCD_string(0x8f,"F");
break;
case'G':
LCD_string(0x8f,"G");
break;
case'H':
LCD_string(0x8f,"H");
break;
case'I':
LCD_string(0x8f,"I");
break;
case'J':
LCD_string(0x8f,"J");
break;
case'K':
LCD_string(0x8f,"K");
break;
case'L':
LCD_string(0x8f,"L");
break;
case'M':
LCD_string(0x8f,"M");
break;
case'N':
LCD_string(0x8f,"N");
break;
case'O':
LCD_string(0x8f,"O");
break;
case'P':
LCD_string(0x8f,"P");
break;
case'Q':
LCD_string(0x8f,"Q");
break;
case'R':
LCD_string(0x8f,"R");
break;
case'S':
LCD_string(0x8f,"S");
break;
case'T':
LCD_string(0x8f,"T");
break;
case'U':
LCD_string(0x8f,"U");
break;
case'V':
LCD_string(0x8f,"V");
break;
case'W':
LCD_string(0x8f,"W");
break;
case'X':
LCD_string(0x8f,"X");
break;
case'Y':
LCD_string(0x8f,"Y");
break;
case'Z':
LCD_string(0x8f,"Z");
break;

}

 }
 
 
 void test(void){
char test = 'A';

switch(test){
case 'A':
LCD_string(0x8f,"A");
break;
}
 }


void hook_key(key_tag *k){
if(k->tmr>0){
if (k->tmr < _debounce_ticks) k->tmr++;
else {
if ( (*(k->INPORT) & k->pin) != 0 ) {
k->key &= ~KEY_DN;
k->key |= EV_UP;
k->tmr = -1;

} else {
if (k->tmr < _long_hold_ticks){
k->tmr++;
if ( k->tmr == _long_hold_ticks)
k->key |= EV_LONGDN;
}
}
}
} else if( k->tmr < 0){
if(-k->tmr < _debounce_ticks) k->tmr--;
else {
if ( (*k->INPORT) & (k->pin) == 0) {
if (-k->tmr < _dc_gap_ticks)
k->key |= EV_DBCLICK;
k->key |= (KEY_DN | EV_DN);
k->tmr = 1;
} else {
if ( k->tmr < _dc_gap_ticks )
k->tmr--;
}
}
} else {
if( (*(k->INPORT) & k->pin) != 0){
k->key = 0;
k->tmr = -_dc_gap_ticks;
} else {
k->key = KEY_DN;
k->tmr = 1;
}
}
}




int8_t getEV(key_tag *k){
int8_t c;
cli();
c=k->key;
k->key &= KEY_DN;
sei();
return c;
}

void init_key(key_tag *k, volatile char *PORTE, int8_t pin_num, uint8_t term)
{
*((volatile char*) (PORTE-1)) &= ~_BV(pin_num);
k->INPORT = (volatile char *) (PORTE-2);
k->pin = _BV(pin_num);

if(term < MIN_TERM) term = MIN_TERM;
else if(term > MAX_TERM) term = MAX_TERM;
_debounce_ticks = (_DEBOUNCE / term);
_long_hold_ticks = (_LONG_HOLD / term);

질문게시판HOME > 질문게시판 목록

MCU, AVR, 아두이노 등 전자공학에 관련된 질문을 무료회원가입 후 작성해주시면 전문가가 답변해드립니다.
ATMEGA128PWMLED초음파
아두이노AVR블루투스LCD
UART모터적외선ATMEGA
전체 스위치 센서
질문게시판 목록
제목 작성자 작성일 조회
공지 MCU, AVR, 아두이노 등 전자공학에 관련된 질문은 질문게시판에서만 작성 가능합니다. 스태프 19-01-15 19826
공지 사이트 이용 안내댓글[28] master 17-10-29 34162
질문 압력센서에 따른 진동모터를 버튼으로 제어 회로도 질문 새글 도와주세용용 23-06-07 19
질문 아두이노 리니어 제어 모듈 설계중입니다. 도와주세요 새글 갓비타 23-06-06 17
답변 답변글 답변 : 아두이노 리니어 제어 모듈 설계중입니다. 도와주세요 새글 master 23-06-07 13
질문 dc모터 제어 관련 질문 드려요 ㅠㅠ!!댓글[2] 새글 dpwl 23-06-06 27
답변 답변글 답변 : dc모터 제어 관련 질문 드려요 ㅠㅠ!! 새글 master 23-06-07 15
질문 pixy2 cam 을 이용한 색상인식 모터 제어댓글[1] 가나다라 23-06-05 15
질문 안녕하세요 제품 품목 이름에 대해서 궁금합니다. 이미지첨부파일 알려주시면감사합니다 23-06-05 19
질문 Atmega128 온도센서로 led제어 질문드려요댓글[1] 이미지첨부파일 얍얍 23-06-05 27
질문 아구이노 코드를 atmega 128 코드로 변환 하고 싶습니다 ㅠㅠ댓글[1] 기로롱 23-06-05 26
질문 atmega128 uart 질문입니다.댓글[1] bme12 23-06-05 32
질문 라즈베리파이에 풀 프레임 이미지센서 활용에 대한 질문이 있습니다.댓글[1] 이미지첨부파일 KYLO 23-06-04 21
질문 아두이노 시리얼 번호를 이용해 led 제어 wnion 23-06-04 22
답변 답변글 답변 : 아두이노 시리얼 번호를 이용해 led 제어 새글 master 23-06-07 11
질문 ATMEGA128 혹시 여기서 왜 인터럽트 기능이 안되는지 알 수 있나요댓글[1] IEEE 23-06-04 35
질문 stm32f767을 이용해서 자이로가속도 센서의 값 받아오기댓글[1] rlchwjswk 23-06-03 24
질문 아두이노 모터제어 관련해서 질문드립니다!댓글[1] 이미지첨부파일 아두이노어렵잖아 23-06-03 47
질문 atmega128 디지털조도센서 코드오류댓글[1] 이미지 까미 23-06-02 41
질문 atmega128 디지털 조도 센서댓글[1] 까미 23-06-02 43
질문 적외선리모콘으로 부저를제어 하는방법 질문입니다.댓글[4] Tell 23-06-02 27
질문 lora 무선 모듈에 관한 질문입니다.댓글[1] 로이스10 23-06-01 24
질문 적외선 송수신기 DC모터2개 제어 질문입니다.댓글[5] Tell 23-06-01 40
질문 스텝모터 제어 코드 질문댓글[6] pmh11 23-05-31 49
질문 초음파 센서를 이용한 인원 카운팅댓글[1] 초음파야 23-05-31 41
질문 모터 Hall 스위치 연결 문의댓글[1] 오후 23-05-31 29
질문 아두이노 lcd 문자 스크롤디스플레이 wnion 23-05-31 38
답변 답변글 답변 : 아두이노 lcd 문자 스크롤디스플레이댓글[1] master 23-05-31 36
질문 아두이노 타이머 인터럽트 미ㅏㄴㅇ 23-05-30 48
답변 답변글 답변 : 아두이노 타이머 인터럽트댓글[8] master 23-05-30 61
게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기