BASIC4MCU | 질문게시판 | 답변 : 답변 : 사진과 구동 영상으로 다시 질문하겠습니다!
페이지 정보
작성자 master 작성일2019-12-27 23:37 조회3,170회 댓글0건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=11434
본문
// MCU BASIC: https://www.basic4mcu.com// DateTime : 2019-12-27 오후 11:38:38// by Ok-Hyun Park//#include <mega128.h>#include <delay.h>#include <stdio.h>//#define LINE2 0xC0 // 2nd Line Move#define HOME 0x02 // Cursor Home#define RSHIFT 0x1C // Display Right Shift#define LSHIFT 0x18 // Display Left Shift#define DISPON 0x0c // Display On#define DISPOFF 0x08 // Display Off//char str[30];int a,Volt10,rot=375;//LCD 함수는 여기에 넣으세요//interrupt [TIM3_COMPA] void timer3_compa_isr(void){ // 500msstatic char c=0;a=ADCW;Volt10=(int)((float)a*50./1023.0+0.5);//sprintf(str,"Value: %d.%d[V]",Volt10/10,Volt10%10);Command(LINE2); LCD_String(str);//Command(HOME);//if(Volt10<=40){TCCR1A=0x00; OCR1A=2777; PORTA=0; LCD_String(" ");}else{TCCR1A=0x40;c^=1;if(c){ PORTA=0x00; OCR1A=2082; LCD_String("fire!!!"); }else { PORTA=0xff; OCR1A=2777; LCD_String(" "); }}//if (Volt10<=15){ rot+=1; if(rot>475)rot=475; OCR1A=rot; }else if(Volt10<=30){ rot+=2; if(rot>475)rot=475; OCR1A=rot; }else if(Volt10<=40){ rot+=4; if(rot>475)rot=475; OCR1A=rot; }}//void main(void){DDRB=0xff;LCD_init();TCCR1A=0x00; TCCR1B=0x0a; ICR1=0x09c3; OCR1A=375;TCCR3B=0x0C; OCR3AH=31249>>8; OCR3AL=31249&0xFF; ETIMSK=0x10; //500msADCSRA=0xE7;SREG=0x80;while(1);}
댓글 0
조회수 3,170등록된 댓글이 없습니다.