hi:
I need to communicate with ADE7758
Using SPI
I need the settings below.
1- SPI mode = master
2- Clock rate= 4
3-clock polarity=Low
4-data order = MSB
5- interrupt=on
6-sample on = rising edge
i want send one byte 0x14 to ade7758 ,
and i know i should recive 0xfc and i write program wait "SPI1_Init " and "SPI1_Init_Advanced"
but i can not recive any action from my slave device.
mybe help me write for me wait it setting
1- SPI mode = master
2- Clock rate= 4
3-clock polarity=Low
4-data order = MSB
5- interrupt=on
6-sample on = rising edge
thank you
plese help me
Re: plese help me
If you post your code we may be able to help.
Re: plese help me
hi:
thank you for your answer.
it is my program for start spi .
sbit buzer at PORTB.B3;
sbit led at PORTA.B4;
sbit bllcd at PORTA.B5;
// NAME FOR INPUT
/*sbit key1 at PINA0_BIT;
sbit key2 at PINA1_BIT;
sbit key3 at PINA2_BIT;
sbit key4 at PINA3_BIT;*/
/// Glcd module connections
char GLCD_DataPort at PORTC;
char GLCD_DataPort_Direction at DDRC;
sbit GLCD_CS1 at PORTD3_bit;
sbit GLCD_CS2 at PORTD4_bit;
sbit GLCD_RS at PORTD7_bit;
sbit GLCD_RW at PORTD6_bit;
sbit GLCD_EN at PORTD5_bit;
sbit GLCD_RST at PORTD2_bit;
sbit GLCD_CS1_Direction at DDD3_bit;
sbit GLCD_CS2_Direction at DDD4_bit;
sbit GLCD_RS_Direction at DDD7_bit;
sbit GLCD_RW_Direction at DDD6_bit;
sbit GLCD_EN_Direction at DDD5_bit;
sbit GLCD_RST_Direction at DDD2_bit;
sbit Chip_Select at PORTB4_bit;
sbit SoftSpi_CLK at PORTB7_bit;
sbit SoftSpi_SDI at PINB5_bit; // Note: Input signal
sbit SoftSpi_SDO at PORTB6_bit;
sbit Chip_Select_Direction at DDB4_bit;
sbit SoftSpi_CLK_Direction at DDB7_bit;
sbit SoftSpi_SDI_Direction at DDB5_bit;
sbit SoftSpi_SDO_Direction at DDB6_bit;
SPI1_Init(); // Initialize SPI1 module
char buffer[50];
char temp;
void main()
{ unsigned char i;
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00);
DDA0_bit= 0;
DDA1_bit= 0;
DDA2_bit= 0;
DDA3_bit= 0;
oldstate0=0;
oldstate1=0;
oldstate2=0;
oldstate3=0;
DDB3_bit=1; //OUT Buzer
DDA4_bit=1; //OUT LED
DDA5_bit=1; //OUT BLLcd
i=0;
buzer=1;
bllcd=0; // back light lcd on
do{
buzer=1;
delay_ms(500);
buzer=0;
delay_ms(10);
Glcd_Write_Text("START", 5, 1, 1);
sprintf(buffer, "code = %d", i);
glcd_Write_text(buffer, 10, 4, 1);
i=i+1;
SPI1_Write(i);
}while(1);
}
thank you for your answer.
it is my program for start spi .
sbit buzer at PORTB.B3;
sbit led at PORTA.B4;
sbit bllcd at PORTA.B5;
// NAME FOR INPUT
/*sbit key1 at PINA0_BIT;
sbit key2 at PINA1_BIT;
sbit key3 at PINA2_BIT;
sbit key4 at PINA3_BIT;*/
/// Glcd module connections
char GLCD_DataPort at PORTC;
char GLCD_DataPort_Direction at DDRC;
sbit GLCD_CS1 at PORTD3_bit;
sbit GLCD_CS2 at PORTD4_bit;
sbit GLCD_RS at PORTD7_bit;
sbit GLCD_RW at PORTD6_bit;
sbit GLCD_EN at PORTD5_bit;
sbit GLCD_RST at PORTD2_bit;
sbit GLCD_CS1_Direction at DDD3_bit;
sbit GLCD_CS2_Direction at DDD4_bit;
sbit GLCD_RS_Direction at DDD7_bit;
sbit GLCD_RW_Direction at DDD6_bit;
sbit GLCD_EN_Direction at DDD5_bit;
sbit GLCD_RST_Direction at DDD2_bit;
sbit Chip_Select at PORTB4_bit;
sbit SoftSpi_CLK at PORTB7_bit;
sbit SoftSpi_SDI at PINB5_bit; // Note: Input signal
sbit SoftSpi_SDO at PORTB6_bit;
sbit Chip_Select_Direction at DDB4_bit;
sbit SoftSpi_CLK_Direction at DDB7_bit;
sbit SoftSpi_SDI_Direction at DDB5_bit;
sbit SoftSpi_SDO_Direction at DDB6_bit;
SPI1_Init(); // Initialize SPI1 module
char buffer[50];
char temp;
void main()
{ unsigned char i;
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00);
DDA0_bit= 0;
DDA1_bit= 0;
DDA2_bit= 0;
DDA3_bit= 0;
oldstate0=0;
oldstate1=0;
oldstate2=0;
oldstate3=0;
DDB3_bit=1; //OUT Buzer
DDA4_bit=1; //OUT LED
DDA5_bit=1; //OUT BLLcd
i=0;
buzer=1;
bllcd=0; // back light lcd on
do{
buzer=1;
delay_ms(500);
buzer=0;
delay_ms(10);
Glcd_Write_Text("START", 5, 1, 1);
sprintf(buffer, "code = %d", i);
glcd_Write_text(buffer, 10, 4, 1);
i=i+1;
SPI1_Write(i);
}while(1);
}