yousafzai82
Member level 4
Hi all..
I am using CCS C Compiler.. My code is given below. Please chech whether it will send AT commands correctly to send the ADC result..
I am getting the error messages
"Improper use of fucntion identifier" at line printf("AT\r\n");
and undefined identifier at line "send_SMS();"
I am using CCS C Compiler.. My code is given below. Please chech whether it will send AT commands correctly to send the ADC result..
#include<16F877.h>
#device ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT,PUT
#use delay(clock=10000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=RS232,bits=8)
#include<stdio.h>
#include<math.h>
#include<STDLIB.H>
//#include "C:\Program files\PICC\Devices\16f877.h"
#Byte PortA=0x05
#Byte PortB=0x06
#use fast_io(A)
#use fast_io(B)
#Define Nop #Asm Nop #EndAsm
int16 value;
float h,V,M;
void main(){
setup_adc( ADC_CLOCK_INTERNAL );
setup_adc_ports( ALL_ANALOG );
set_adc_channel(1);
while(1){
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
delay_ms( 30000);
value = read_adc();
h=0.0078201*value;
if(h<=4)
{
M=2*acos((4-h)/4);
V=10*(16*M/2-16*sin(M/2)+h*4*sin(M/2));
}
else
{
M=2*acos((h-4)/4);
V=10*(16*3.14159*(1-M/(2*3.14159))+h*4*sin(M/2)-16*sin(M/2));
}
send_SMS();
void send_SMS(void)
{
printf("AT\r\n");
delay_ms(5000);
printf("at+cmgf=1\r\n");
delay_ms(5000);
printf("at+cmgs=\"+4478XXXXXXXX\"\r\n");
delay_ms(5000);
printf("%f/n/r",(float)V);
putc(0x1A);
delay_ms(5000);
}
void main()
{
SET_TRIS_A( 0b10000110 );
SET_TRIS_B( 0b00000101 ); delay_ms(1);
send_SMS();
while(1)
{
// Toggle led
PORTA ^= 1;
// Simple delay
delay_ms(500);
}
}
}
I am getting the error messages
"Improper use of fucntion identifier" at line printf("AT\r\n");
and undefined identifier at line "send_SMS();"