+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Newbie level 4
    Points: 334, Level: 3

    Join Date
    Apr 2011
    Posts
    6
    Helped
    2 / 2
    Points
    334
    Level
    3

    sms based control of home appliances

    im placing my code here that i used to communicate atmega16 with pc on hyperteminal. it is working fine. my concern is regarding using at commands in my code. how could i start...

    Code:
    #define F_CPU 16000000UL
     
    #define USART_BAUDRATE 9600
    #define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
     
    #include
    #include
    
    void usart_init();
    void usart_putch(unsigned char send);
    unsigned int usart_getch();
     
    int main()
    {
    	unsigned char value;
    	DDRD=0xff;
    	DDRA=0xff;		
    	DDRB=0x07;		
    	
    	_delay_ms(50);		// delay of 50 mili seconds
    	usart_init();		// initialization of USART
    	while(1)
    	{
    
    	value=usart_getch();
    	usart_putch(value);	
    	}
    	return 0;
    }
     
    
     
    void usart_init()
    {
    	UCSRB |= (1 << RXEN) | (1 << TXEN);   
    					// Turn on the transmission and reception circuitry
    	UCSRC |= (1 << URSEL) | (1<> 8); // Load upper 8-bits of the baud rate value..
    									// into the high byte of the UBRR register
    }
     
    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 
    }
     
    unsigned int usart_getch()
    {
    	while ((UCSRA & (1 << RXC)) == 0);
    				// Do nothing until data have been received and is ready to be read from UDR
    	return(UDR); // return the byte
    }

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 33,613, Level: 44
    ckshivaram's Avatar
    Join Date
    Apr 2008
    Location
    villingen (Germany) / Bangalore
    Posts
    5,070
    Helped
    2157 / 2157
    Points
    33,613
    Level
    44
    Blog Entries
    1

    Re: sms based control of home appliances

    do a search in the forum before you post any thread... these have been addressed and solutions provided from many years.......
    " It is so simple to be happy,
    but it is so difficult to be simple"



  3. #3
    Newbie level 4
    Points: 334, Level: 3

    Join Date
    Apr 2011
    Posts
    6
    Helped
    2 / 2
    Points
    334
    Level
    3

    Re: sms based control of home appliances

    had a lot of search..... unable to find specific coding procedure for atmega16...

    ---------- Post added 17-04-11 at 00:39 ---------- Previous post was 16-04-11 at 23:16 ----------

    can anyone provide me solution for this....????



    •   AltAdvertisment

        
       

  4. #4
    Advanced Member level 5
    Points: 33,613, Level: 44
    ckshivaram's Avatar
    Join Date
    Apr 2008
    Location
    villingen (Germany) / Bangalore
    Posts
    5,070
    Helped
    2157 / 2157
    Points
    33,613
    Level
    44
    Blog Entries
    1

    Re: sms based control of home appliances

    there are many solutions for 8051... please dont tell you did not find it... from years i am giving solution for it... atmega is not much different from 8051... take the code and guidelines procedure and modify it for your controller....

    refine your search and find a solution..... cant expect a readymade solution here....... post your code and circuit and tell what is your problem.. we may help you.........
    " It is so simple to be happy,
    but it is so difficult to be simple"



  5. #5
    Banned
    Points: 3,760, Level: 14
    Achievements:
    7 years registered

    Join Date
    Feb 2010
    Location
    Muscat, Oman, Oman
    Posts
    388
    Helped
    64 / 64
    Points
    3,760
    Level
    14

    Re: sms based control of home appliances

    you should first mention which module u want to use , .. the first place is to look at the modules user manual ... it will show u what At cammands to use ...

    sending an at command to a module is just like u send any data to serial port or hyperterminal as far as code is concerned ... search 8051projects.net for gsm and u will get lots of results ! if u still dont get started .... tell us what u dont understand and what u understood?



    •   AltAdvertisment

        
       

  6. #6
    Newbie level 4
    Points: 334, Level: 3

    Join Date
    Apr 2011
    Posts
    6
    Helped
    2 / 2
    Points
    334
    Level
    3

    Re: sms based control of home appliances

    yes sir... i know that... if i get a readymade code then how will i learn to write it.... as you can see i had already posted the code. im not good in c programming. im having trouble in how to use the at commands in the code.. i had gone through a lot of posts..no doubt they are much helpful.. but still im facin prob...

    ---------- Post added at 19:15 ---------- Previous post was at 19:12 ----------

    hello sherazi, thanx....im having problem in using the at commands in the code. im using sim300 gsm module. everything is working perfect... only concern is how i should program atmega16 to act like a hyperterminal...?



  7. #7
    Advanced Member level 5
    Points: 33,613, Level: 44
    ckshivaram's Avatar
    Join Date
    Apr 2008
    Location
    villingen (Germany) / Bangalore
    Posts
    5,070
    Helped
    2157 / 2157
    Points
    33,613
    Level
    44
    Blog Entries
    1

    Re: sms based control of home appliances

    in a simple way , assuming that you know how to write serial communication program...

    write a serial comm program, where you send AT in your program... then wait for serial data to be received... compare the incoming data with character 'K' (type OK from hyperterminal). if it is K then send next at command and again wait for response from hyperterminal.....

    if you can write this program then there is nothing else to write for GSM......
    " It is so simple to be happy,
    but it is so difficult to be simple"



  8. #8
    Newbie level 1
    Points: 307, Level: 3

    Join Date
    Apr 2011
    Posts
    1
    Helped
    0 / 0
    Points
    307
    Level
    3

    Re: sms based control of home appliances

    Hi im also doing a similar project.Im using pic16f877a and a Sony Ericsson K750i phone as my receiver.I use the unused SE data cable DCU-60 and make some modification(I peel off the rubber exterrior)and had managed to determine all the pins connected with the wires inside.the pins for the data cable is as follow:
    Sony Ericsson C702, C902, C905, F305, G502, G700, G705, G900, K205i, K310i, K320i, K330, K510i, K530i, K550i, K610i, K630i, K660i, K750i, K770i, K790i, K800i, K810i, K850i, M600i, P1i, P990i, R300, R306, S302, S500i, T303, T650i, T700, W200i, W300i,

    my problem is to which pins should i connect in order to have serial communication with my MCU(is that DTMS/DFMS or CTMS/CFMS)??BTW i knew tat both CTMS and CFMS is used as DATA+/DATA- for USB protocols,since pic16f877a doesnt have USB module I assume i cannot connect CTMS/CFMS to my circuit.I had also tried DTMS/DFMS but stil cant managed to get any result.

    my circuit is as follow:

    pic(tx)------->k750(DTMS);
    pic(rx)-------->k750(DFMS);

    the following code is a first stage tester,which mean if i can get the message stored in my phone i am succeed.pls help......
    void main()
    {
    unsigned char temp;
    unsigned char a;
    unsigned char b;
    //set I/O input output
    TRISB = 0b00000011; //configure PORTB I/O direction
    TRISD = 0b00000000; //configure PORTD I/O direction


    //Configure UART
    SPBRG=129; //set baud rate as 9600 baud
    BRGH=1; //baud rate high speed option
    TXEN=1; //enable transmission
    TX9 =0; //8-bit transmission
    RX9 =0; //8-bit reception
    CREN=1; //enable reception
    SPEN=1; //enable serial port
    temp=RCREG;
    temp=RCREG;

    while(1)
    {
    if(SW1==0)
    {
    delay(10000);
    sync();
    uart_str("AT+CMGW=24");

    uart_send(0x0D);

    uart_str("079106xxxxxxx11000A9xxxxxxxx000AA0CC8F71D14969741F 977FD07");

    uart_send(0x1A);
    led1=!led1;
    delay(5000);
    }
    }
    }

    ================================================== ====
    void sync(void)
    {
    unsigned char c;
    c = 'u';
    for( ;c>128;c--)
    {
    uart_send(c);
    }



--[[ ]]--