پاسخ : مشکل با AVR و SIM 900
ممنون از آقا سینا
من با بسکام تاحالا کار نکردم
فعلا منتظر بقیه دوستان گل هستم
واقعا دمتون گرم
ممنون از آقا سینا
من با بسکام تاحالا کار نکردم
فعلا منتظر بقیه دوستان گل هستم
واقعا دمتون گرم
at+cmgd=0,4;
at+cmgd=0,4;
/***************************************************** This program was produced by the CodeWizardAVR V2.04.4a Advanced Automatic Program Generator © Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 2013/07/27 Author : NeVaDa Company : Comments: Chip type : ATmega32 Program type : Application AVR Core Clock frequency: 11.059200 MHz Memory model : Small External RAM size : 0 Data Stack size : 512 *****************************************************/ #include <mega32.h> #include <delay.h> #asm .equ __lcd_port=0x1B ;PORTA #endasm #include <lcd.h> #ifndef RXB8 #define RXB8 1 #endif #ifndef TXB8 #define TXB8 0 #endif #ifndef UPE #define UPE 2 #endif #ifndef DOR #define DOR 3 #endif #ifndef FE #define FE 4 #endif #ifndef UDRE #define UDRE 5 #endif #ifndef RXC #define RXC 7 #endif #define FRAMING_ERROR (1<<FE) #define PARITY_ERROR (1<<UPE) #define DATA_OVERRUN (1<<DOR) #define DATA_REGISTER_EMPTY (1<<UDRE) #define RX_COMPLETE (1<<RXC) // USART Receiver buffer #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 // This flag is set on USART Receiver buffer overflow bit rx_buffer_overflow; // USART Receiver interrupt service routine interrupt [USART_RXC] void usart_rx_isr(void) { char status,data; status=UCSRA; data=UDR; if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0) { rx_buffer[rx_wr_index++]=data; #if RX_BUFFER_SIZE == 256 // special case for receiver buffer size=256 if (++rx_counter == 0) rx_buffer_overflow=1; #else if (rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0; if (++rx_counter == RX_BUFFER_SIZE) { rx_counter=0; rx_buffer_overflow=1; } #endif } } #ifndef _DEBUG_TERMINAL_IO_ // Get a character from the USART Receiver buffer #define _ALTERNATE_GETCHAR_ #pragma used+ char getchar(void) { char data; while (rx_counter==0); data=rx_buffer[rx_rd_index++]; #if RX_BUFFER_SIZE != 256 if (rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0; #endif #asm("cli") --rx_counter; #asm("sei") return data; } #pragma used- #endif // Standard Input/Output functions #include <stdio.h> // Declare your global variables here char Enter=13; char double_quote=34; char Ctrlz=26; char TELL[12]="09195151488"; void main(void) { DDRD.5=0; PORTD.5=1; // USART initialization // Communication Parameters: 8 Data, 1 Stop, No Parity // USART Receiver: On // USART Transmitter: On // USART Mode: Asynchronous // USART Baud Rate: 9600 UCSRA=0x00; UCSRB=0x98; UCSRC=0x86; UBRRH=0x00; UBRRL=0x47; // Alphanumeric LCD initialization // Connections are specified in the // Project|Configure|C Compiler|Libraries|Alphanumeric LCD menu: // RS - PORTA Bit 7 // RD - PORTA Bit 1 // EN - PORTA Bit 2 // D4 - PORTA Bit 3 // D5 - PORTA Bit 4 // D6 - PORTA Bit 5 // D7 - PORTA Bit 6 // Characters/line: 16 // Global enable interrupts #asm("sei") lcd_init(16); lcd_putsf(" W E L C O M E"); delay_ms(300); lcd_clear(); while (1) { if(PIND.5==0) { while(PIND.5==0); delay_ms(20); printf("at+cmgs=%c%s%c%c",double_quote,TELL,double_quote,Enter); delay_ms(1000); printf("MORTEZA %c",Ctrlz); delay_ms(1000); } lcd_putsf("goodbye"); delay_ms(300); lcd_clear(); } }
دیدگاه