Discussion in "Embedded GSM Development" started by    viniciusheidrun    Apr 17, 2014.
Thu Apr 17 2014, 09:58 pm
#1
I'm doing a drive system with SIM900D modem and microcontroller AT89S52 via sms. I'm having trouble can not generate the. Hex to send to the microcontroller, whenever I compile the error, I'm using MCU 8051 IDE, what should I do so that my system receive sms and perform my task? - See more at: http://www.8051projects.net/forum.html#sthash.GYV11scw.dpuf
Fri Apr 18 2014, 04:45 pm
#2
Post the error and your code to help you better.
Thu Apr 24 2014, 11:41 pm
#3
I need this code in Assembly.

#include<reg51.h>
#define port P1
#define dataport P2 // Data port for LCD
sbit rs = port^0;
sbit rw = port^1;
sbit en = port^2;
int count,i;
unsigned char check,str[15];
bit check_space ;

void init_serial() // Initialize serial port
{
TMOD=0x20; // Mode=2
TH1=0xfd; // 9600 baud
SCON=0x50; // Serial mode=1, 8-Bit data, 1 Stop bit, 1 Start bit, Receiving on
TR1=1; // Start timer
}
void delay(unsigned int msec ) // Function for delay
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0; j<1275; j++);
}

void lcd_cmd(unsigned char item) // Function to send command on LCD
{
dataport = item;
rs= 0;
rw=0;
en=1;
delay(1);
en=0;
return;
}

void lcd_data(unsigned char item) // Function to display character on LCD
{
dataport = item;
rs= 1;
rw=0;
en=1;
delay(1);
en=0;
return;
}

void lcd_data_string(unsigned char *str) // Function to display string on LCD
{
int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
delay(10);
}
return;
}
void lcd()
{
lcd_cmd(0x38); // For using 8-bit 2 row LCD
delay(5);
lcd_cmd(0x0F); // For display on, cursor blinking
delay(5);
lcd_cmd(0x80); // Set the cursor on first position of lcd
delay(5);
}



void receive_data() interrupt 4 // Function to recieve data serialy from RS232 into microcontroller
{
str[++count]=SBUF; //Read SBUF
RI=0;
}

unsigned char byte_check() //Function to check carraige return and new line character
{
switch(str[0])
{
case 0x0a:
{ // Return 0x00 for new line
return 0x00;
break ;
}
case 0x0d:
{ // Return 0x01 for carriage return
return 0x1;
break ;
}
default:return 0x02 ; // Return 0x02 for characters except new line and carriage return
}
}

void main()
{
lcd(); // Initialize LCD
init_serial(); // Initialize serial port
count=(-1);
lcd_data_string("Ready");
delay(10);
lcd_cmd(0x01);
IE=0x94;
while(1)
{
if(count>=0)
{
check=byte_check(); //Check the character
if(check!=0x00)
{
if(check==0x01)
{
if(check_space==1) //Check previous character
{
lcd_data(0x20);
check_space=0;
}
}
else
{
lcd_data(str[0]);
check_space=1;
}
}
count--;
for(i=0;i<count;i++) // Shift the whole array to one left
{
str[i]=str[i];
}
}
}
}
Fri Apr 25 2014, 11:27 am
#4
I am sorry we are here to help only but not for writing codes. If you're facing issues with your code we can help you fix them and guide you with right inputs. But we do not write codes for anyone.
Fri Apr 25 2014, 03:49 pm
#5
Sorry, I just have some difficulty with assembly so I asked for help for the conversion of codes. Thanks in advance
Fri Apr 25 2014, 11:29 pm
#6
In your first post you said there was an error.
We can help with errors messages if you tell us exactly what they say.

Converting the full code is complicated and would take a lot of time to write and test.
Members here will help, if you get problems you can't solve, but we can't do the whole code for you.

Why convert to assembly ?

It might be better to find similar code written in assembly and modify it.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am
Anthonyvab
Wed Apr 17 2024, 08:48 am
RobertCix
Wed Apr 17 2024, 06:46 am