Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SMS CONTROLLER USING SE T230 with PIC16F877A that control relays

Status
Not open for further replies.

chitobuknoy18

Junior Member level 1
Joined
Nov 16, 2010
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,480
can anyone help my project regarding sms controller using SE t230 with pic16f877a that control relays (8 relays) here is my code below:

#define TRIGGER PORTD.F1 // set porta/f5 as output
#define DATA PORTA.F4 // set data to c922 for keypad decoding

unsigned int index=0,count=0,address=0,addrLength=247,inbox=0,intFlag=0;
unsigned short intTimer;
unsigned char msg[30], mess[20];


void ATOpen()
{
Usart_Write('A');
Usart_Write('T');
Usart_Write(0x0D);
}
void changeCharacterSetting()
{
Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('S');
Usart_Write('C');
Usart_Write('S');
Usart_Write('=');
Usart_Write('"');
Usart_Write('8');
Usart_Write('8');
Usart_Write('5');
Usart_Write('9');
Usart_Write('-');
Usart_Write('1');
Usart_Write('"');
Usart_Write(0x0D);
}
void textMode() { // Set message format as textmode

Usart_Write('A');
Usart_Write('T');
Usart_Write(0x0D);
delay_ms(500);

Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('M');
Usart_Write('G');
Usart_Write('F');
Usart_Write('=');
Usart_Write('1');
Usart_Write(0x0D);
delay_ms(500);
}
void phoneMem() { // Set preferred message storage as Phone Memory

Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('P');
Usart_Write('M');
Usart_Write('S');
Usart_Write('=');
Usart_Write('"');
Usart_Write('M');
Usart_Write('E');
Usart_Write('"');
Usart_Write(0x0D);
delay_ms(500);

}
void ckpd() { // Received read message
Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('K');
Usart_Write('P');
Usart_Write('D');
Usart_Write('=');
Usart_Write('1');
Usart_Write(0x0D);
}
void readMsg() { // Received read message
Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('M');
Usart_Write('G');
Usart_Write('R');
Usart_Write('=');
Usart_Write('1');
Usart_Write(0x0D);
}
void delMsg() { // Delete message for preferred message memory
Usart_Write('A');
Usart_Write('T');
Usart_Write('+');
Usart_Write('C');
Usart_Write('M');
Usart_Write('G');
Usart_Write('D');
Usart_Write('=');
Usart_Write('1');
Usart_Write(0x0D);
delay_ms(500);
}


void check_message() { // check message status
if(strcmp(mess,"on")==0)
{
}
}

int extract_message(){ // extract the message from the cellphone
int x=0,y=0,flag=1;
char a;
inbox=0;

readMsg();
while(x!=10000){

if(Usart_Data_Ready()){
y++;
a=Usart_Read();
if(a=='r'||a=='R'){
flag=0;
break;
}
if(y>=70){
if(a!='O' && a!='K' && isalpha(a)){
msg[inbox++]=a;

}

}

}
x++;

}
return flag;
}


void SMSProcess(){ // SMS processing routine
int message_index=0;

if(extract_message()==1){
for(message_index=0;message_index<inbox;message_index++){
if(isalpha(msg[message_index]))
mess[message_index]=msg[message_index];
}
mess[message_index]='\0';
check_message();
delMsg();
delay_ms(250);
}
}

void interrupt()
{
intTimer++;
PIR1.TMR1IF=0;

if(intTimer%20==0){
intFlag=1;
}

}
void main()
{
delay_ms(200);

TRISC.F6 = 0; //set direction of PORTC6 as output -- TX -- transmitter
TRISC.F7 = 1; //set direction of PORTC7 as input -- RX -- reciever

TRISD.F1 = 0; // set direction of PORTB0 as input -- external interrupt connected to the motion detecto
delay_ms(4000);
PORTD.F1 = 1;

Usart_Init(9600); //initializes baud rate at 9600 bits per second
delay_ms(400);

textMode();
phoneMem();
SMSProcess();
readMsg();
ckpd();




}

_______________________________
pls help me
 

the problem is the code i just want to ask help because if the code that i post was no effect to the actual circuit pls help me

---------- Post added at 14:05 ---------- Previous post was at 14:04 ----------

the problem is the code i just want to ask help because if the code that i post was no effect to the actual circuit please help me
 

Check this program on proteus software to confirm if it is working fine...

sir were is the you code you said sir so that i can try it

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

ive already try it but still no effects i cant understand what is the problem
 

compile your code and try if your serial communication is working
it will follow your code and you should see the AT commands and response...
 

sms.JPG

this is my simulation i think there is something wrong with it
 

i dont have enough knowledge in programming pic that is one of my problem
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top