로그인 | 회원가입 | 주문 조회
총 10,748개의 질문이 있습니다.
번호 제목 작성자 등록일 조회
698 답변완료encoder DC motor 제어 오원세 2008-01-10 2,471
encoder DC motor를 제어를 해야하는데요... 제가 전자전기 쪽은 완젼초보라서^^;; atmega128 pro kit가 있어요... 여기에 모터드라이브를 연결하고 그다음 모터를 어떻게 연결하는지요?? 모터는 모터뱅크(www.motorbank.co.kr)에서 PGM16-E 이제품을 가지고 있습니다. 제어는 어떤방식으로 해야하나요?? 감사합니다.
관리자 답변 N.T.C · 2008-01-11
안녕하세요? 저희 뉴테크놀로지 컴패니 제품을 이용하여 주셔서 감사드립니다. 일단, DC motor 제어는 저희 모듈을 사용하는 예제소스가 자료실에 공개되어 있구요. Encoder를 사용하는 것은 펄스를 세어서 돌아가는 것을 재구요. 펄스당 각도를 가지고 재게 되구요. 두라인에서 들어오는 펄스를 각각 세서 시계방향, 반시계방향을 판단하게 됩니다. 자세한 인코더 관련 내용은 인터넷을 참고하세요. 감사합니다.
697 답변완료확장보드 질문입니다.. 조정교 2008-01-10 2,547
귀사의 확장보드중에.. 디지털 입출력 보드가 있던데요.. 어디에 적용이 가능한지 궁굼합니다.. 답변 기다리겠습니다 ^^
관리자 답변 N.T.C · 2008-01-10
안녕하세요? 조정교님, 디지털 입출력 보드가 어떤 제품인지 궁금하네요. 저희 회사에 없는 제품 같습니다. 알려 주세요. 감사합니다.
696 답변완료ADC 학습위한 센서 관련 책좀 추천해 주세요 KJS 2008-01-10 2,637
AVR를 이용한 study 중인데요. ADC 관련 각종 센서 사용에 대한 기본 지식및 skill 위한 좋은 책 있으면 소개 부탁 드립니다.
관리자 답변 N.T.C · 2008-01-12
안녕하세요? 열공 하세요. 참고하실 만한 책 이름은 자동화를 위한 센서공학 성안당 책입니다. 또한, ADC 기본이 되는 ADC0809에 관한 내용도 나와 있는 책이 있네요. 비주얼 C++을 이용한 프린터포트 제어, 동일출판사 입니다. 좀 다른 방향의 책이지만, ADC 부분이 괜찮은 책 같아 추천합니다. 감사합니다.
695 답변완료<소스>그래픽 lcd 글자쓰기 및 네모그리기 KJS 2008-01-10 3,234
폰트 헤더 파일및 기본소스는 newtc 자료실, 그래픽 lcd 부분에 있음. 그걸 겨우 이해해서 간단히 묘사한 상태임 #include <iom128v.h> #include <macros.h> #include <math.h> #include "FONTK52.h" //#include "GLCDK52.h" #define LCD_CTRL (*(volatile unsigned char *)0x8001) #define LCD_OUTP (*(volatile unsigned char *)0x8000) #define ON 1 #define OFF 0 #define dd_time 10 #define DISPON 0x3f #define DISPOFF 0x3e #define DI 0x01 #define RW 0x02 #define E 0x04 #define CS1 0x08 #define CS2 0x10 #define CS_ALL 0x18 #define RESET 0x20 #define SetDI(m) m ? (LCD_CTRL=(L_CON|=DI )) : (LCD_CTRL=(L_CON&=~DI)) #define SetRW(m) m ? (LCD_CTRL=(L_CON|=RW )) : (LCD_CTRL=(L_CON&=~RW)) #define SetE(m) m ? (LCD_CTRL=(L_CON|=E )) : (LCD_CTRL=(L_CON&=~E)) #define SetCS1(m) m ? (LCD_CTRL=(L_CON|=CS1 )) : (LCD_CTRL=(L_CON&=~CS1)) #define SetCS2(m) m ? (LCD_CTRL=(L_CON|=CS2 )) : (LCD_CTRL=(L_CON&=~CS2)) #define SetReset(m) m ? (LCD_CTRL=(L_CON|=RESET)) : (LCD_CTRL=(L_CON&=~RESET)) typedef unsigned char byte; typedef unsigned int word; volatile int L_CON = 0x00; byte ch_data =0x00; byte ch_keep[8][128]= {0x00}; int page=0; int y_page=0,first_cnt=0; byte xcharacter, ycharacter; /* x character(0-3), y character(0-15) */ byte cursor_flag, cursorx, cursory; /* x and y cursor position(0-3, 0-15) */ byte Korean_buffer[32]; void port_init(void) { PORTA = 0x00; DDRA = 0x00; // Control Port PORTB = 0x00; DDRB = 0x00; // Data Port PORTC = 0x00; DDRC = 0x00; PORTD = 0x00; DDRD = 0x00; PORTE = 0x00; DDRE = 0x00; PORTF = 0x00; DDRF = 0x00; PORTG = 0x00; DDRG = 0x00; } //call this routine to initialize all peripherals void init_devices(void) { //stop errant interrupts until set up CLI(); //disable all interrupts XDIV = 0x00; //xtal divider XMCRA = 0x00; //external memory port_init(); MCUCR = 0x80; EICRA = 0x00; //extended ext ints EICRB = 0x00; //extended ext ints EIMSK = 0x00; TIMSK = 0x00; //timer interrupt sources ETIMSK = 0x00; //extended timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialized } void delay( word del ) { int i, j; for (i=0; i<del; i++) for (j=0; j<100; j++) ; } void write_cmd( byte signal, byte cmd ) { //check_bf(); SetCS1(0); delay(10); SetCS2(0); delay(10); SetE(1); delay(10); SetE(0); delay(10); SetRW(0); delay(10); SetDI(0); delay(10); // SetCS1(0); switch(signal & CS_ALL){ case CS1: { SetCS1(1); break; } case CS2: { SetCS2(1); break; } case CS_ALL : { SetCS1(1); delay(10); SetCS2(1); break; } } delay(10); SetE(1); delay(10); LCD_OUTP = cmd; delay(10); SetE(0); delay(10); } /* 1 문자 출력 */ //signal = CS1, CS2 //cmd = data void write_data( byte signal, byte ch ) { //check_bf(); SetCS1(0); delay(10); SetCS2(0); delay(10); SetE(1); delay(10); SetE(0); delay(10); SetRW(0); delay(10); SetDI(1); delay(10); // SetCS1(0); switch(signal & CS_ALL){ case CS1: { SetCS1(1); break; } case CS2: { SetCS2(1); break; } case CS_ALL : { SetCS1(1); delay(10); SetCS2(1); break; } } delay(10); //SetCS1(signal&CS_ALL); delay(10); //SetCS2(signal&CS_ALL); delay(10); SetE(1); delay(10); LCD_OUTP = ch; delay(10); SetE(0); delay(10); } void lcd_clear(void) { byte i, j, x, y; write_cmd(CS_ALL,DISPON); write_cmd(CS_ALL,0xc0); // Display Start Line x = 0xB8; /* X start address */ y = 0x40; /* Y start address */ for(i = 0; i <=7; i++) { write_cmd(CS_ALL,x); write_cmd(CS_ALL,y); for(j = 0; j < 64; j++) { write_data(CS_ALL,0x00); /* clear CS1 and CS2 */ } x++; } } void lcd_init(void) { SetReset(0); delay(10); SetReset(1); delay(10); write_cmd( CS_ALL, DISPON ); write_cmd( CS_ALL, 0xc0 ); /* 디스플레이 시작라인 */ } void delay_us(word time_us) { register word i; for(i=0; i<time_us; i++){ // 4 cycle + asm("PUSH R0"); // 2 cycle + asm("POP R0"); // 2 cycle + asm("PUSH R0"); // 2 cycle + asm("POP R0"); // 2 cycle + asm("PUSH R0"); // 2 cycle + asm("POP R0"); // 2 cycle = 16 cycle = 1us for 16MHz } } void delay_ms(word time_ms) { register word i; for(i=0;i<time_ms;i++) delay_us(1000); } void lcd_xy( byte x, byte y ) /* set English character position on GLCD */ { xcharacter = x; /* x = 0 - 3 */ ycharacter = y; /* y = 0 - 15 */ } /*-------------------------------------------------------------------------*/ void lcd_xy_row(byte row,byte x,byte y) /* set character upper/lower row on GLCD */ { lcd_xy(x,y); /* x = 0 - 3, y = 0 - 15 */ if(row == 0) /* if upper row, set Y address */ write_cmd(CS_ALL,0xB8 + x*2); else /* if lower row, set Y address + 1 */ write_cmd(CS_ALL,0xB8 + x*2 + 1); if(ycharacter <= 7) /* if y <= 7, CS1 Y address */ write_cmd(CS1,0x40 + y*8); else /* if y >= 8, CS2 Y address */ write_cmd(CS2,0x40 + (y-8)*8); } void GLCD_English(byte Ecode) //* display a 8x16 Dot English(ASCII) on GLCD / { byte x, y, i, signal; x = xcharacter; y = ycharacter; lcd_xy_row(0,x,y); //* display upper row / if(ycharacter <= 7) //* if y <= 7, CS1 / signal = CS1; else //* if y >= 8, CS2 / signal = CS2; for(i = 0; i <= 7; i++) write_data(signal,E_font[Ecode][i]); lcd_xy_row(1,x,y); //* display lower row / if(ycharacter <= 7) //* if y <= 7, CS1 / signal = CS1; else //* if y >= 8, CS2 / signal = CS2; for(i = 8; i <= 15; i++) { if((cursor_flag == 1) && (xcharacter == cursorx) && (ycharacter == cursory)) write_data(signal,E_font[Ecode][i] | 0x80); else write_data(signal,E_font[Ecode][i]); } ycharacter++; if(ycharacter==16){ ycharacter = 0; xcharacter++; } } void GLCD_Korean(word Kcode) //* display a 16x16 Dot Korean on GLCD / { byte x, y, i, signal; byte cho_5bit, joong_5bit, jong_5bit; byte cho_bul, joong_bul, jong_bul, jong_flag; word character; if(ycharacter==15) GLCD_English(0x20); cho_5bit = table_cho[(Kcode >> 10) & 0x001F]; //* get cho, joong, jong 5 bit / joong_5bit = table_joong[(Kcode >> 5) & 0x001F]; jong_5bit = table_jong[Kcode & 0x001F]; if(jong_5bit == 0) //* don't have jongsung / { jong_flag = 0; cho_bul = bul_cho1[joong_5bit]; if((cho_5bit == 1) || (cho_5bit == 16)) joong_bul = 0; else joong_bul = 1; } else //* have jongsung / { jong_flag = 1; cho_bul = bul_cho2[joong_5bit]; if((cho_5bit == 1) || (cho_5bit == 16)) joong_bul = 2; else joong_bul = 3; jong_bul = bul_jong[joong_5bit]; } character = cho_bul*20 + cho_5bit; //* copy chosung font / for(i = 0; i <= 31; i++) Korean_buffer[i] = K_font[character][i]; character = 8*20 + joong_bul*22 + joong_5bit; //* OR joongsung font / for(i = 0; i <= 31; i++) Korean_buffer[i] |= K_font[character][i]; if(jong_flag == 1) //* if jongsung, OR jongsung font / { character = 8*20 + 4*22 +jong_bul*28 + jong_5bit; for(i = 0; i <= 31; i++) Korean_buffer[i] |= K_font[character][i]; } x = xcharacter; y = ycharacter; lcd_xy_row(0,x,y); //* display upper left row / if(ycharacter <= 7) //* if y <= 7, CS1 / signal = CS1; else //* if y >= 8, CS2 / signal = CS2; for(i = 0; i <= 7; i++) write_data(signal,Korean_buffer[i]); lcd_xy_row(1,x,y); //* display lower left row / if(ycharacter <= 7) //* if y <= 7, CS1 / signal = CS1; else //* if y >= 8, CS2 / signal = CS2; for(i = 16; i <= 23; i++) { if((cursor_flag == 1) && (xcharacter == cursorx) && (ycharacter == cursory)) write_data(signal,Korean_buffer[i] | 0x80); else write_data(signal,Korean_buffer[i]); } ycharacter++; y = ycharacter; lcd_xy_row(0,x,y); ///* display upper right row / if(ycharacter <= 7) ///* if y <= 7, CS1 / signal = CS1; else ///* if y >= 8, CS2 / signal = CS2; for(i = 8; i <= 15; i++) write_data(signal,Korean_buffer[i]); lcd_xy_row(1,x,y); //* display lower right row / if(ycharacter <= 7) //* if y <= 7, CS1 / signal = CS1; else //* if y >= 8, CS2 / signal = CS2; for(i = 24; i <= 31; i++) { if((cursor_flag == 1) && (xcharacter == cursorx) && (ycharacter == (cursory+1))) write_data(signal,Korean_buffer[i] | 0x80); else write_data(signal,Korean_buffer[i]); } ycharacter++; if(ycharacter==16){ ycharacter = 0; xcharacter++; } } /******************************************************************************* * 완성형 한글을 조합형으로 바꾸어 주는 부분입니다. *******************************************************************************/ word kssm_convert(word kssm) { byte high,low; word index; word return_data; high = (kssm>>8)&0xff; low = kssm &0xff; if ((kssm >= 0xb0a1)&&(kssm <= 0xc8fe)) { index = (high - 0xb0) * 94 + low - 0xa1; return_data = KSTable[index][0]*256; return_data |= KSTable[index][1]; return return_data; } return 0; } void lcd_string(byte x, byte y, byte *string) //* display a string on GLCD / { byte character1; word character2; lcd_xy(x,y); //* x = 0 - 3, y = 0 - 15 / while(*string != '\\0') { character1 = *string; string++; if(((character1 >> 7) & 0x01) == 0) GLCD_English(character1); //* display English character / else { character2 = *string; character2 = 256*character1 + (character2 & 0xFF); string++; character2 = kssm_convert(character2);//완성형을 조합형으로 변환 GLCD_Korean(character2); //* display Korean character / } } } void pixelL(int x, int y, int z) // Draw the current pixel { byte offset_D; word x_move, offset, chipselect; x_move = x/8; chipselect = y/64; offset = x%8; offset_D = (0x01<<offset); /* switch(offset){ case 0 : offset_D=0x01; break; case 1 : offset_D=0x02; break; case 2 : offset_D=0x04; break; case 3 : offset_D=0x08; break; case 4 : offset_D=0x10; break; case 5 : offset_D=0x20; break; case 6 : offset_D=0x40; break; case 7 : offset_D=0x80; break; } */ ch_data= offset_D; page = x/8; y_page=y; if(chipselect){ write_cmd(CS2,0xb8 + x_move); write_cmd(CS2,0x40 + y%64); ch_keep[x_move][y]|=ch_data; if(z) write_data(CS2,ch_keep[page][y_page]); } else { write_cmd(CS1,0xb8 + page); write_cmd(CS1,0x40 + y%64); ch_keep[x_move][y]|=ch_data; if(z) write_data(CS1,ch_keep[page][y_page]); } first_cnt=1; } void line(int x1, int y1, int x2, int y2){ int deltax, deltay, x, y, xinc1,xinc2, yinc1, yinc2,den, num, numadd,numpixels,curpixel; deltax = fabs(x2 - x1); // The difference between the x's deltay = fabs(y2 - y1); // The difference between the y's x = x1; // Start x off at the first pixel y = y1; // Start y off at the first pixel if (x2 >= x1){ // The x-values are increasing xinc1 = 1; xinc2 = 1; }else{ // The x-values are decreasing xinc1 = -1; xinc2 = -1; } if (y2 >= y1){ // The y-values are increasing yinc1 = 1; yinc2 = 1; }else{ // The y-values are decreasing yinc1 = -1; yinc2 = -1; } if (deltax >= deltay){ // There is at least one x-value for every y-value xinc1 = 0; // Don't change the x when numerator >= denominator yinc2 = 0; // Don't change the y for every iteration den = deltax; num = deltax / 2; numadd = deltay; numpixels = deltax; // There are more x-values than y-values }else{ // There is at least one y-value for every x-value xinc2 = 0; // Don't change the x for every iteration yinc1 = 0; // Don't change the y when numerator >= denominator den = deltay; num = deltay / 2; numadd = deltax; numpixels = deltay; // There are more y-values than x-values } for (curpixel = 0; curpixel <= numpixels; curpixel++){ pixelL(x, y, ON); // Draw the current pixel num += numadd; // Increase the numerator by the top of the fraction if (num >= den){ // Check if numerator >= denominator num -= den; // Calculate the new numerator value x += xinc1; // Change the x as appropriate y += yinc1; // Change the y as appropriate } x += xinc2; // Change the x as appropriate y += yinc2; // Change the y as appropriate } } void rectangle(int startx, int starty, int endx, int endy){ line(endx,starty,endx,endy); line(startx,starty,endx,starty); line(startx,starty,startx,endy); line(startx,endy,endx,endy); } void circle(int xCenter, int yCenter, int radius){ int x, y, r2; r2 = radius * radius; pixelL(xCenter, yCenter + radius, ON); pixelL(xCenter, yCenter - radius, ON); for (x = 1; x <= radius; x++) { y = (int) (sqrt(r2 - x*x) + 0.5); pixelL(xCenter + x, yCenter + y, ON); pixelL(xCenter - x, yCenter + y, ON); pixelL(xCenter + x, yCenter - y, ON); pixelL(xCenter - x, yCenter - y, ON); } } void main(void) { byte i, j, x, y; init_devices(); lcd_init(); lcd_clear(); rectangle( 10, 10, 30,45); while(1){ lcd_string(0,0," 그래픽 시간 "); lcd_string(1,0," FUNNY DAY "); lcd_string(2,0," GOOD DAY "); lcd_string(3,0," BE HAPPY !!!"); delay_ms(1000); lcd_clear(); rectangle( 10, 10, 30,45); delay_ms(1000); circle(30,20,15); delay_ms(1000); line(10,20,30,100); delay_ms(1000); rectangle( 20, 15, 50,110); delay_ms(1000); for(i=0; i<7; i++) for(j=0; j<128; j++) ch_keep[i][j]=0x00; lcd_clear(); } // write_cmd( CS1, 0xc0 ); /* 디스플레이 시작라인 */ /* y_0=0x40 , x_0=0xb8 */ // x = 0xB8; /* X start address */ // y = 0x40; /* Y start address */ /* for(i = 0; i <=7; i++) { write_cmd(CS1,x); write_cmd(CS1,y); for(j = 0; j < 64; j++) { write_data(CS1,0x11); /* - - */ /* } x++; } */
관리자 답변 관리자 · 2026-10-14
안녕하세요, 뉴티씨입니다. 문의 내용 확인하였습니다. 추가 문의사항은 [email protected] 또는 02-704-4774로 연락 주시기 바랍니다. 감사합니다.
694 답변완료[소스]kt-m128.GLCD를 이용한 빙고게임 안양박 2008-01-10 2,396
교육용보드인 kt-m128의 그래픽 lcd를 이용해 빙고게임을 만들어봤습니다. 지금은 j변수를 변경함으로써 몇번돌린후 멈추게 되어있습니다. 앞으로 uart 통신을 이용해서 점수계산등 여러가지 기능을 추가해 성인오락실의 과일나라 수준으로 만드는게 목표입니다. 자주 업데이터 하겠습니다..꾸벅.. //ICC-AVR application builder : 2008-01-07 오후 1:54:02 // Target : M128 // Crystal: 16.000Mhz #include <iom128v.h> #include <macros.h> #define LCD_Control (* (volatile unsigned char *) 0x8001) #define LCD_Data (* (volatile unsigned char *) 0x8000) #define RS_ON LCD_Control = (LCD_Controller|=0x01) #define RS_OFF LCD_Control = (LCD_Controller&=0xfe) #define RW_ON LCD_Control = (LCD_Controller|=0x02) #define RW_OFF LCD_Control = (LCD_Controller&=0xfd) #define EN_ON LCD_Control = (LCD_Controller|=0x04) #define EN_OFF LCD_Control = (LCD_Controller&=0xfb) #define CS2_ON LCD_Control = (LCD_Controller|=0x10) #define CS2_OFF LCD_Control = (LCD_Controller&=0xef) #define CS1_ON LCD_Control= (LCD_Controller|=0x08) #define CS1_OFF LCD_Control = (LCD_Controller&=0xf7) #define RESET_ON LCD_Control= (LCD_Controller|=0x20) #define RESET_OFF LCD_Control= (LCD_Controller&=0xdf) #define CS_ALL LCD_Control= (LCD_Controller|=0x18) #define ON 1 #define OFF 0 #define delaytime 1 #define delaytime1 2 char LCD_Controller; const char x=0xb8, y=0x40; int status=0 ; char compare[8][128]={0x00,}; void port_init(void) { PORTA = 0x00; DDRA = 0x00; PORTB = 0x00; DDRB = 0x00; PORTC = 0x00; //m103 output only DDRC = 0x00; PORTD = 0x00; DDRD = 0x00; PORTE = 0x00; DDRE = 0x00; PORTF = 0x00; DDRF = 0x00; PORTG = 0x00; DDRG = 0x00; } void uart1_init(void) { UCSR1B = 0x00; //disable while setting baud rate UCSR1A = 0x00; UCSR1C = 0x00; UBRR1L = 0x67; //set baud rate lo UBRR1H = 0x00; //set baud rate hi UCSR1B = 0x90; } #pragma interrupt_handler uart1_rx_isr:31 void uart1_rx_isr(void) { status++; } //call this routine to initialize all peripherals void init_devices(void) { //stop errant interrupts until set up CLI(); //disable all interrupts XDIV = 0x00; //xtal divider XMCRA = 0x00; //external memory port_init(); uart1_init(); MCUCR = 0x80; EICRA = 0x00; //extended ext ints EICRB = 0x00; //extended ext ints EIMSK = 0x00; TIMSK = 0x00; //timer interrupt sources ETIMSK = 0x00; //extended timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialized } void E_Pulse(void){ EN_ON; delay(delaytime); EN_OFF; } void BackLight(int onoff){ if(onoff==ON) LCD_Control |= 0x40; else LCD_Control &= 0xbf; } void DisplayOnOff(int onoff){ RW_OFF; RS_OFF; if(onoff==ON){ DataInput(0x3F); }else{ DataInput(0x3E); } } void DataInput(char data){ RS_OFF; RW_OFF; LCD_Control = data; E_Pulse(); } void DisplayStartLine(int displayline){ DataInput(displayline | 0xc0); } void SetX(int X){ DataInput(X | 0xb8); } void SetY(int Y){ DataInput(Y | 0x40); } /*char Read_Status(void){ char status; RW_ON; RS_OFF; status=(LCD_Control & 0xb0); E_Pulse(); return(status); }*/ void Reset(void){ DataInput(0x10); } void Init_Graph(void){ CS2_ON; CS1_ON; DisplayOnOff(ON); Reset(); } void delay(int cnt){ int i , j; for(i=0; i<cnt; i++){ for(j=0; j<100; j++) ; } } /*void Check_BF(void){ while(Read_Status()&0x80); }*/ char Read_Data(void){ char data; //Check_BF(); CS_ALL; RS_ON; RW_ON; EN_ON; delay(delaytime); data = LCD_Data; EN_OFF; delay(delaytime); return data; } void Write_Control(char CS, char cmd){ //Check_BF(); delay(delaytime); EN_OFF; delay(delaytime); RS_OFF; delay(delaytime); RW_OFF; delay(delaytime); LCD_Control = CS; delay(delaytime); EN_ON; delay(delaytime); LCD_Data = cmd; delay(delaytime); EN_OFF; delay(delaytime); } /*char getchar(){ return tmp; }*/ int putchar(data){ Write_Data(CS_ALL, data); } void Write_Data(char CS, char data){ //Check_BF(); delay(delaytime); EN_OFF; delay(delaytime); RS_ON; delay(delaytime); RW_OFF; delay(delaytime); LCD_Control = CS; delay(delaytime); EN_ON; delay(delaytime); LCD_Data = data; delay(delaytime); EN_OFF; delay(delaytime); } void Lcd_Clear(){ int i, j, x, y; LCD_Control = 0x00; Write_Control(CS_ALL, 0x3f); Write_Control(CS_ALL, 0xc0); x=0xb8; y=0x40; for(i=0; i<=7; i++){ Write_Control(CS_ALL, x); Write_Control(CS_ALL, y); for(j=0; j<64; j++){ Write_Data(CS_ALL, 0x00);} x++; } } void Lcd_init(){ RESET_OFF; RESET_ON; CS_ALL; Write_Control(CS_ALL, 0x3f); Write_Control(CS_ALL, 0xc0); Write_Control(CS_ALL, 0xb8); Write_Control(CS_ALL, 0x40); } void gotoxy(int i, int j, char data){ int x1=i%128, y1=j%8; if(x1<64){ Write_Control(CS_ALL, x+y1); Write_Control(CS_ALL, y+x1); Write_Data(CS2_OFF, data); } else { Write_Control(CS_ALL, x+y1); Write_Control(CS_ALL, y+x1-64); Write_Data(CS1_OFF, data); } } void PointXY(int xpoint, int ypoint){ int point=0x01, value; int x1, y1, y2, y3; x1=xpoint%128; y1=ypoint%64; y2=y1/8; y3=y1%8; compare[y2][x1]|=(point<<y3); value=compare[y2][x1]; if(x1<64){ Write_Control(CS_ALL, x+y2); Write_Control(CS_ALL, y+x1); Write_Data(CS2_OFF, value);} else { Write_Control(CS_ALL, x+y2); Write_Control(CS_ALL, y+x1-64); Write_Data(CS1_OFF, value);} } void Point_Del(int xpoint, int ypoint){ int point=0x01, value; int x1, y1, y2, y3; x1=xpoint%128; y1=ypoint%64; y2=y1/8; y3=y1%8; compare[y2][x1]&=(~(point<<y3)); value=compare[y2][x1]; if(x1<64){ Write_Control(CS_ALL, x+y2); Write_Control(CS_ALL, y+x1); Write_Data(CS2_OFF, value);} else { Write_Control(CS_ALL, x+y2); Write_Control(CS_ALL, y+x1-64); Write_Data(CS1_OFF, value);} } void Draw_Line(int X0, int Y0, int X1, int Y1){ int x0=X0, y0=Y0, x1=X1, y1=Y1; int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; PointXY(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; PointXY(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; PointXY(x0, y0); } } } void Line_Del(int X0, int Y0, int X1, int Y1){ int x0=X0, y0=Y0, x1=X1, y1=Y1; int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy; if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; } if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; } dy <<= 1; dx <<= 1; Point_Del(x0, y0); if (dx > dy) { int fraction = dy - (dx >> 1); while (x0 != x1) { if (fraction >= 0) { y0 += stepy; fraction -= dx; } x0 += stepx; fraction += dy; Point_Del(x0, y0); } } else { int fraction = dx - (dy >> 1); while (y0 != y1) { if (fraction >= 0) { x0 += stepx; fraction -= dy; } y0 += stepy; fraction += dx; Point_Del(x0, y0); } } } void Draw_Rect(int x1, int y1, int x2, int y2, int fill){ if(fill==1){ if(x1<x2){ for(x1; x1<=x2; x1++){ Draw_Line(x1,y1,x1,y2);} } else { for(x1; x1>=x2; x1--){ Draw_Line(x1,y1,x1,y2);} }} else { Draw_Line(x1,y1,x1,y2); Draw_Line(x1,y1,x2,y1); Draw_Line(x2,y2,x2,y1); Draw_Line(x2,y2,x1,y2); } } void Rect_Del(int x1, int y1, int x2, int y2){ if(x1<x2){ for(x1; x1<=x2; x1++){ Line_Del(x1,y1,x1,y2);} } else { for(x1; x1>=x2; x1--){ Line_Del(x1,y1,x1,y2);} } } void Draw_Circle(int x1, int y1, int radius, int fill){ int a, r, cond; a = 0; r = radius; cond = 1 - r; do{ if(fill==1){ Draw_Line(x1-a, y1+r, x1+a, y1+r); Draw_Line(x1-a, y1-r, x1+a, y1-r); Draw_Line(x1-r, y1+a, x1+r, y1+a); Draw_Line(x1-r, y1-a, x1+r, y1-a); } else { PointXY(a+x1, r+y1); PointXY(r+x1, a+y1); PointXY(x1-a, r+y1); PointXY(x1-r, a+y1); PointXY(x1+r, y1-a); PointXY(x1+a, y1-r); PointXY(x1-a, y1-r); PointXY(x1-r, y1-a); } if(cond < 0){ cond += 3 + 2*a++; } else {cond+= 5 + 2*(a++ - r--);} }while(a <= r); } void Circle_Del(int x1, int y1, int radius){ int a, r, cond; a = 0; r = radius; cond = 1 - r; do{ Line_Del(x1-a, y1+r, x1+a, y1+r); Line_Del(x1-a, y1-r, x1+a, y1-r); Line_Del(x1-r, y1+a, x1+r, y1+a); Line_Del(x1-r, y1-a, x1+r, y1-a); if(cond < 0){ cond += 3 + 2*a++; } else {cond+= 5 + 2*(a++ - r--);} }while(a <= r); } void main(void) { int i, j, k, on=1, off=0; char temp; int arr[17][4]={{13,3,29,19},{55,24,71,40},{98,45,114,61}, {55,3,71,19},{98,3,114,19},{13,24,29,40},{98,24,114,40}, {13,45,29,61},{55,45,71,61},{55,24,71,40},{13,3,29,19}, {55,24,71,40},{98,45,114,61},{55,3,71,19},{98,3,114,19}, {13,24,29,40},{98,24,114,40}}; int arr1[15][2]={{21,11},{21,32},{21,53},{63,11},{63,32},{63,53}, {106,11},{106,32},{106,53},{21,11},{21,53},{63,11},{63,53}, {106,11},{106,53}}; init_devices(); Lcd_init(); Lcd_Clear(); Draw_Line(1,0,126,0); Draw_Line(1,21,126,21); Draw_Line(1,42,126,42); Draw_Line(1,63,126,63); Draw_Line(0,0,0,63); Draw_Line(42,0,42,63); Draw_Line(84,0,84,63); Draw_Line(127,0,127,63); Draw_Circle(106,32,8,off); Draw_Circle(106,53,8,on); Draw_Rect(55,4,71,18,on); Draw_Rect(55,46,71,60,off); Draw_Rect(98,4,114,18,off); Draw_Circle(63,32,8,off); Draw_Rect(55,24,71,40,off); Draw_Circle(21,11,8,off); Draw_Circle(21,32,8,on); Draw_Rect(13,46,29,60,on); while(1){ for(j=0;j<100;j++){ i=j%12; k=j%10; Draw_Line(arr[i][0],arr[i][1],arr[i][2],arr[i][3]); Draw_Line(arr[i][0],arr[i][3],arr[i][2],arr[i][1]); Draw_Rect(arr[k][0],arr[k][1],arr[k][2],arr[k][3],1); Draw_Circle(arr1[k][0],arr1[k][1],8,on); Circle_Del(arr1[k+3][0],arr1[k+3][1],8); Line_Del(arr[i+3][0],arr[i+3][1],arr[i+3][2],arr[i+3][3]); Line_Del(arr[i+1][0],arr[i+1][3],arr[i+1][2],arr[i+1][1]); Draw_Rect(arr[k+3][0],arr[k+3][1],arr[k+3][2],arr[k+3][3],1); Draw_Circle(arr1[i][0],arr1[i][1],8,on); Rect_Del(arr[k+5][0],arr[k+5][1],arr[k+5][2],arr[k+5][3]); Rect_Del(arr[k+3][0],arr[k+3][1],arr[k+3][2],arr[k+3][3]); Circle_Del(arr1[i+2][0],arr1[i+2][1],8); } } }
관리자 답변 관리자 · 2026-10-14
안녕하세요, 뉴티씨입니다. 문의 내용 확인하였습니다. 추가 문의사항은 [email protected] 또는 02-704-4774로 연락 주시기 바랍니다. 감사합니다.
693 답변완료물건발송은언제쯤..? 정재덕 2008-01-10 2,151
확인부탁드립니다.
관리자 답변 N.T.C · 2008-01-10
안녕하세요? 저희 뉴테크놀로지 컴패니 제품을 이용해 주셔서 감사드립니다. 어제 주문 주시고, 입금하신 사항은 어제 발송했습니다. 감사합니다.
692 답변완료이번에는 타이머 관련 문의 입니다.. 조정교 2008-01-10 2,472
역시나 초보가 뭘 하나 해볼려하니 버겁습니다.. 정확한 개념없이 진행할려니.. 이런 저런 어려움이 많이 있네요^^; 이번엔 다름이 아니오라.. 타이머 관련내용인데요.. 책을 아무리 봐도.. 잘 모르겠습니다 ㅡㅡ 다른분들이 작성해둔 소스를 봐도 이해가 안되는구요.. 우선 초, 분, 시를 체크해서 초, 분, 시 단위로 비교, 연산하는 프로그램을 만들려고 하는중인데요.. 헤더파일을 뭘 써야 할지도 모르겠습니다 ㅡㅜ 죄송합니다만.. 사용되는 헤더파일이랑.. 초, 분, 시를 검출하는 방법만 좀 알려주시면 안되겠습니까.. 검출만 되면 나머지는 해결이 가능할것 같습니다... 매번 드리는 말씀이지만.. 바쁘신데.. 항상 지원해주셔서 너무나 감사 하고요.. 이번에도 빠른 답변을 기대 합니다.. 그럼 수고하십시요..
관리자 답변 N.T.C · 2008-01-11
안녕하세요? 조정교님, 밑에 있어서 미쳐 보지 못하고 이제야 질문을 보게 되었네요. 초, 분, 시를 DS1307 같은 RTC(Real time clock)를 사용하는 것이 좋겠구요. 아니면 DS1302 같은 걸 쓰셔도 되구요. DS1307의 경우 I2C를 사용하고 있습니다. DS1307의 경우 강좌 쪽에 보시면 I2C로 제어하는 관련된 부분 강의가 있을 겁니다. 참고하세요. 감사합니다.
691 답변완료적극적인 지원 감사드립니다. 정재덕 2008-01-09 2,246
이번에 많이 배우네요.. 많은 도움을 주셔서 번거러울텐데도 확인해주시네요 감사드립니다, 사업 번창하시고 세해 복 많이 받으세요
관리자 답변 N.T.C · 2008-01-09
언제든 질문 있으시면 이 곳에 질문해 주시면, 답변 드리도록 하겠습니다. 감사합니다.
690 답변완료[소스] KT-M128용 GLCD초기화및 글자나타내기.. 안양박 2008-01-09 2,606
그래픽 lcd 를 배우면서 처음으로 짜본 소스입니다. 참고하시길... //ICC-AVR application builder : 2008-01-07 오후 1:54:02 // Target : M128 // Crystal: 16.000Mhz #include <iom128v.h> #include <macros.h> #define LCD_Control (* (volatile unsigned char *) 0x8001) #define LCD_Data (* (volatile unsigned char *) 0x8000) #define RS_ON LCD_Control = (LCD_Controller|=0x01) #define RS_OFF LCD_Control = (LCD_Controller&=0xfe) #define RW_ON LCD_Control = (LCD_Controller|=0x02) #define RW_OFF LCD_Control = (LCD_Controller&=0xfd) #define EN_ON LCD_Control = (LCD_Controller|=0x04) #define EN_OFF LCD_Control = (LCD_Controller&=0xfb) #define CS2_ON LCD_Control = (LCD_Controller|=0x10) #define CS2_OFF LCD_Control = (LCD_Controller&=0xef) #define CS1_ON LCD_Control= (LCD_Controller|=0x08) #define CS1_OFF LCD_Control = (LCD_Controller&=0xf7) #define RESET_ON LCD_Control= (LCD_Controller|=0x20) #define RESET_OFF LCD_Control= (LCD_Controller&=0xdf) #define CS_ALL LCD_Control= (LCD_Controller|=0x18) #define ON 1 #define OFF 0 #define delaytime 2 #define delaytime1 5 char LCD_Controller; void port_init(void) { PORTA = 0x00; DDRA = 0x00; PORTB = 0x00; DDRB = 0x00; PORTC = 0x00; //m103 output only DDRC = 0x00; PORTD = 0x00; DDRD = 0x00; PORTE = 0x00; DDRE = 0x00; PORTF = 0x00; DDRF = 0x00; PORTG = 0x00; DDRG = 0x00; } //call this routine to initialize all peripherals void init_devices(void) { //stop errant interrupts until set up CLI(); //disable all interrupts XDIV = 0x00; //xtal divider XMCRA = 0x00; //external memory port_init(); MCUCR = 0x80; EICRA = 0x00; //extended ext ints EICRB = 0x00; //extended ext ints EIMSK = 0x00; TIMSK = 0x00; //timer interrupt sources ETIMSK = 0x00; //extended timer interrupt sources SEI(); //re-enable interrupts //all peripherals are now initialized } void E_Pulse(void){ EN_ON; delay(delaytime); EN_OFF; } void BackLight(int onoff){ if(onoff==ON) LCD_Control |= 0x40; else LCD_Control &= 0xbf; } void DisplayOnOff(int onoff){ RW_OFF; RS_OFF; if(onoff==ON){ DataInput(0x3F); }else{ DataInput(0x3E); } } void DataInput(char data){ RS_OFF; RW_OFF; LCD_Control = data; E_Pulse(); } void DisplayStartLine(int displayline){ DataInput(displayline | 0xc0); } void SetX(int X){ DataInput(X | 0xb8); } void SetY(int Y){ DataInput(Y | 0x40); } char Read_Status(void){ char status; RW_ON; RS_OFF; status=(LCD_Control & 0xb0); E_Pulse(); return(status); } void Reset(void){ DataInput(0x10); } void Init_Graph(void){ CS2_ON; CS1_ON; DisplayOnOff(ON); Reset(); } void delay(int cnt){ int i , j; for(i=0; i<cnt; i++){ for(j=0; j<100; j++) ; } } void Check_BF(void){ while(Read_Status()&0x80); } char Read_Data(void){ char data; Check_BF(); CS_ALL; RS_ON; RW_ON; EN_ON; delay(delaytime); } void Write_Control(char CS, char cmd){ //Check_BF(); delay(delaytime); EN_OFF; delay(delaytime); RS_OFF; delay(delaytime); RW_OFF; delay(delaytime); LCD_Control = CS; delay(delaytime); EN_ON; delay(delaytime); LCD_Data = cmd; delay(delaytime); EN_OFF; delay(delaytime); } void Write_Data(char CS, char data){ //Check_BF(); delay(delaytime); EN_OFF; delay(delaytime); RS_ON; delay(delaytime); RW_OFF; delay(delaytime); LCD_Control = CS; delay(delaytime); EN_ON; delay(delaytime); LCD_Data = data; delay(delaytime); EN_OFF; delay(delaytime); } void Lcd_Clear(){ int i, j, x, y; LCD_Control = 0x00; Write_Control(CS_ALL, 0x3f); Write_Control(CS_ALL, 0xc0); x=0xb8; y=0x40; for(i=0; i<=7; i++){ Write_Control(CS_ALL, x); Write_Control(CS_ALL, y); for(j=0; j<64; j++){ Write_Data(CS_ALL, 0x00);} x++; } } void Lcd_init(){ RESET_OFF; RESET_ON; CS_ALL; Write_Control(CS_ALL, 0x3f); Write_Control(CS_ALL, 0xc0); Write_Control(CS_ALL, 0xb8); Write_Control(CS_ALL, 0x40); } void main(void) {/* int i,j,x=0xb8,y=0x40; unsigned char arr[8][8]={{0xE0,0xE0,0xF8,0x1C,0x1C,0xF8,0xE0,0xE0},{0x00, 0x00,0x04,0x07,0x07,0x04,0x00,0x00},{0x60,0xF0,0xF8,0xFC,0xFC,0xF8,0xF0,0x60},{ 0x00,0x00,0x04,0x07,0x07,0x04,0x00,0x00},{0xE0,0xE0,0xF8,0x1C,0x1C,0xF8,0xE0,0xE0}, {0x00,0x00,0x04,0x07,0x07,0x04,0x00,0x00},{0x60,0xF0,0xF8,0xFC,0xFC,0xF8,0xF0,0x60}, {0x00,0x00,0x04,0x07,0x07,0x04,0x00,0x00}}; init_devices(); Lcd_init(); BackLight(ON); Lcd_Clear(); for(i=0; i<=7; i++){ Write_Control(CS_ALL, x); Write_Control(CS_ALL, y); for(j=0; j<64; j++){ if(i%2){ Write_Data(CS1_OFF, 0xc3);} else { Write_Data(CS2_OFF, arr[i][j]);} } x++; }*/ int i,j,x=0xb8,y=0x40; unsigned char left[]={0x00,0x00,0x04,0xFC,0xFC,0x04,0x00,0x00, 0x04,0xFC,0xFC,0x04,0x00,0x00,0x00,0x00, 0xF8,0xFC,0x04,0x04,0x04,0xFC,0xF8,0x00, 0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0x00, 0x04,0xFC,0xFC,0x44,0xE4,0x0C,0x1C,0x00, 0x00,0x3C,0x7C,0xC0,0xC0,0x7C,0x3C,0x00, 0xF8,0xFC,0x04,0x04,0x04,0xFC,0xF8,0x00, 0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0x00}; unsigned char right[]={0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00, 0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0x00, 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00, 0x01,0x03,0x06,0x0C,0x06,0x03,0x01,0x00, 0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0x00, 0x00,0x00,0x08,0x0F,0x0F,0x08,0x00,0x00, 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00, 0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0x00 }; init_devices(); Lcd_init(); BackLight(ON); Lcd_Clear(); for(i=0; i<8; i++){ Write_Control(CS_ALL, x); Write_Control(CS_ALL, y); for(j=0; j<64; j++){ switch(i){ case 0: Write_Data(CS2_OFF, left[j]); break; case 1: Write_Data(CS1_OFF, right[j]); break; case 2: Write_Data(CS2_OFF, left[j]); break; case 3: Write_Data(CS2_OFF, right[j]); break; case 4: Write_Data(CS1_OFF, left[j]); break; case 5: Write_Data(CS1_OFF, right[j]); break; case 6: Write_Data(CS_ALL, left[j]); break; case 7: Write_Data(CS_ALL, right[j]); break; default : break;} } x++; } }
관리자 답변 관리자 · 2026-10-14
안녕하세요, 뉴티씨입니다. 문의 내용 확인하였습니다. 추가 문의사항은 [email protected] 또는 02-704-4774로 연락 주시기 바랍니다. 감사합니다.
689 답변완료 AD-JTAG 연결 다시 질문이요. 이동규 2008-01-08 2,248
컴퓨터에 있던 관련 소프트웨어 다 밀고, ICCV7 for AVR aStudio4b528 서비스팩 SP2 이렇게 깔았습니다. 그래도 위와 같은 메세지가 뜨네요 ㅜ_ㅜ
관리자 답변 N.T.C · 2008-01-08
안녕하세요? 이동규님, 현 상황에서 정상이라면 동작해야 합니다. 그렇다면 JTAG에 이상이 생긴 것이 아닌가 생각됩니다. A/S를 받으셔야 할 것 같습니다. 회사로 전화 부탁드립니다. 감사합니다.
688 답변완료AVR AD-ISP 구입하였는데요. AVR8545 2008-01-08 2,154
금일 용산에서 AD-ISP 구입을 하였는데요. AVR AD-ISP 칩이 있는 윗면에서 보터 MOSI MISO SCK RST GND VCC 보는데로 핀 배치가 이렇게 되나요?
관리자 답변 N.T.C · 2008-01-08
안녕하세요? 저희 뉴테크놀로지 컴패니 제품을 이용해 주셔서 감사드립니다. 순서는 맞습니다. 뒷면에 보시면 6핀 중에 GND랑 붙어 있는 핀이 있습니다. 부챗살 모양으로 살이 붙어 있지요. 그 핀이 GND 핀으로 5번핀입니다. 그걸 기준으로 보시면 편합니다. 감사합니다.
687 답변완료[예제] Text LCD 구현 정재환 2008-01-08 2,261
kd128과 ktm-128의 예제입니다. kd128은 텍스트lcd 두줄을 자동 줄바꿈하면서 글씨를 쓴 수만큼 FND로 카운트합니다. ktm-128은 텍스트lcd에 글씨를 쓰고 백스페이스로 지우고 엔터키로 줄바꿈할 수 있습니다. 어설프지만.. ktm-128에도 fnd 카운트를 할려고했으나 게을러서 패스. ktm-128 소스를 수정해서 완벽하게 삭제와 줄바꿈 기능을 구현해도 쓸만할거 같네요.
관리자 답변 N.T.C · 2008-01-08
좋은 소스 올려 주셔서 감사합니다. 공부하시면서 서로 도움이 되실 것 같습니다. 많이 참고하세요.
686 답변완료설정관련.. 정재덕 2008-01-08 1,833
.
관리자 답변 N.T.C · 2008-01-08
연락드리겠습니다. 감사합니다.
685 답변완료USB ISP 에 대해 질문이요 김원희 2008-01-08 2,459
안녕하세요 AVR Mega128pro 키트 랑, AVR 용USB-ISP 샀는데요.... In System Programming 에서 ISP option 에 들어가서 stk500.exe 파일을 눌러야 하는데.. stk500.exe 파일이 홈페이지에서 어디에 있나요? 자료실에도 없는거 같은데.. 그리고 계속 CANNOT VERIFY FLASH 라고 나옵니다. 어떻게 해야 되나요?
관리자 답변 N.T.C · 2008-01-08
안녕하세요? 고객님, 저희 뉴테크놀로지 컴패니 제품을 이용해 주셔서 감사드립니다. 말씀하신 STK500.exe는 AVR Studio를 설치하여야 그 안에 있습니다. 우선, www.atmel.com에 가셔서 AVR Studio를 치시고, AVR Studio 4.13과 서비스팩 1, 2를 다운로드 받으세요. 4.13을 먼저 설치하시고, 서비스팩 1, 2를 차례로 설치하세요. 그러면, C:\\Program Files\\Atmel\\AVR Tools\\STK500 에 보시면 stk500.exe가 있습니다. 그걸 설치하시고, COM 포트를 맞추셔야 정상동작하고, cannot verify flash와 같은 에러 메시지가 나오지 않습니다. 본 AVR USBISP는 stk500 프로토콜을 따라서 만든 것이라서, stk500.exe가 반드시 있어야 합니다. 감사합니다.
684 답변완료AD-JTAG 연결 질문이요. 이동규 2008-01-07 2,163
현재 상황 PC -> USP to Serial -> Female to Female -> AD-JTAG -> KD128PRO 이렇게 연결되어 있고 AVRStudio 4.12 SP4 사용 중인데 위에 그림과 같은 상태입니다.(그림 먼저 올려주신분 ㄳ) 왜이럴까요.
관리자 답변 N.T.C · 2008-01-08
안녕하세요? 고객님, 현재 판매중인 AD-JTAG는 AVR Studio 4.13 버전에 맞게 업그레이드 되어져서 나가고 있습니다. AVR Studio를 4.13 으로 업버전해서 쓰시면 문제 없으실것 같습니다. AVR Studio는 www.atmel.com에서 AVR studio로 검색하셔서 다운로드 하시면 됩니다. 서비스팩도 깔아주세요. 감사합니다.