Controlling industrial hazards using GSM intimation and feedback
Hey Godfather I am currently working on a project controlling industrial hazards using GSM intimation and feedback..... has someone worked on a smilar project...... thanks in advance bro.... i have brought in all the hardware the GSM modem is working fine the only problem i am facings is with the code..... i have the code but i don't think the problem is in my ATMEGA16 development board i am using VMlab as my simulator
here is the c code i am using to this code.... to test my board and GSM modem
#include
#include
#include
#include
int counter=0;
char rx[25];
unsigned int i=0;
unsigned char once=1;
char dummy[]={13, 0};
char d2[]={26,0};
void main (void)
{
// set PORTC for output
DDRC = 0xFF;
// PORTC=0xFF;
TCCR0=0x05;
TIMSK=0x01;
SREG=0x80;
DDRB=0x0C;
PORTB=0x10;
// PORTC =0xFF;
UCSRA=0x60;
//UCSRB=0x18; //only transmitter & receiver is enabled
UCSRB=0x98; //rx tx enabled, interrupt enabled
UCSRC=0x86; //Asynchronuous, no parity, one stop bit, 8 bit character size
UCSRC &=0x7F; //using URSEL bit
//It generates 9600 baudrate at 7.3728MHz
UBRRH=0x0;
UBRRL=0x2F;
// for 115200 baudrate at 7.3728MHz
// UBRRH=0x0;
// UBRRL=0x03; //BE SURE TO CHANGE THIS FOR SIMULATION///////////////////////////////
/////////////////////////////
asm ("SEI");
while(1){
if((PINB & 0x10) == 0x10)
PORTC |= 0x80;
else
PORTC &= 0x0;
}
}
void send(char* str)
{
unsigned char len;
len=strlen(str);
for(int i=0;i
{
_delay_ms(100);
while((UCSRA & 0x20) == 0x0);
UDR=str;
}
}
ISR(USART_RXC_vect)
{
rx=UDR;
i++;
if(rx[i-2]==13 && rx[i-1]==10)
{
rx[i-1]='\0';
rx[i-2]='\0';
i=0;
if(strcmp(rx,"Call Ready")==0){
PORTC |= 0x40;
_delay_ms(5000);
send("AT");
send(dummy);
}
else if(strcmp(rx,"OK")==0){
if(once==1){
PORTC |= 0x20;
send("AT+CMGS=\"+923334491947\"");
send(dummy);
once++;
}
else if(once==2){
PORTC |= 0x08;
once++;
}
}
for(int j=0;j<25;j++)
rx[j]=0;
}
else if(strcmp(rx,"> ")==0)
{
PORTC |= 0x10;
send("ATMEGA16L says Hello");
send(d2);
}
}
ISR(TIMER0_OVF_vect)
{
counter++;
if(counter==60)
{
PORTB |=0x08;
// counter=0;
TIMSK=0x0;//Disable timer interrupt to free-up controller
}
}
here is the c code i am using to this code.... to test my board and GSM modem
#include
#include
#include
#include
int counter=0;
char rx[25];
unsigned int i=0;
unsigned char once=1;
char dummy[]={13, 0};
char d2[]={26,0};
void main (void)
{
// set PORTC for output
DDRC = 0xFF;
// PORTC=0xFF;
TCCR0=0x05;
TIMSK=0x01;
SREG=0x80;
DDRB=0x0C;
PORTB=0x10;
// PORTC =0xFF;
UCSRA=0x60;
//UCSRB=0x18; //only transmitter & receiver is enabled
UCSRB=0x98; //rx tx enabled, interrupt enabled
UCSRC=0x86; //Asynchronuous, no parity, one stop bit, 8 bit character size
UCSRC &=0x7F; //using URSEL bit
//It generates 9600 baudrate at 7.3728MHz
UBRRH=0x0;
UBRRL=0x2F;
// for 115200 baudrate at 7.3728MHz
// UBRRH=0x0;
// UBRRL=0x03; //BE SURE TO CHANGE THIS FOR SIMULATION///////////////////////////////
/////////////////////////////
asm ("SEI");
while(1){
if((PINB & 0x10) == 0x10)
PORTC |= 0x80;
else
PORTC &= 0x0;
}
}
void send(char* str)
{
unsigned char len;
len=strlen(str);
for(int i=0;i
_delay_ms(100);
while((UCSRA & 0x20) == 0x0);
UDR=str;
}
}
ISR(USART_RXC_vect)
{
rx=UDR;
i++;
if(rx[i-2]==13 && rx[i-1]==10)
{
rx[i-1]='\0';
rx[i-2]='\0';
i=0;
if(strcmp(rx,"Call Ready")==0){
PORTC |= 0x40;
_delay_ms(5000);
send("AT");
send(dummy);
}
else if(strcmp(rx,"OK")==0){
if(once==1){
PORTC |= 0x20;
send("AT+CMGS=\"+923334491947\"");
send(dummy);
once++;
}
else if(once==2){
PORTC |= 0x08;
once++;
}
}
for(int j=0;j<25;j++)
rx[j]=0;
}
else if(strcmp(rx,"> ")==0)
{
PORTC |= 0x10;
send("ATMEGA16L says Hello");
send(d2);
}
}
ISR(TIMER0_OVF_vect)
{
counter++;
if(counter==60)
{
PORTB |=0x08;
// counter=0;
TIMSK=0x0;//Disable timer interrupt to free-up controller
}
}
Replies
-
yanivxRe: CEan - Godfather's Ultimate Electronics / Communications Project Ideas - 2011
Solar tracking device.... can u explain something i don't think so this is practically possible..... i may be wrong though.... it could be solar powered Tracking device.......something like that.... 馃槈 but in 2nd year u taught something so huge u deserve applause... njoy -
Kaustubh KatdarePosts moved to new thread in Other Engineering Trades section 馃榾
-
yanivxThis project is completed and its working perfect.... now i will post all tyhe details very soon.... finally i am done with my final year project 馃榿
-
Harshad Italiya
Oh this Post is specially for me. 馃榿 Thanks Mate.yanivxThis project is completed and its working perfect.... now i will post all tyhe details very soon.... finally i am done with my final year project 馃榿
Great i am very happy that your project is completed. Now if you want to share it here with the Ceans then i can help you we can make its full detail report and share here for the further discussion this will help you to get the more knowledge of the project too.
what you say yanivx? -
narayana murthynice post here i missed it
here i learned 1 thing in practice we never use masm or tasm programming we use only C -
Harshad Italiyanarayana murthynice post here i missed it
here i learned 1 thing in practice we never use masm or tasm programming we use only C
You get the point NM. so try to make your C powerful. 馃榾
You are reading an archived discussion.
Related Posts
RoboEarth is a Crazy Engineering Idea about creating a HUGE network with HUGE database for Robots. It will be place where robots can share data and learn from each other...
Before I begin with the project description I consider it pretty important that you get to know how de communication with the mobile phone is done. For this you should...
*From Spanish
Filipino---------Spanish-----------Meaning
Abante-----------Avante--------- Ahead, Forward
Bodega-----------Bodega---------Warehouse
Colegio/Kolehiyo----Colegio-------- College
Diyos------------- Dios----------- God
Edukasyon --------Educaci贸n--------Education
Guerra/Giyera-------Guerra-----------War
Hustisya ------------Justicia---------Justice
Ingles ------------- Ingl茅s----------English
Kalye ------------- Calle-----------Street
Luho -------------- Lujo---------- Luxury
Mundo ------------- Mundo---------World...
Hi,
Have you ever wondered, what is the purpose of our life? why the hell are we here at all?
I wonder why the universe exist, and whatever happens on...
A team of mechanical engineers at National Taiwan University used NI LabVIEW and CompactRIO to built an energy-efficient leg-wheel hybrid mobile robot that can drive quickly and smoothly on flat...