اگه ممکنه این کد رو به زبان basic ترجمه کنید! :job:
در صورتی که کسی کد آماده به زبان بیسیک برای دریافت و تبدیل کد DTMF از mt8870 داشته باشه که خیلی بهتره!
قبلاً از کمکتون ممنونم
در صورتی که کسی کد آماده به زبان بیسیک برای دریافت و تبدیل کد DTMF از mt8870 داشته باشه که خیلی بهتره!
قبلاً از کمکتون ممنونم
کد:
#include <mega16.h> // Alphanumeric LCD Module functions #asm .equ __lcd_port=0x18 #endasm #include <lcd.h> #include <delay.h> #define soundp PORTA.5 #define cd PORTA.4 #define ringing PINA.6 #define TLED PORTD.7 int i; // External Interrupt 0 service routine interrupt [EXT_INT0] void ext_int0_isr(void) { i=0; lcd_gotoxy(6,1); switch(PINA & 0x0F) { case 10: lcd_putchar('0'); break; case 11: lcd_putchar('*'); TLED=1; break; case 12: lcd_putchar('#'); TLED=0; break; case 13: lcd_putchar('A'); break; case 14: lcd_putchar('B'); break; case 15: lcd_putchar('C'); break; case 0: lcd_putchar('D'); break; default: lcd_putchar('0' + (PINA & 0x0F)); } } void beep() { int n; while(n<7000) { soundp = !soundp; delay_us(400); n++; } } void main(void) { // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func0=In Func1=In Func2=In Func3=In Func4=Out Func5=Out Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=0 State5=0 State6=T State7=T PORTA=0x00; DDRA=0x30; // Port B initialization // Func0=In Func1=In Func2=In Func3=Out Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=1 State4=T State5=T State6=T State7=T PORTB=0x08; DDRB=0x08; // Port C initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=In // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=T PORTC=0x00; DDRC=0x00; // Port D initialization // Func0=In Func1=In Func2=In Func3=In Func4=In Func5=In Func6=In Func7=Out // State0=T State1=T State2=T State3=T State4=T State5=T State6=T State7=0 PORTD=0x00; DDRD=0x80; // Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=FFh // OC0 output: Disconnected TCCR0=0x00; TCNT0=0x00; OCR0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: Timer 1 Stopped // Mode: Normal top=FFFFh // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer 2 Stopped // Mode: Normal top=FFh // OC2 output: Disconnected ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: On // INT0 Mode: Rising Edge // INT1: Off // INT2: Off GICR|=0x40; MCUCR=0x03; MCUCSR=0x00; GIFR=0x40; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x00; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off // Analog Comparator Output: Off ACSR=0x80; SFIOR=0x00; // LCD module initialization lcd_init(16); // Global enable interrupts #asm("sei") lcd_putsf("MT8870 Project"); delay_ms(1000); lcd_clear(); lcd_putsf("Ready"); while (1) { if(ringing) { lcd_clear(); lcd_putsf("Ringing..."); delay_ms(4000); i=0; cd=1; beep(); } if(cd==1) { lcd_clear(); lcd_putsf("Connected"); lcd_gotoxy(0,1); lcd_putsf("DTMF: "); while(i<10) { i++; delay_ms(1000); } cd=0; lcd_clear(); lcd_putsf("Ready"); } }; } // END
دیدگاه