Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

For loop termination with data in array is 0xff

Status
Not open for further replies.

mayasunny

Member level 3
Member level 3
Joined
Mar 21, 2019
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
481
Hiee members,
i'm working on a project which is send binary file to EEPROM, read it back and display it on uart terminal.
i'm using PIC16F877A micro controller, xc8 compiler and 93lc46a eeprom.
i'm able to sending/reading the file to/from eeprom properly.
Code:
for(j=0; j < 64 ;j++)
    {
        Ewen();
        __delay_ms(100);
        Write(write_addr2, RxData[j]);
        __delay_ms(100);
        Ewds();
        Rx_file = Read(write_addr2);
        Result[j] = Rx_file;
        write_addr2++;
    }
    for(j = 0;j < 64; j++)
    {
        output = strcmp(RxData[j],Result[j]);
        if(output == 0)
        {
            UART_TxChar(Result[j]);
        }
        else
        {
            RD0 = 1;
            UART_str(error);
        }
    }
     __delay_ms(1000);

i split the binary file (size 128 bytes) into two arrays, the above code is for first 64 bytes of data, in the code i'm comparing each byte of data, the problem is the for loop terminates at j = 62, (RxData[62] = FF ) . i don't know why? i have few doubt does it treats FF as end of the file, can i use strcmp in side for loop?
 
Last edited:

Why strcmp(), it's for null terminated strings? You want to compare single bytes, e.g.
Code:
if (RxData[j] == Result[j])
 

Thanks for your reply, I solved the problem with if(RxData[j]== Result[j])
One more question how can I send two files to the eeprom one by one
 

microSD Card interface to read files and above code to send read bytes to eeprom.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top