MDSHUJAUDDIN
Newbie level 6
By using GSM SIM 300M and Atmega8 , i am facing a problem in sending SMS to a Persons on making any one of the port pin gets high (ExB0=1)
"Requirement" is just to send the SMS to 1 persons , when PB0 pin gets high.For an instance its directly given from the Vcc=5V as pulse for certain duration
Have a look at dis code , Plz suggest me any modification ,eager waiting for ur reply ........
Knowing the fact that such type of discussion is already been done , i have gone through all them , but dint find the way to get-out of my problem ....
https://www.edaboard.com/threads/269703/
https://www.edaboard.com/threads/204340/#post867317
https://www.edaboard.com/threads/204340/#post867263
"Requirement" is just to send the SMS to 1 persons , when PB0 pin gets high.For an instance its directly given from the Vcc=5V as pulse for certain duration
Have a look at dis code , Plz suggest me any modification ,eager waiting for ur reply ........
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #define F_CPU 12000000UL #define USART_BAUDRATE 9600 // Baud Rate value #define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) #define PIN PB0 void usart_putstr(char * s); void usart_init(); static void usart_putch(unsigned char send); unsigned int usart_getch(); void init_Ports(void); int main () { DDRD|=0xFC;//Setting the Tx and Rx Pins Low DDRB =0x00;//Setting the PortB as input port while (1) { init_Ports(); while (PIN==0); //program will loop in this line itself only until the pin become logic high usart_init(); // initialization of USART char b[] = "AT+CMGS="; char no[]="+918000000000"; char body[] ="Got the Output"; { usart_putstr(b); _delay_ms(100); usart_putch('"'); usart_putstr(no); _delay_ms(100); usart_putch('"'); _delay_ms(100); usart_putch('\r'); usart_putch('\n'); _delay_ms(100); usart_putstr(body); _delay_ms(100); usart_putch(0x1A); } return 0; } } void usart_init() { UBRRL = 0x0077; _delay_ms(1); UCSRB |= (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitry UCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes } unsigned int usart_getch() { while (!(UCSRA & (1 << RXC)) ); // Do nothing until data has been received and is ready to be read from UDR _delay_ms(1); return(UDR); // return the byte } static void usart_putch(unsigned char send) { while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready.. // for more data to be written to it UDR = send; // Send the byte } void usart_putstr(char * s) { while(*s) { usart_putch(*s++); } } void init_Ports(void) { cli(); //disable all interrupts DDRB = 0x00; //port B as input sei(); //reanable all interrupts }
Knowing the fact that such type of discussion is already been done , i have gone through all them , but dint find the way to get-out of my problem ....
https://www.edaboard.com/threads/269703/
https://www.edaboard.com/threads/204340/#post867317
https://www.edaboard.com/threads/204340/#post867263
Last edited by a moderator: