We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I use GSM Module(Wavecom 2686) to send SMS. Communication to the module is through the serial port (RXD,TXD).I tested the module by sending AT commands (as per the GSM Module Catalogue). Now I have to do the same using my uC(AT89S52). I tried to send the commands using printf function as given in the "Hello World" example. For this I initialised the controller for 9600 baud rate and other SFRs. Also included STDIO.H But it is not working and remains in the printf command without completing. What could be the reason? Pls note that I have very limited knowledge in programming.
Should you do this project if you have very limited knowledge of programming?
It is way easier to start with simple applications and increase the complexity as you learn.
Are your serial port initialized to be interrupt driven? Have you configured it to start transmitting?
By very limited knowledge, I meant i am not a professional in programming. But I have done projects with serial communication. In this case I could send the string data through the serial port in a different method and it worked. Then I tried to include <stdio.h> as done in the example. Here I face the problem.
Have you modified the putchar function to actually do anything with the output of your printf?
It doesn't automatically get connected to your serial peripheral, you have to add the hardware/driver bit to connect them together.
A default implementation is provided that does automatically connect to something - see the manual for details.
Have you got the "Hello, world" sample working?
The "Hello Word" sample is working
I have not modified the putchar function. What do you mean by "add the hardware/driver bit"
So take that as your starting point:
Modify it to also receive characters;
Verify that it can send to Hyperterminal (or whatever), and receive from Hyperterminal;
Then modify it to send AT<CR> to the modem, and verify that you get the OK response...
Yes. Now I am able to send.
I give below my program for sending a string through the serial port.During debugging it is working and giving the text in the serial window . But when I gave it through the RS232 interface IC (HIN 232) to the serial port of PC and tried to see the string with Hyperterminal, I am not getting the string displayed. Could it be any problem in my program? Any guidance will be highly appreciated
#include <At89x52.h> #include <stdio.h> void init(void); void main(void) { init(); while(1) { printf("This is a trial message\n"); } } void init(void) { SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD = 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 0xfd; TL1 = 0xfd; /* TH1: reload value for 9600 baud @ 11.0592MHz */ TR1 = 1; /* TR1: timer 1 run */ TI = 1; TL0 = 0x00; TH0 = 0x00; }