[an error occurred while processing this directive]
поможите пожалуйста с кодом. уже кажется все перепробовал.
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено newbie 01 мая 2006 г. 23:39

не могу сделать так что бы по прерыванию от икприемника(от пульта) программа запускалась по новой.

#include <90s2313.h>
#include
#include
// 1 Wire Bus functions
#asm
.equ __w1_port=0x12 ;PORTD
.equ __w1_bit=1
#endasm
#include <1wire.h>


#define MAX_DEVICES 3

unsigned char rom_codes[MAX_DEVICES][9];

const char cif[18]={72,238,84,100,226,97,65,236,64,96,192,67,89,70,81,209,255,247};
// 0 1 2 3 4 5 6 7 8 9 a b c d e f " " -
char razr,cn;
char data [4];
char t,dev,k;
char ds[2];
int temp_;
bit m;


interrupt [EXT_INT0] void ext_int0_isr(void)
{
// Place your code here
//sleep_disable();
//GIMSK=0x00;
//MCUCR=0x00;
//GIFR=0x00;

PORTD.0=1;

//PORTB=0;
//PORTD=0b1111001;
}


// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
TCNT0=245; //reload timer
PORTB=255; // turn off all segments
PORTD=(~(1<PORTB=cif[data[razr]]-64*(razr==2)-64*((razr==0)&&(k==0));

if(razr++==4) razr=0;

}

int temp(char i)
{
#asm("cli");
w1_init();
w1_write(0x55); // match rom
#asm("sei");
for(t=0;t<8;t++) {#asm("cli");w1_write(rom_codes[i][t]);#asm("sei");}
#asm("cli");
w1_write(0x44); //convert T
#asm("sei");
delay_ms(900);
#asm("cli");
w1_init();
w1_write(0x55); // match rom
for(t=0;t<8;t++) { #asm("cli");w1_write(rom_codes[i][t]);#asm("sei");}
#asm ("cli");
w1_write(0xbe) ; //read scratchpad
ds[0]=w1_read();
ds[1]=w1_read();
#asm("sei");

m=(ds[1]>>6)&1;
if(m){
ds[0]=(~ds[0])+1;
ds[1]=(~ds[1])+(ds[0]==0);
}
return (int)((ds[1]&7)<<4|ds[0]>>4)*10+(ds[0]&15)*10/16;
}

// Declare your global variables here

void main(void)
{
// Declare your local variables here
newcyc:
// Input/Output Ports initialization
// Port B initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0xFF;
DDRB=0xFF;

// Port D initialization
// Func6=Out Func5=Out Func4=Out Func3=Out Func2=In Func1=In Func0=In
// State6=0 State5=0 State4=0 State3=0 State2=T State1=T State0=T
//PORTD=0b0000001;
DDRD=0b1111001;
PORTD.0=1;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 3,906 kHz
TCCR0=0x05;


TCNT0=245;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1 output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare Match Interrupt: Off

WDTCR=0b00011000;
WDTCR=0b00010000;
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1H=0x00;
OCR1L=0x00;

// External Interrupt(s) initialization
// INT0: On - rising front
// INT1: Off

//MCUCR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x02;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;

// 1 Wire Bus initialization
//data[0]=w1_init();

w1_init();
dev=w1_search(0xf0,rom_codes);
razr=0;

// Global enable interrupts
sleep_enable();


#asm("sei");


while (1)
{ // while 1
sleep_enable();
for(k=0;k{ // for
temp_=temp(k);
cn=3;
while (temp_>0)
{ // while
data[cn--]=temp_%10;
temp_=temp_/10;
} // end while
data[cn--]=16+m;
data[cn--]=16; //empty

delay_ms(4000);

} // end for

PORTD|=0b1111000;
PORTB=255;

//GIFR=0x40;

GIMSK|=0x40;
MCUCR|=0x02;
GIFR=0x40;

powerdown();
PORTD.0=1;
goto newcyc;
//#asm("rjmp __RESET");
} //end while 1
}


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 
NoIX ключ Запомнить

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание

E-mail: info@telesys.ru