Не срабатывают прерывания по изменения ноги, суть заключается в том что приходит сигнал на пятую ножку В, как только приходит постоянный ноль,должно сработать прерывание...помогите пожалуйста...я недавно начал разбараться с пиками...вот программа
#include "I2C_FUNC.h"
void main() {
unsigned short temp_reg = 0;
int dat;
char prev_val1, prev_val2,temp=0;
bit state, state1;
OSCCON = 0b01110101;
ANSEL=0x00;
TRISA = 0b00000000; // Configure PORTA as input 0-output 1 - input
PORTA = 0b00000000;
TRISB = 0b11101111;
PORTB = 0b01011110;
TRISC = 0b00000001;
PORTC = 0b11111000;
INTCON = 0b11001000; //allow all interrupts
IOCB=0b00100000;
I2C1_Init(100000);
Delay_ms(2);
i2c_cycle(0x02,0x00); //inicialization reg 0x02
Delay_ms(2);
i2c_cycle(0x0B,0x10); //inicialization reg 0x0B
Delay_ms(2);
i2c_cycle(0x0C,0x84); //inicialization reg 0x0C
Delay_ms(2);
i2c_cycle(0x09,0x00); //inicialization reg 0x09
Delay_ms(2);
i2c_cycle(0x0A,0x12); //inicialization reg 0x0A
Delay_ms(2);
dat = 0xAC;
i2c_cycle(0x03, dat);
Delay_10ms();
I2C1_Stop(); //issue I2C stop signal //magnitola
// Init Timer0
INTCON.B2 = 0;
INTCON.B0 = 0;
OPTION_REG = 0b00000111; // prescale 1:256 - four times the delay.
TMR0 = 0b00000000; // clear timer
//Init Timer1
PIE1.B0 = 0; // clear roll-over interrupt flag
TMR1H = 0;
TMR1L = 0;
T1CON = 0b00000101;
pir1.b0 = 0;
while(1)
{
}
}
void interrupt()
{
if(IOCB.B5==1)
{
TMR1H = 0;
TMR1L = 0;
intcon.b0 = 0;
pir1.b0 = 0;
TMR0 = 0;
intcon.b2 = 0;
intcon.b0 = 0;
INTCON.B0 = 0;
IOCB.B5=0;
}
}