Discussion in "8051 Discussion Forum" started by    say2paul    Jul 9, 2008.
Wed Jul 09 2008, 11:59 pm
#1
Working in embedded is really a challenge for me, maybe I am newbie...

This time I am lost. I successfully interfaced LCD with AT89C51 then I interfaced RS232 (hyperterminal) using MAX232 with 8051.

Now whatever I type in the hyperterminal get displayed on the LCD (Woww!).

Please please please can any one from you know help me to display the data I send from Mobile phone Infrared using the TSOP 1738 directly connected to the RX pin of AT89C51.

I am using the same code (below) that I am using to scan the data from hyper terminal, Can anyone please help me in the code.

#include<stdio.h>

#include <AT89X51.H>

#include<intrins.h>

#include<string.h>


/*----------------------------------------------------
****** port and bit assignment for LCD *******
----------------------------------------------------*/

typedef unsigned char bit_8;

sbit rs=P3^5;					// register select is port 3.5
sbit rw=P3^4;					// read/write is port 3.4
sbit en=P3^3;					// enable is port 3.3
sbit d7=P1^7;					// busy flag is port 1.7

/*-------------------------
*** Function Prototypes ***
-------------------------*/

void ini(void);
void command(bit_8);
void data_in(bit_8*);
void busy(void);

/*-------------------------------
*** Main programe starts here ***
-------------------------------*/

void main()
{

	unsigned char	M[10];

	SCON = 0x50;
	TMOD = 0x21;
	TH1  = 0xfd;
	TL1  = 0xfd;
	TCON = 0x45;
	TR1=1;	

	ini();
	data_in("Hello: ");

	while(1)
	{ 
	TI=1;	 	

	printf("Please enter the name\n");

	scanf("%9s", M);
	printf("\r The name enetered by you is: %9s\n", M);
	data_in(M); //send a string for display
	}

}


/*--------------------------
*** initialising the LCD ***
--------------------------*/

void ini()
{	
command(0x38);
command(0x06);
command(0x0e);

command(0x01); //Clear the display


}

/*----------------------------
*** checking the busy flag ***
----------------------------*/

void busy()
{
	d7=1;
	rs=0;
	rw=1;
	while(d7!=0)
	{
		en=0;
		en=1;
	}
}

/*-------------------------
*** send command to LCD ***
-------------------------*/

void command(bit_8 val)
{
	busy();
	P1=val;
	rs=0;
	rw=0;
	en=1;
	en=0;
}

/*--------------------------
*** entering data to LCD ***
--------------------------*/

void data_in(bit_8 *string)
{
	//char string1[40] = "Hello baby how are you";

	char i;
	busy();
	for(i=0;string[i]!='\0';i++)
		{
			P1=string[i];
			rs=1;
			rw=0;
			en=1;
			en=0;
		}
}




I noticed a strange thing when I connected data pin of TSOP 1738 with RX pin of 8051, i.e. TSOP 1738 is sending some random garbage characters to the LCD screen without even scaning the data.

I noticed one more thing that when I placed my T.V. remote towards the TSOP 1738 and pressed few buttons then I saw "pppppppppppppp" characters on the LCD.

But unfortunately when I tried to send data from my mobile phone, TSOP doesn't reacted

PLEASE HELP!!
Thu Jul 10 2008, 09:52 am
#2
Any Idea...

Do I need to change the baud rate from 9600 to 38400?

Or do I have to connect something between TSOP 1738 data pin and 8051 RX pin??

FYI: I am sending data from mobile phone IR using IrSIR at 38400 bps, 8 data bits and 1 stop bits. for more information please visit http://www.newlc.com/article.php3?id_article=438


[ Edited Thu Jul 10 2008, 09:52 am ]
Thu Jul 10 2008, 10:19 am
#3
Hey Paul plz avoid starting multiple threads for the same topic.
You already have these threads discussing the same problem....
http://www.8051projects.net/forum-t5286-last.html
http://www.8051projects.net/forum-t10624-last.html
http://www.8051projects.net/forum-t10612-last.html
http://www.8051projects.net/forum-t10181.html

You also have your solution in them.Do go through them carefully and ask what you do not understand.
Starting a new thread won't work.
Thu Jul 10 2008, 10:23 am
#4
I am sorry, but this is the final thread I want to continue.

Hope you don't mind to help me on this final Thread.



[ Edited Thu Jul 10 2008, 10:24 am ]
Thu Jul 10 2008, 12:37 pm
#5
good

but still no help
Thu Jul 10 2008, 12:49 pm
#6
Well for you information dear... I have just initiated a two threads ever (before this one) and that are http://www.8051projects.net/forum-t10624-last.html and http://www.8051projects.net/forum-t10181.html

In other threads from which one was initiated by someone else and the one is in which I never discussed the word IR is also mentioned above (Woww!)

I am a newbie in your world as I started my R&D in micro controllers and electronic designs on 17 June 2008. I am feeling guilty that why I had done my B.Tech. in Information Technology instead of electronics.

But don't worry friends, the passion is still alive. Someday somehow someone will surely help me to achieve the above mentioned feature.

May be you people feel that why should we help him.. he is posting too much..

Please for God sake try to think why I am posting too much, because I am new to this field and I want to achieve something at a faster pace.

Anyways I am sorry if I said something that made you feel bad!


[ Edited Thu Jul 10 2008, 12:52 pm ]
Thu Jul 10 2008, 02:16 pm
#7
hey paul you seem to be very emotional, seem to self-pity yourself

first decide what your project aim is, for instance in this thread :

1) you have a code which transmits serial data on LCD

2) you are trying to use the same code to interface a IR receiver( without changing baudrate, in code its set to 9600 - should change to below 2400, 1200 is better )

3) you are getting some garbage when Tsop1738 it connected ( serial frame is not recognised by the micro)

4) you are trying to read from a TV remote ( which is not 8bit,1 stop bit,No parity serial Data -its probably RC5)

5) you are trying to read from mobile SIR ( different protocol altogether)


you are trying to mix up things and expect results, sorry this approach doesn't work in micro world.




Arun



 say2paul like this.
Thu Jul 10 2008, 03:08 pm
#8
Thanks Arun,

The Aim is to simply send a data from a Symbian mobile phone to the 8051 micro controller so that I can control relays/LCD connected to 8051.

I did a detailed R&D and found that Symbian dose not support FBUS and MBUS. The only thing left is IR or Bluetooth. I found IR easier than bluetooth.

Finally somehow the link http://www.newlc.com/article.php3?id_article=438 helped me to transmit data from Symbian mobile phone using IrSIR (bypass IRDA protocol).

Then I transmitted the ASCII data (IrSIR) from one mobile at "9600 bps, 8 data bits and 1 stop bits" and received the same at other mobile phone successfully.

Then I interfaced 8051 with RS232 of my PC just to see how can I transmit/receive data between micro controller and other device so that I can further replace my PC with the Infrared receiver. I successfully transmitted ASCII data between PC (Hyper Terminal) and micro controller at 9600 baud rates and displayed the same on LCD (attached to 8051).

Now the final left out bit is to send the ASCII data from mobile phone IR to the 8051 micro controller using TSOP 1738. I literally do not know how to receive Raw IR data from TSOP 1738, in one of the post Ajay Bhargav mentioned that I can connect TSOP data pin directly to the 8051 RX pin to receive the IrSIR data. I did accordingly and rest is history...!

I hope the picture is clear to you. I don't know whether my approach is correct or not but this is what I found in last few days of my R&D.

As you people are expert in this field, you can guide me in a better way to achieve the above mentioned whether in the same approach or different.



[ Edited Thu Jul 10 2008, 03:13 pm ]
Thu Jul 10 2008, 04:13 pm
#9
Hey Paul,

Then I transmitted the ASCII data (IrSIR) from one mobile at "9600 bps, 8 data bits and 1 stop bits" and received the same at other mobile phone successfully.



but you are using TSOP1738 which can transfer data @ max 2400bps and not 9600bps, here's the part of Datasheet.






same thing i have mentioned in my last post (1200bps is better)

complete your project in two steps:

1) First, do a project by implementing IR serial communication between PC-8051 or 8051-8051, no need of duplex mode a simplex mode will do i,e one device transmits and other just receives . in the TX side you have to modulate the serial data which is set to 1200bps 8-N-1 with a 38Khz carrier (using 555 IC)

at the Rx side use TSOP1738, Inverting gate /transistor connect to Rx pin and display the Data on LCD

once you are successful with this proceed to next step.


2) now implement SIR between Mobile and 8051, study the SIR Protcol of the symbian mobile and reduce the baudrate to 1200bps in the mobile and try communicating with 8051






Arun


[ Edited Tue Jul 15 2008, 01:59 pm ]
 say2paul like this.
Thu Jul 10 2008, 04:32 pm
#10
Thanks a lot Arun, I didn't know that

I will surely try to implement IR serial communication between PC-8051 or 8051-8051. But again I do not have in detail information to proceed. Do I need to start a new thread for comm between PC-8051/8051-8051 or can you help me further in this thread.

I think I should proceed with the 8051-8051 IR serial communication. It will be easier for me if you can guide me using a circuit or design for the same.






[ Edited Thu Jul 10 2008, 05:06 pm ]

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Michailqfh
Fri Mar 29 2024, 01:53 am
Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm