jirkaj4
Newbie level 4
- Joined
- Jul 1, 2011
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,316
Hello.
I'm trying to communicate with the AD converter Max187 and ATmega16. But not me.
The display is no number, no nothing. So I think that with the AD converter establish a connection.
Do you know where the problem might be?
It is about connections: ATmega16 - SPI - Max187.
16MHz crystal. Codes attach here:
And the whole project can be downloaded here [AVR Studio 4]
View attachment program.rar.
thank you
I'm trying to communicate with the AD converter Max187 and ATmega16. But not me.
The display is no number, no nothing. So I think that with the AD converter establish a connection.
Do you know where the problem might be?
It is about connections: ATmega16 - SPI - Max187.
16MHz crystal. Codes attach here:
Code:
#include <avr/io.h>
#include <stdio.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd.h" //Communication with LCD2004
#include "spi.h" //Communication on SPI bus
//set CPOL = 0 and CPHA = 0 from datasheet
unsigned char data; //value of nuber from MAX187
char buffer[50];
void inicializace(){
InitSPI(); //INIT SPI
lcd_init(LCD_DISP_ON); //INITLCD
}
int main(){
inicializace();
while(1){
//read data from MAX187
SELECT(); // Select SS slave
data = ReadByteSPI(); //read data from SPI
DESELECT(); // Stop SS Slave
_delay_ms(10); //small delay
//show value on LCD
lcd_gotoxy(0,1);
printf(buffer,"%d",data);
lcd_puts(buffer);
}return(0);
}
And the whole project can be downloaded here [AVR Studio 4]
View attachment program.rar.
thank you