Junk Box Arduino by James R. R. Strickland

Junk Box Arduino by James R. R. Strickland

Author:James R. R. Strickland
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


select_flash_address(address); //Set the address lines

DATA_WRITE = data; //Set the data lines

set_flash_signals(FLASH_WRITE);

set_flash_signals(FLASH_WAIT_WRITE);

//pulse /W low. It only has to go low a few nanoseconds.

// Nothing on the cestino happens in less than 50, so we're

// not going too fast for the 85ns 39SF020A. If your flash

// is slower, you may have to add a delay.

}

// ----------------------------------------------------------

// program_flash(address,data)

// ----------------------------------------------------------

// To actually store (program) data onto the flash, we have to

// send it a specific pattern of addresses and data bytes before

// we send it the address we want and the byte of data we want

// stored there.

// To that end, we set DATA_DDR to output so we can write data,

// then call set_flash_signals to set it to FLASH_WAIT_WRITE

// mode. This disables /OE (gate) but does not enable /W (write).

// We call send_to_flash four times. The first three tell the

// flash controller what we want to do, and the fourth call

// gives it our address and data.

// Then clear the DATA_WRITE pins and set DATA_DDR back to

// read mode. Delay 1ms to because flash is slow and we're

// not polling its status line to tell when it's done. Set the

// flash's control signals to FLASH_READ mode and we're done.

// ----------------------------------------------------------

void program_flash(uint32_t address, byte data) {

DATA_DDR = 0xFFFF;

set_flash_signals(FLASH_WAIT_WRITE);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.