kotsam
Member level 1
PIC
Hey guys ,
urgent help other wise i would in truoble ;
what make the i/o pins not stable ,
I'm talking about PIC18F4550 , this code not working as expected , RD4 should be high all the time , but working high for some seconds and then it switched to be low and then it goes to be high again .
i would so thankful for the help , its so urgent
Hey guys ,
urgent help other wise i would in truoble ;
what make the i/o pins not stable ,
I'm talking about PIC18F4550 , this code not working as expected , RD4 should be high all the time , but working high for some seconds and then it switched to be low and then it goes to be high again .
i would so thankful for the help , its so urgent
Code:
void main()
{
//****************port configuration********************
LATE = 0x00;
PORTE = 0b11111111;
LATB = 0x00; //Clear port b
TRISB = 0x00; // port b as output
LATD = 0x00; //clear port d
TRISD = 0x00; //port d as output
TRISC = 0b10011111; //config RC6 rx as input
LATA = 0b00000000; //Clear port b
TRISA = 0b11111111; // port b as output
//******************usart configuration**********************
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_ON & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 64);
//*****************adc channels configuration*****************
OpenADC( ADC_FOSC_8 & ADC_LEFT_JUST & ADC_0_TAD,ADC_CH7 & ADC_INT_OFF,0b1111 );
//*****************Code Start Here****************************
while(1)
{
if (DataRdyUSART()) //check if there is interrupt
{
USARTREC();
}//end if
LATDbits.LATD0 = 1; //u/d High
LATDbits.LATD4 = 1; //u/d High
Delay1KTCYx (500);
putsUSART(error);
Delay1KTCYx (500);
}//end while
} //end main