你们好,我有MMC-1能写得进,也能读得出,可是就是没有信号出来,我已经接上了10K电阻到三个限流引脚了,SLEEP接高,USART接地,复位接VCC(+5V),REGC没外接电容,都按说明的做了,可是没信号输出,是什么问题?我测的限流引脚是0V,正常吗?
还有,我写一个读一个就能读出来,先完再读就只能读一个出来,其他都是以,是什么问题?
我用的是SPI连续读,和延时10ms读,也是没有波形输出命令写的是对的,我们这的人都是能写能读,就是没有信号输出。我的程序
#define CH1MODE 0
#define CH1FREQ 1
#define CH1STEP 2
#define CH1DUTY 3
#define CH2MODE 4
#define CH2FREQ 5
#define CH2STEP 6
#define CH2DUTY 7
#define CH3MODE 8
#define CH3FREQ 9
#define CH3STEP 0X0A
#define CH3DUTY 0X0B
#define SYNMODE 0X0C
#define ASSP_R 0XA0
#define ASSP_W 0X50
#define reset0 PORTE7_0
#define reset1 PORTE7_1
#include<iom128v.h>
#include<macros.h>
#include<iobit.h>
#include"usart.c"
#include"define.h"
#define uchar unsigned char
#define uint unsigned int
//uchar ch1mode=0,ch2mode=0;
void delay(uint count)
{
for(;count>0;count--);
}
void port_init(void)
{
PORTA = 0xff;
DDRA = 0xff;
PORTB = 0x3f;
DDRB = 0x37;
PORTC = 0x00;
DDRC = 0x00;
PORTD = 0x00;
DDRD = 0x00;
PORTE = 0x83;
DDRE = 0x83;
PORTF = 0x00;
DDRF = 0x00;
PORTG = 0x00;
DDRG = 0x00;
}
void spi_m_init()
{
SPCR = 0x53; //setup SPI
SPSR = 0x00; //setup SPI
}
uchar spi_rw(uchar data)
{
SPDR=data;
while(!(SPSR&(1<<SPIF)));
return(SPDR);
}
uchar assp_read(uchar data)
{
spi_rw(data);
return(spi_rw(0));
}
void assp_write(uchar data1,uchar data2)
{
spi_rw(data1);
spi_rw(data2);
}
void main()
{
port_init();
usart0_init();
usart_str("RX:",3);
spi_m_init();
assp_write(ASSP_W+CH1DUTY,0x7d);
//usart_c(assp_read(ASSP_R|CH1DUTY));
assp_write(ASSP_W+CH1MODE,0xc0);
//usart_c(assp_read(ASSP_R|CH1MODE));
//assp_write(ASSP_W+CH2DUTY,0x7d);
//usart_c(assp_read(ASSP_R|CH2DUTY));
//assp_write(ASSP_W+CH2MODE,0xc0);
//usart_c(assp_read(ASSP_R|CH2MODE));
//assp_write(ASSP_W+CH3DUTY,0x7d);
//usart_c(assp_read(ASSP_R|CH3DUTY));
//assp_write(ASSP_W+CH3MODE,0xc0);
usart_c(assp_read(ASSP_R|CH1MODE));
while(1);
}
程序的SPI应用没有错的.
关电了再上电就得过几次,检查焊接都正常。真是急