hi sir,
am using pic18f2550 for a 10 x 5 matrix project but i dont know how to configure it as
internal oscillator 8mhz ra6 as i/o port
1:16 prescaler
16 bit mode pls help me my code is below is it correct i dont nedd usb and other such things
using below code interrupt not working
main
interupt
please help me
am using pic18f2550 for a 10 x 5 matrix project but i dont know how to configure it as
internal oscillator 8mhz ra6 as i/o port
1:16 prescaler
16 bit mode pls help me my code is below is it correct i dont nedd usb and other such things
using below code interrupt not working
Code:
__CONFIG(1, IESODIS & FCMDIS & INTIO);
// Config word 2
__CONFIG(2, VREGEN & PWRTEN & BORDIS & WDTDIS);
// Config word 3
__CONFIG(3, PBDIGITAL & LPT1DIS & MCLREN);
// Config word 4
__CONFIG(4, XINSTDIS & STVRDIS & LVPDIS & ICPORTDIS & DEBUGEN);
// Config word 5, 6 and 7 (protection configuration)
__CONFIG(5, UNPROTECT);
__CONFIG(6, UNPROTECT);
__CONFIG(7, UNPROTECT);
main
Code:
void main(void)
{
OSCCON=0x70;
T0CON=0x83;
TMR0H=0xFF;
TMR0L=0xF6;
INTCON=0;
INTCON2=0;
INTCON3=0;
PIR1=0;
PIR2=0;
PIE1=0;
PIE2=0;
IPR1=0;
IPR2=0;
IPEN=0;
ADCON0=0;
ADCON1=0x0f;
ADCON2=0;
T1CON=0;
T2CON=0;
T3CON=0;
SSPCON1=0;
SSPCON2=0;
RCSTA=0;
TRISA=0b00000111;
TRISC=0b10000000;
TRISB=0;
PORTA = 0b00000000;
PORTB = 0b00000000;
PORTC = 0b00000000;
CCP1CON=0,
CCP2CON=0;
SPBRG=51;
TXSTA=0x22;
RCSTA=0x90;
BAUDCON=0x48;
SPBRGH=0;
POR=1;
//displayClear();
IPEN=1;
GIEH = 1;
GIEL = 1;
//INTCONbits.PEIE = 1;
TMR0IE = 1;
//displayPlot(2,3,ON);
while(1)
{
//displayPlot(2,3,ON);
COL_0=1;
COL_1=1;
COL_3=1;
ROW_0=1;
ROW_1=1;
ROW_2=1;
ROW_3=1;
ROW_4=1;
}
}
interupt
Code:
void interrupt low_priority lpHandler(void)
{
unsigned char rowCounter;
// Is this timer0 interrupting?
if (TMR0IF)
{
COL_0=1;
COL_1=1;
COL_3=1;
ROW_0=1;
ROW_1=1;
ROW_2=1;
ROW_3=1;
ROW_4=1;
TMR0L = 0xF6; // Reset the timer0 counter
TMR0IF = 0; // Clear the timer0 interrupt flag
}
}
please help me