redsuns
Newbie level 2
hello, i am doing my project which is capturing image with a TTL camera and read from the EUSART of the microcontroller
i am stuck on the programming for how to read from the RCREG without any data lost
datasheet of camera
my original code is below but it will cause data lost
if i don't enable and disable CREN then it will cause overrun error and i don't have any other idea to solve both problem, this is very urgent and important to me, so can anyone help out on how to write the programming for storing 512 byte continuosly into an array ?
thanks
i am stuck on the programming for how to read from the RCREG without any data lost
datasheet of camera
my original code is below but it will cause data lost
Code:
void camera_rx()
{
int x;
unsigned char rx_buffer[512];
for(x=0 ; x<=512 ; x++)
{
RCSTAbits.CREN=1;
while(PIR1bits.RCIF==0);
RCSTAbits.CREN=0;
rx_buffer[x]=RCREG;
}
}
if i don't enable and disable CREN then it will cause overrun error and i don't have any other idea to solve both problem, this is very urgent and important to me, so can anyone help out on how to write the programming for storing 512 byte continuosly into an array ?
thanks