سلام
تو برنامه ای که گذاشتم از این چندتا ماکرو، warning میگیره
کد:
#define RXB8 1
#define TXB8 0
#define UPE 2
#define OVR 3
#define FE 4
#define UDRE 5
#define RXC 7
البته برنامه کامپایل میشه ولی میخوام علت warning ها رو بدونم
کد:
#include <mega32.h>
#include <delay.h>
#include <stdlib.h>
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include <lcd.h>
bit receiver=0,transmit=0;
#define RXB8 1
#define TXB8 0
#define UPE 2
#define OVR 3
#define FE 4
#define UDRE 5
#define RXC 7
#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<OVR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];
#if RX_BUFFER_SIZE <= 256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif
bit rx_buffer_overflow;
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
receiver=1;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
{
rx_buffer[rx_wr_index++]=data;
if (rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
if (++rx_counter == RX_BUFFER_SIZE)
{
rx_counter=0;
rx_buffer_overflow=1;
}
}
}
#ifndef _DEBUG_TERMINAL_IO_
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index++];
if (rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif
#include <stdio.h>
#define ADC_VREF_TYPE 0x00
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | ADC_VREF_TYPE;
ADCSRA|=0x40;
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}
void main(void)
{
int i;
char str[20],str1[20],data_in;
float temp;
UCSRA=0x00;
UCSRB=0x98;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x47;
ADMUX=ADC_VREF_TYPE;
ADCSRA=0x87;
lcd_init(16);
#asm("sei")
while (1)
{
temp=read_adc(0);
temp=(temp*100/1024);
ftoa(temp,1,str);
lcd_clear();
lcd_gotoxy(0,0);
sprintf(str1,"temp:%s\xdfC\r",str);
lcd_puts(str1);
delay_ms(100);
if (receiver==1)
{
data_in=getchar();
printf("%c\r",data_in);
if (data_in==13);
{
transmit==1;
}
if (transmit==1)
{
for (i=0;i<10;i++)
{
delay_ms(1000);
puts(str1);
}
if (i>=10)
{
receiver=0;
transmit=0;
}
}
}
}
};
سپاس