Wiznet W7200-EVB User Manual page 13

Table of Contents

Advertisement

SpiSendData(0);
//dummy data
data_buf[idx] = SpiRecvData(idx);
CSon();
// CS=1, SPI end
ISR_ENABLE();// Interrupt Service Routine disable
}
Code 2 Pseudo code for write with SPI interface
#define
data_write_command 0x80
uint16 addr;
//address : 16bits
int16 data_len;
//data_length :15bits
uint8 data_buf[];
// array for data
SpiSendData();
//send data from MCU to W5200
SpiRecvData();
//Receive data from W5200 to MCU
/* Pseudo Code for Read data of 8bit per packet */
{
SpiSendData();
//send data from MCU to W5200
ISR_DISABLE();
// Interrupt Service Routine disable
CSoff();
// CS=0, SPI start
SpiSendData(((addr+idx) & 0xFF00) >> 8);
SpiSendData((addr+idx) & 0x00FF);
// data write command + data length upper 7bits
SpiSendData((data_write_command | ((data_len & 0x7F00) >> 8)));
// data length bottom 8bits
SpiSendData((data_len & 0x00FF));
SpiSendData(data_buf[idx]);
CSon();
// CS=1, SPI end
IINCHIP_ISR_ENABLE();
}
© Copyright 2011 WIZnet Co., Inc. All rights reserved.
//READ data
//Address byte 1
//Address byte 2
// Interrupt Service Routine disable
13
Ver. 1.1

Advertisement

Table of Contents
loading

Table of Contents