Circuit_seller
Full Member level 5
- Joined
- Sep 23, 2002
- Messages
- 300
- Helped
- 17
- Reputation
- 34
- Reaction score
- 7
- Trophy points
- 1,298
- Activity points
- 2,350
Hi there,
I am trying to use SPI in programming a DDS serialy.
Unfortunately i can not use SPI correctly.
I done a simple test and write this program. but the micro continusly send data and Serial Clock.
Can anyone say what is the problem.
#include <iom64v.h>
#include <macros.h>
#include "define.h"
void SPI_Send(char cData)
{
/* Start transmission */
SPDR = cData;
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)));
}
void main(void)
{
int i=0;
PORTF = 0x00;
DDRF = 0xdf;
PORTA = 0x00;
DDRA = 0xff;
PORTB = 0x00;
DDRB = 0xff;
SPCR = 0x55; //setup SPI
SPSR = 0x00; //setup SPI
SPI_Send(0x46);
while(1)
;
}
I am trying to use SPI in programming a DDS serialy.
Unfortunately i can not use SPI correctly.
I done a simple test and write this program. but the micro continusly send data and Serial Clock.
Can anyone say what is the problem.
#include <iom64v.h>
#include <macros.h>
#include "define.h"
void SPI_Send(char cData)
{
/* Start transmission */
SPDR = cData;
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)));
}
void main(void)
{
int i=0;
PORTF = 0x00;
DDRF = 0xdf;
PORTA = 0x00;
DDRA = 0xff;
PORTB = 0x00;
DDRB = 0xff;
SPCR = 0x55; //setup SPI
SPSR = 0x00; //setup SPI
SPI_Send(0x46);
while(1)
;
}