سلام
من یه برنامه ساده نوشتم ولی میکرو اجراش نمیکنه.لطفا راهنمایی کنید
من یه برنامه ساده نوشتم ولی میکرو اجراش نمیکنه.لطفا راهنمایی کنید
/************************************************** ***
This program was produced by the
CodeWizardAVR V2.05.3 Standard
Automatic Program Generator
© Copyright 1998-2011 Pavel Haiduc, HP InfoTech s.r.l.
Project :
Version :
Date : 9/21/2024
Author : Mohammad
Company :
Comments:
Chip type : ATtiny13A
AVR Core Clock frequency: 8.000000 MHz
Memory model : Tiny
External RAM size : 0
Data Stack size : 16
************************************************** ***/
include <tiny13a.h>
include <delay.h>
// External Interrupt 0 service routine
interrupt [EXT_INT0] void ext_int0_isr(void)
{
// Place your code here
#asm("cli")
PORTB.5=0;
PORTB.5=1;
delay_ms(2000);
PORTB.5=0;
#asm("sei")
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Crystal Oscillator division factor: 1
pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
pragma optsize+
endif
// Input/Output Ports initialization
// Port B initialization
// Func5=Out Func4=In Func3=In Func2=In Func1=In Func0=In
// State5=0 State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x20;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0A output: Disconnected
// OC0B output: Disconnected
TCCR0A=0x00;
TCCR0B=0x00;
TCNT0=0x00;
OCR0A=0x00;
OCR0B=0x00;
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Rising Edge
// Interrupt on any change on pins PCINT0-5: Off
GIMSK=0x40;
MCUCR=0x03;
GIFR=0x40;
// Timer/Counter 0 Interrupt(s) initialization
TIMSK0=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
ACSR=0x80;
ADCSRB=0x00;
DIDR0=0x00;
// ADC initialization
// ADC disabled
ADCSRA=0x00;
// Global enable interrupts
#asm("sei")
while (1)
{
// Place your code here
PORTB.5=0;
delay_ms(2000);
PORTB.5=0;
}
}
This program was produced by the
CodeWizardAVR V2.05.3 Standard
Automatic Program Generator
© Copyright 1998-2011 Pavel Haiduc, HP InfoTech s.r.l.
Project :
Version :
Date : 9/21/2024
Author : Mohammad
Company :
Comments:
Chip type : ATtiny13A
AVR Core Clock frequency: 8.000000 MHz
Memory model : Tiny
External RAM size : 0
Data Stack size : 16
************************************************** ***/
include <tiny13a.h>
include <delay.h>
// External Interrupt 0 service routine
interrupt [EXT_INT0] void ext_int0_isr(void)
{
// Place your code here
#asm("cli")
PORTB.5=0;
PORTB.5=1;
delay_ms(2000);
PORTB.5=0;
#asm("sei")
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Crystal Oscillator division factor: 1
pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
pragma optsize+
endif
// Input/Output Ports initialization
// Port B initialization
// Func5=Out Func4=In Func3=In Func2=In Func1=In Func0=In
// State5=0 State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x20;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0A output: Disconnected
// OC0B output: Disconnected
TCCR0A=0x00;
TCCR0B=0x00;
TCNT0=0x00;
OCR0A=0x00;
OCR0B=0x00;
// External Interrupt(s) initialization
// INT0: On
// INT0 Mode: Rising Edge
// Interrupt on any change on pins PCINT0-5: Off
GIMSK=0x40;
MCUCR=0x03;
GIFR=0x40;
// Timer/Counter 0 Interrupt(s) initialization
TIMSK0=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
ACSR=0x80;
ADCSRB=0x00;
DIDR0=0x00;
// ADC initialization
// ADC disabled
ADCSRA=0x00;
// Global enable interrupts
#asm("sei")
while (1)
{
// Place your code here
PORTB.5=0;
delay_ms(2000);
PORTB.5=0;
}
}
دیدگاه