/*SPI通信主机源代码*/
#include <avr/io.h>
#include<avr/signal.h>
#include<avr/interrupt.h>
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0x00;
DDRB = 0x00;
PORTC = 0x00; //m103 output only
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
}
//SPI initialize
// clock rate: 57599hz
void spi_init(void)
{
PORTB |= (1<<PB4) | (1<<PB5) | (1<<PB6) | (1<<PB7);
DDRB |= (
基于ATmega16单片机 SPI主从机通信程序源代码
最新推荐文章于 2024-08-28 10:32:10 发布