Hi guys... this is a new thread i continue from "RS232 to PIC16F877a"...
I'm trying to work on a project with that triggering any input of the PIC16F877a would actually send dial the connected cell phone... Below is my .c file>>
//Preprocessor
#INCLUDE <16F877.H>
#FUSES HS,NOWDT,NOLVP
#USE DELAY(clock=12000000)
#USE RS232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
//Define pin
#DEFINE SIREN PIN_B5
#DEFINE CL1 PIN_B4
#DEFINE CL2 PIN_B3
#DEFINE ULTRA PIN_A0
#DEFINE TOUCH PIN_A1
#DEFINE LIGHT PIN_A2
#DEFINE DOOR PIN_A3
//Global declaration
int A,B,C,D;
char SENSOR1, SENSOR2, SENSOR3, SENSOR4, TEMP;
char S[51];
//Sound siren
void SIREN_ON()
{
OUTPUT_HIGH(SIREN);
DISABLE_INTERRUPTS(INT_RTCC);
}
//Unlock doors
void UNLOCK()
{
OUTPUT_HIGH(CL1);
OUTPUT_LOW(CL2);
}
//Lock doors
void LOCK()
{
OUTPUT_LOW(CL1);
OUTPUT_HIGH(CL2);
}
//Ultrasonic sensor triggered
void SEND_CALL1()
{
PRINTF("ATD0123456789;\n\r");
}
//Touch sensor triggered
void SEND_CALL2()
{
PRINTF("ATD0123456789;\n\r");
}
//Light sensor triggered
void SEND_CALL3()
{
PRINTF("ATD0123456789;\n\r");
}
//Door sensor triggered
void SEND_cALL4()
{
PRINTF("ATD0123456789;\n\r");
}
#INT_RTCC
T0()
{
SENSOR1=INPUT(ULTRA);
SENSOR2=INPUT(TOUCH);
SENSOR3=INPUT(LIGHT);
SENSOR4=INPUT(DOOR);
if(SENSOR1)
{
SEND_CALL1();
SIREN_ON();
}
else if(SENSOR2)
{
SEND_CALL2();
SIREN_ON();
}
else if(SENSOR3)
{
SEND_CALL3();
SIREN_ON();
}
else if(SENSOR4)
{
SEND_CALL4();
SIREN_ON();
}
}
void MAIN()
{
SET_RTCC(0);
SETUP_COUNTERS(RTCC_INTERNAL,RTCC_DIV_64);
EXT_INT_EDGE(0,H_TO_L);
ENABLE_INTERRUPTS(INT_EXT);
ENABLE_INTERRUPTS(INT_RDA);
ENABLE_INTERRUPTS(GLOBAL);
}
#INT_RDA
SERIAL()
{
//Optional
if(kbhit())
{
TEMP=GETC();
if(A<50)
{
S[A]=TEMP;
A++;
}
else
{
A=0;
S[A]=TEMP;
A++;
}
}
DELAY_MS(100);
return A,S;
}
The source code had been burn into a PIC16F877 whereby a RS232 had been connected to the Pin_c6 and Pin_c7 of the PIC, with the output from the RS232 connected with a DB9 cable to a cell phone.
However, there's no output transmitted when any of the in input triggered.
Can anyone help~?
The connection of the enired circuit shouldn't have any problem as i followed and confirmed from a few sources... They does the same almost... Running out of ideas...
I'm trying to work on a project with that triggering any input of the PIC16F877a would actually send dial the connected cell phone... Below is my .c file>>
//Preprocessor
#INCLUDE <16F877.H>
#FUSES HS,NOWDT,NOLVP
#USE DELAY(clock=12000000)
#USE RS232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
//Define pin
#DEFINE SIREN PIN_B5
#DEFINE CL1 PIN_B4
#DEFINE CL2 PIN_B3
#DEFINE ULTRA PIN_A0
#DEFINE TOUCH PIN_A1
#DEFINE LIGHT PIN_A2
#DEFINE DOOR PIN_A3
//Global declaration
int A,B,C,D;
char SENSOR1, SENSOR2, SENSOR3, SENSOR4, TEMP;
char S[51];
//Sound siren
void SIREN_ON()
{
OUTPUT_HIGH(SIREN);
DISABLE_INTERRUPTS(INT_RTCC);
}
//Unlock doors
void UNLOCK()
{
OUTPUT_HIGH(CL1);
OUTPUT_LOW(CL2);
}
//Lock doors
void LOCK()
{
OUTPUT_LOW(CL1);
OUTPUT_HIGH(CL2);
}
//Ultrasonic sensor triggered
void SEND_CALL1()
{
PRINTF("ATD0123456789;\n\r");
}
//Touch sensor triggered
void SEND_CALL2()
{
PRINTF("ATD0123456789;\n\r");
}
//Light sensor triggered
void SEND_CALL3()
{
PRINTF("ATD0123456789;\n\r");
}
//Door sensor triggered
void SEND_cALL4()
{
PRINTF("ATD0123456789;\n\r");
}
#INT_RTCC
T0()
{
SENSOR1=INPUT(ULTRA);
SENSOR2=INPUT(TOUCH);
SENSOR3=INPUT(LIGHT);
SENSOR4=INPUT(DOOR);
if(SENSOR1)
{
SEND_CALL1();
SIREN_ON();
}
else if(SENSOR2)
{
SEND_CALL2();
SIREN_ON();
}
else if(SENSOR3)
{
SEND_CALL3();
SIREN_ON();
}
else if(SENSOR4)
{
SEND_CALL4();
SIREN_ON();
}
}
void MAIN()
{
SET_RTCC(0);
SETUP_COUNTERS(RTCC_INTERNAL,RTCC_DIV_64);
EXT_INT_EDGE(0,H_TO_L);
ENABLE_INTERRUPTS(INT_EXT);
ENABLE_INTERRUPTS(INT_RDA);
ENABLE_INTERRUPTS(GLOBAL);
}
#INT_RDA
SERIAL()
{
//Optional
if(kbhit())
{
TEMP=GETC();
if(A<50)
{
S[A]=TEMP;
A++;
}
else
{
A=0;
S[A]=TEMP;
A++;
}
}
DELAY_MS(100);
return A,S;
}
The source code had been burn into a PIC16F877 whereby a RS232 had been connected to the Pin_c6 and Pin_c7 of the PIC, with the output from the RS232 connected with a DB9 cable to a cell phone.
However, there's no output transmitted when any of the in input triggered.
Can anyone help~?
The connection of the enired circuit shouldn't have any problem as i followed and confirmed from a few sources... They does the same almost... Running out of ideas...