 |
 |
| View previous topic :: View next topic |
| Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 26, 2008 4:31 pm |
|
|
You need to post the array declaration statement.
You also need to post the contents of the array, or the code that fills it. |
|
 |
jjacob
Joined: 08 Mar 2008 Posts: 54 Location: PORTUGAL (PORTO)
|
|
Posted: Wed Aug 27, 2008 8:51 am |
|
|
This is my code for testing sending SMS:
| Code: | #include <18F452.h>
#include <stdlib.h>
#include <string.h>
#include <functions_gprs.h>
#define led PIN_A0
void main(){
char op;
int i, analog_sensors=0, freq_sensors=0, sr=0;
long data[32], station=0;
int32 mobile=0;
analog_sensors=9;
freq_sensors=3;
station=123;
mobile=999988877;
output_high(led);
for(i=0;i<16;i++)
data[i]=i;
output_low(led);
send_SMS(data, analog_sensors, freq_sensors, station, mobile);
output_high(led);
} |
The functions_gprs.h :
| Code: | // Config header
#include <config.h>
void send_SMS(long *data, int analog_sensors, int freq_sensors, long station, int32 mobile) {
int i;
fprintf(sms,"at+cmgf=1\r\n");
delay_ms(100);
fprintf(sms,"at+cmgs=%Ld\r\n\n\r", mobile);
delay_ms(100);
fprintf(sms,"%04Ld*", station);
for (i=0;i<analog_sensors;i++)
{
fprintf(sms,"%04Ld*", data[i]);
//data[i]=read_sensor(i);
delay_ms(100);
}
for (i=0;i<freq_sensors;i++)
{
if(i!=freq_sensors-1) fprintf(sms,"%04Ld*", data[i+12]);
else fprintf(sms,"%04Ld%c", data[i+12], 0x1A);
delay_ms(100);
}
//fprintf(sms,"%c", 0x1A);
delay_ms(500);
}
|
The config.h :
| Code: | #fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(stream=SMS, baud=9600, xmit=PIN_C6, rcv=PIN_C7, parity=N, bits=8, stop=1)
//#use rs232(stream=conf, baud=9600, xmit=PIN_??, rcv=PIN_??, parity=N, bits=8, stop=1)
#include <input.c>
#define MAX_ANALOG_SENSORS 12 // The number of Analog Sensors
#define MAX_FREQUENCY_SENSORS 4 // The number of Frequency Sensors
|
Now, after PCM programmer explanation, i think that if i put a while(1) { } after i call the function 'send_SMS' perhaps it would work.
I'm not in my lab, so i can't test this. But am i right ?
Jacob |
|
 |
jjacob
Joined: 08 Mar 2008 Posts: 54 Location: PORTUGAL (PORTO)
|
|
Posted: Wed Aug 27, 2008 1:02 pm |
|
|
Hi,
what i wanted to say in the last two lines of my last post,
is that if i put a while(1) { } after i call send_SMS(...)
in the main(), perhaps the line 'printf("%c", 0x1A)' would work
and it would be not necessary to put the 'if' in the 'for' loop.
Is this true ? I can not test this for the moment.
Thank you
Jacob |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|