Forum Discussion
Altera_Forum
Honored Contributor
12 years agoThis is my coding .. i am not able to get the exact ouput .whats wrong with these..anybody can tel us....
int main() { unsigned char byte_r,byte_g,byte_b; int x,i,j; alt_up_sd_card_dev *sd_card_dev = alt_up_sd_card_open_dev("/dev/SDCARD"); sw=IORD_ALTERA_AVALON_PIO_DATA(SWITCH_BASE); if(sw==1) if(sd_card_dev != 0) { if(alt_up_sd_card_is_Present()) { if(alt_up_sd_card_is_FAT16()) printf("Card is FAT16\n"); else printf("Card is not FAT16\n"); sd_fileh= alt_up_sd_card_fopen("Mire.bmp", 0); if(sd_fileh< 0) printf("Problem creating file. Error %i", sd_fileh); else{ printf("\nReading Bmp file"); for(x=0;x<54;x++){ header=(unsigned char)(alt_up_sd_card_read(sd_fileh)); } //printf("%ld",image_size); for(i=0;i<280;i++){for(j=40;j<320;j++) { byte_b=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_g=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_r=(unsigned char)(alt_up_sd_card_read(sd_fileh)); pixel=((byte_r>>3)<<11)|((byte_g>>2)<<5)|((byte_b>>3)<<0); IOWR_16DIRECT(SDRAM_BASE,(((i+80)*640+(j))-40),pixel); } } } printf("out of loop"); alt_up_sd_card_fclose(sd); } else printf("Card is not available"); } return 0; }