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.

Help me in Matlab, Serial Port & AT commands

Status
Not open for further replies.

Eng_Bandar

Junior Member level 3
Joined
Aug 7, 2010
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,472
Hi all,

I want make code by matlab to send SMS through Nokia mobile and this mobile support AT commands. I use usb cable to connect mobile with computer. ( I think problem from usb but I am not sure )


Code:
s = serial('COM3');
set(s,'BaudRate',9600);
fopen(s);
tx='AT+CMGS="xxxxxxxxx"'; 
// where xxxxxxxx mobile number and AT+CMGS protocol to send sms by mobile 
fprintf(s,'%s',tx);
a = 'ss';
fprintf(s,'%s',a);
fclose(s) 
delete(s) 
clear s

but when I run the code nothing happen.
 

I don't know how can I check response of the mobile using Serial port?
please help :cry:
 

I don't know how can I check response of the mobile using Serial port?

then maybe you want to start from the very basic tasks before attempting something far out of your capabilities.

a majority of the issues we encounter on this forum come from folks who want to sprint before they know how to walk. It is so much easier and better for you if you build up your knowledge and skills from the ground up, one step at a time.

try something that's within your grasp first.
 

Good day,

if you want to communicate with AT Command protocaol you need to add :

Carriage return and line feed after each command :

example : AT + chr(13) + chr(10)
 

then maybe you want to start from the very basic tasks before attempting something far out of your capabilities.

a majority of the issues we encounter on this forum come from folks who want to sprint before they know how to walk. It is so much easier and better for you if you build up your knowledge and skills from the ground up, one step at a time.

try something that's within your grasp first.

I know truth if you don't ask you don't learn to ever. if you want help me thanks for it if you don't also thank you. rather than this philosophy can you give me some good links for help me

UPUPUPUP

---------- Post added at 04:34 PM ---------- Previous post was at 04:33 PM ----------

Good day,

if you want to communicate with AT Command protocaol you need to add :

Carriage return and line feed after each command :

example : AT + chr(13) + chr(10)

Thank you the_balistic for your reply

Can you give me simple example?
thank you guy
 

Before test with matlab, did you check by sending AT command "AT" to the phone using the hyper-terminal

once you get the response message ("OK") then you can test the same using matlab as below

Code:
s = serial('COM3');
set(s,'BaudRate',9600);
fopen(s);
tx='AT';  
fprintf(s,'%s',tx);
out = fscanf(s)
fclose(s)

if you get the response for this then you may follow the same steps to send SMS using "AT+CMGS"
 

Before test with matlab, did you check by sending AT command "AT" to the phone using the hyper-terminal

once you get the response message ("OK") then you can test the same using matlab as below

Code:
s = serial('COM3');
set(s,'BaudRate',9600);
fopen(s);
tx='AT';  
fprintf(s,'%s',tx);
out = fscanf(s)
fclose(s)

if you get the response for this then you may follow the same steps to send SMS using "AT+CMGS"

Thank you bassa for your help

yes, I checked the AT command and my mobile support it (I sent messege by hyper-terminal and it is work perfect)
I will try your code.

Thank you again
 

My mobile support AT commands. I tried by Hyper Terminal to send SMS and it is work perfectly.

this is command to send SMS
AT+CMGS="xxxxxxxxx" // where XXX.. number of mobile

In hyper terminal first send AT+CMGS="xxxxxxxxx" and press Enter (how make Enter action in MikroC Pro) then write your message then press Ctrl+z to send message but also same problem how make Ctrl+z action in MikroC Pro.

I tried to send AT+CMGS="xxxxxxxxx" to matlab and matlab recieved it correctlly. but if I write like this

Code:
UART1_Write_text("AT+CMGS="xxxxxxxxx"");
it give me error I know why, because I must write like this
Code:
UART1_Write_text("AT+CMGS='xxxxxxxxx'");
but in this case I can't send SMS because number must be between " " not between ' '

this is result in matlab

**broken link removed**

I hope my problem clear.
 

if I write this

Code:
'AT+CMGS="xxxxxxxxx"'
this will give me error in MikroC Pro compiler
 

'AT+CMGS="xxxxxxxxx"' for matlab not for MikroC.

if you wish to post the MikroC code/part with your problems then anyone can understand the matter clearly
 

'AT+CMGS="xxxxxxxxx"' for matlab not for MikroC.

if you wish to post the MikroC code/part with your problems then anyone can understand the matter clearly

Hi bassa,

I want sent it from PIC to Matlab not from Matlab to PIC because I don't need for this.
Now I can send AT+CMGS="xxxxxxxxx" and this is result in matlab
**broken link removed**

but how make Enter action in MikroC Pro after this how make Ctrl+z action in MikroC Pro this action to send message.
 

I succeed in SMS and make calling. Every thing was correct, problem was from code until now I don't know why this not work

UART1_Write_text("AT+CMGS=\"00966557531053\"");

I seperated it like this (AT+CMGS= ) (") (00966557531053) (") and send them part by part and it work.

I think problem from buffer but I am not sure and about usb connection here, find PC suite software from Nokia to make virtual serial port for usb and it is appearing in my pictures above


Thank you bassa
 

hi
i want to send sms through matlab script
i already done it in hyperterminal, i works
but i m unable to do it in matlab.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top