#include #include #include #include #include #include int main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; //Variable Init int data=0; //SPI init BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; //PIN Config P1SEL |= BIT5 + BIT6 + BIT7; P1SEL2 |= BIT5 + BIT6 + BIT7; //I/O PIN P1OUT |= BIT0; P1DIR |= BIT0; UCB0CTL1 |= UCSWRST; UCB0CTL0 |= UCCKPH | UCMSB | UCMST | UCSYNC; UCB0BR0 = 1; UCB0BR1 = 0; UCB0CTL1 &= ~UCSWRST; UCB0CTL1 = UCSSEL_2; //Chip Select nicht benutzt wiznet_register_spi(); while(1){ // } } uint8_t wizchip_spi_read(void){ while (!(IFG2 & UCB0TXIFG)); UCB0TXBUF = 0xFF; while(!(IFG2& UCB0RXIFG)); volatile unsigned char dummy = UCB0RXBUF; return UCB0RXBUF; } void wizchip_spi_write(uint8_t data){ while(!(IFG2 & UCB0TXIFG)); UCB0TXBUF = data; while(!(IFG2 & UCB0RXIFG)); volatile uint8_t dummy = UCB0RXBUF; } void wiznet_register_spi(void){ reg_wizchip_spi_cbfunc(wizchip_spi_read, wizchip_spi_write); }