You have my interest peaked... how can you generate an Interrupt on PORTC?with the stimulus i was able to create my own interrupt on port c, what i had in mind is connect port c with port a, thus it will change with it...
#include <htc.h>
int portval=0;
void delay()
{
int i=0;
for (i=0;i < 20;i++) {
i++;
}
}
void dojob(void){
portval = PORTA;
switch (PORTA) {
case 0x01:
RB0=0;
delay();
break;
case 0x02:
RB0=1;
delay();
break;
case 0x03:
RB1=0;
delay();
break;
case 0x04:
RB1=1;
delay();
break;
case 0x05:
RB2=0;
delay();
break;
case 0x06:
RB2=1;
delay();
break;
case 0x07:
RB3=0;
delay();
break;
case 0x08:
RB3=1;
delay();
break;
default :
delay();
break;
}
}
void main () {
ADCON0=0;
ADCON1 = 0b00000110;
TRISA =0b11111111;
TRISB =0b00000000;
PORTB=0;
while(1) {
if (PORTA != portval) dojob() ;
}
}
#include <16F877A.H>
#define value PORTA&0b00001111
void init(void)
{
TRISA =0b00001111;
TRISB =0b00000000;
PORTA =0;
PORTB =0;
}
void main () {
void init(void);
while(true) {
switch (value){
case: 0b00000001
If (PORTBbits.RB0==0)
{
PORTBbits.RB0=1;
else
PORTBbits.RB0=0;
}
break;
case: 0b00000010
If (PORTBbits.RB1==0){
PORTBbits.RB1=1;
else
PORTBbits.RB1=0;
}
.....................ect
If the weather is good,
I will go out in the yard.
And if it’s cool enough,
I will sit in the sun.
Else
I will sit in the shade.
Else
I will stay indoors.
I will then drink some lemonade.