catslab
Joined: 24 May 2010 Posts: 4
|
12F1822 INT on pin change ? |
Posted: Wed Nov 24, 2010 9:21 pm |
|
|
Hi all,
For now I had only 3 flowmeters (open collector output) wired to INTx on 18f2620.
Code: | #int_TIMER0
void TIMER0_isr(void)
{
clear_interrupt(int_TIMER0);
set_timer0(0x0);
int_over = 1;
debit_i[0] = 0;
debit_i[1] = 0;
debit_i[2] = 0;
debit[0] = 0;
debit[1] = 0;
debit[2] = 0;
}
#int_EXT
void EXT_isr(void)
{
clear_interrupt(INT_EXT);
debit_temp = get_timer0();
set_timer0(0x0);
debit_i[1] += debit_temp;
debit_i[2] += debit_temp;
debit[0] = debit_i[0] + debit_temp;
int_over = 1;
}
#int_EXT1
void EXT1_isr(void)
{
clear_interrupt(INT_EXT1);
debit_temp = get_timer0();
set_timer0(0x0);
debit_i[0] += debit_temp;
debit_i[2] += debit_temp;
debit[1] = debit_i[1] + debit_temp;
int_over = 2;
}
#int_EXT2
void EXT2_isr(void)
{
clear_interrupt(INT_EXT2);
debit_temp = get_timer0();
set_timer0(0x0);
debit_i[0] += debit_temp;
debit_i[1] += debit_temp;
debit[2] = debit_i[2] + debit_temp;
int_over = 3;
} |
The flow in gal/min is computed later in the main.
This is the only way I saw to get those precious times.
If you got better, feel free to send !
My next trouble is that I'll have 8 flowmeters to monitor at the same time + 1 wire temp sensors.
I tried to shake my brain but I came with no idea on howto.
Got to tell, that I have a RS232, I2C for RTC, 1 wire bus and sd card hooked up the pic, 2 push buttons and 2 leds.
Not much left pins.
My idea was to use 12f1822's. One for each flow meter, put them on a i2c bus and let them read the flowmeters ticks and read them as necessary.
I have the v4.106 and there is the 12f1822.h.
If I use the i2c on this pic, I lose the INT pin.
Anyway there's an interrupt flag for each other pin, so this could be real good !
But, in the 12f1822.h I saw:
Code: | #define INT_RB 0x31FF0B08 |
Dammit, there's no port B !
And more, there is no definition of IOCIE/IOCIF.
How would I detect a tick on any other pin apart from INT ?
If anyone got an idea, please throw it because I'm losing hairs !
Cheers. |
|