스테핑모터 -1상 여자방식 #include #include int i ; unsigned char motor_phase[4] = { 0x08, 0x04, 0x02, 0x01 } ; // 2상 여자 방식 void main ( void ) { DDRC=0xff; for ( i = 0 ; i 더보기 스테핑모터 - 시뮬 #include unsigned int cnt0; unsigned char step=0x88, onoff=1; interrupt [EXT_INT0] void exint0(void) { if(onoff == 0) onoff = 1; else onoff = 0; } interrupt [TIM0_OVF] void timerint0(void) { if(onoff == 0) if( ++cnt0 == 2 ) { cnt0 = 0; step >>= 1; if(step == 0x08) step=0x88; } PORTC = step; TCNT0 = 6; // 재정의 1msec = 64*(256-6)/16 시뮬레이션할 때는 조절할 필요가 있음 } void main(void) { DDRC = 0xff; // 포트C를 출력으로.. 더보기 LCD 구구단 시뮬레이션 #include #include #include #asm .equ __lcd_port=0x15 ;포트A #endasm #include void main(void){ char buf[20]; int a,b; lcd_init(16); // lcd초기화 lcd_gotoxy(0, 0); lcd_putsf("Park-Jae-Hyun"); // 첫째줄 표시 while(1){ for(a=2;a 더보기 이전 1 ··· 8 9 10 11 12 13 14 ··· 30 다음