#pragma config FPLLODIV = DIV_1, UPLLEN = OFF, FPLLMUL = MUL_20, FPLLIDIV = DIV_2 #pragma config FWDTEN = OFF, WDTPS = PS1048576, FCKSM = CSDCMD #pragma config FPBDIV = DIV_1 #pragma config OSCIOFNC = OFF, POSCMOD = HS, IESO = OFF, FSOSCEN = OFF, FNOSC = PRIPLL #pragma config CP = OFF, BWP = OFF, PWP = OFF #pragma config ICESEL = ICS_PGx1, DEBUG = OFF #include #include unsigned char TData[6] = {0, 1, 2, 3, 4, 5}; // Transmit data unsigned char RData[6] = {0}; // Receive data unsigned char i = 0; void main(void) { LATD = 0; // Port D is now an output to visualize the data TRISD = 0; SFLASHInit(); // SFLASHChipErase(); // It is recommended to erase the chip the first time of use SFLASHWriteArray(0, TData, 6); // Transmit TData array, 6 bytes, address 0x00000 SFLASHReadArray(0, RData, 6); // Read the data and store in RData array, 6 bytes, address 0x00000 for(;;) { for (i = 0; i < 6; i++) { LATD = RData[i]; // Put the previous read data on port D Delayms(500); // A delay so you can see the data } i = 0; // Start over } }