Discussion in "8051 Discussion Forum" started by    hotzinfo    Sep 18, 2010.
Mon Oct 04 2010, 05:42 pm
#21
hello mazoka and ajay ...
Thanks for the help..

Mazoka. i checked ur above code with hardware
 while(1)
        {
                SBUF='P';
                while(TI==0);
                TI=0;      
                DelayMs(1000);

and rx
while(RI==0);
                                a=SBUF;
                if(a=='P')
                                led=~led;
                RI=0;


but my led didn't lit up for any time while when i check transmitter on terminal program it was sending 'P' accordingly.

i modified in rx code to test deeply
#include<reg51.h>

void DelayMs(unsigned int) ;
sbit led1 = P2^0;
sbit led2 =P2^1;

void main()
{
            unsigned char a;
        TMOD=0x20;
        TL1=0xE8;
        TH1=0xE8;  // baud rate 1200 bps
        SCON=0x50;
        TR1=1;

        while(1)
        {

                while(RI==0);
                                a=SBUF;
                if(a=='P')	   {
                                led1=~led1;
								DelayMs(1000);
                				}
             	else
					{led2=~led2;
					DelayMs(1000); }
					RI=0;
       
        }
}

//---------------------------------------
// Delay mS function
//---------------------------------------
void DelayMs(unsigned int count)
{  // mSec Delay 11.0592 Mhz
    unsigned int i;                            
    while(count) {
        i = 115;
                while(i>
0) i--;
        count--;
    }
}


so led2 was blinking .it means receiver was not going in to if loop ....i don't know y...?? while all connections were right..
so please help..?? now what i need to do..??

Mon Oct 04 2010, 05:54 pm
#22
one more strange thing i observed today..
while checking i thought to check both circuit(Rx and Tx) with same code. i put them Tx code . now when i checked each circuit individually on terminal program, i noticed that both circuit were transmitting different content...
while one circuit was transmitting 'P' another was transmitting another bit 'S'...

isn't the cause of problem that one circuit is interpreting the same code as another bit..??

but when i used only one circuit , only changed the Micro controller ,they both were transmitting same data 'P' .
and on another circuit both were transmitting 'S'

is it the root of the problem. what is the reason behind it..??

i am using two micro controller AT89S51.
Mon Oct 04 2010, 09:56 pm
#23
hi pash119

but my led didn't lit up for any time while when i check transmitter on terminal program it was sending 'P' accordingly.


it mean that receiver is not receiving the 'P' thats why led is not blinking.

so led2 was blinking .it means receiver was not going in to if loop ....i don't know y...??


that is not comming in the loop becoz it do not recieve 'P' it goes in else and blink led2

i noticed that both circuit were transmitting different content...
while one circuit was transmitting 'P' another was transmitting another bit 'S'...


it mean ur one circuit has a problem that is transmitting 'S' that hardware has some fault and i suggest you to change that hardware crystal oscillator first and see soldering once again of that circuit that is ur problem so led1 is not blinking

isn't the cause of problem that one circuit is interpreting the same code as another bit..??


yes this is the problem that waste a lot of time of you

but when i used only one circuit , only changed the Micro controller ,they both were transmitting same data 'P' .
and on another circuit both were transmitting 'S'


it is clear that both controllers are ok one hardware has problem that is transmittting 'S' so change its crystal first

is it the root of the problem. what is the reason behind it..??


yes this is the root of problem i think crystall losses its frequency i also suggest you to change 33 pf capacitor also so no doubt remains and try to transmit 'P' again on both hardware if both transmit 'P' it mean problem is solved
then u again check that with wireless modules if get work then fine else use encoder decoder but before that hardware should be fine working with wire
change crystal and update here
Tue Oct 05 2010, 05:55 pm
#24
Thanks mazoka...
i changed my crystal of receiver circuit faulty. now i changed that and tested.
both circuit now transmitting 'P'. ile

now when i checked your code by wired connection led started blinking.
and when i checked it through wireless. it again disappointed me..mostly. but one time led was lit up....only one time.:(

now i feel i need to check it by encoder-decoder IC.

i still confuse with the connection, as in the above circuit you have post here, i need to connect only one data line(Tx/Rx) to any of the AD0-AD11 of encoder IC (i mean either of pin no 10/11/12/13).

so what would be status of rest of the lines(of pin no 10or 11or12)..do in need to keep them open or connect to Vcc .

what should i do now..??
Tue Oct 05 2010, 06:25 pm
#25
there are many options that's pin r for setting addressing of transmitter and receiver u can ground all pins or connect to vcc as u wish but same configuration should be on both transmitter and receiver sides.
to leave it empty is not a better option i think connect them to vcc otherwise connect all to ground
its input is 4 bit no and its output is serially out data see its data sheet i think ur confusing now u dnt need to use uart


[ Edited Tue Oct 05 2010, 06:36 pm ]
Wed Oct 06 2010, 10:13 pm
#26
Dear Sir,
I rechecked my circuit with encoder and decoder IC as shown in figure . Please check it and tell me if i am wrong somewhere in circuit.

well result was not as expected .NO Led was blinking at all.

Transmitter side
i tried to check the transmitter and receiver pins, i found some interesting result. i checked DOUT pin of Encoder 12E . it was transmitting some bit pattern like this

01 C0 01 C0 01 C0 01 C0 01 C0 01 C0 01 C0 01 C0



at same time when i checked Encoder HT12E pin AD8 Of transmitter , it was transmitting as according to the program

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP




in Receiver side
when i checked DIN pin of HT12D to check whta the receiver was receiving i found the following pattern

C0 07 C0 03 C0 07 C0 03 C0 07 C0 07 C0 07 C0 07


but same time data at pin no AD8 of HT12D was giving nothing.
i mean there was no data at this pin....

what does this conclude?? is there any problem in decoder IC..?? or something else..??
what should i do now..?? help me..
i am attaching the log file for tx and rx data for more insight.

Thu Oct 07 2010, 01:31 am
#27
here ur doing a mistake that ur giving a input in serial using uart to encoder it can not accept the serial data to transmit it accept 4 bit input data and transmit that
on receiving side ur ding same refer to its data sheet and see this and also see the last diagram i provide u there u see that 4 inputs are in of encoder see also this


Thu Oct 07 2010, 01:36 am
#28
if still not understand then post ur circuit diagram that u made on hardware then according to that i make code for u
Thu Oct 07 2010, 10:44 am
#29
thanks mazoka..
i got confused here.
let me tell you my overall objective. i want to control up to 8 devices through wireless. first i wanted to learn firstly just how to switch them on off simply,later i wanted to control 8 motors by 8 different potentiometers.

This is my over all objective. so for that reason i interfaced firstly 4 switches to a micro-controller (called it transmitter) and then simply transmit serial data through RF .
and put some led on receiver to see its response.

now confusion creates here, if i use encoder IC then i think i will be able to control not more than 4 devices.(but how i still don't know ) and there will be no need of micro-controller at transmitter side at that time. am i right..??

what about the receiver..?? i think it need a controller other than Decoder IC.

so please tell me what should be the circuit diagram now .?? and how my main motive will be achieved?

actually i want to make such kind of remote control system on 8051. please go through this link...http://extremeelectronics.co.in/avr-tutorials/rf-communication-between-microcontrollers-%E2%80%93-part-iii/
Thu Oct 07 2010, 12:38 pm
#30
ok i see it nice thing

now confusion creates here, if i use encoder IC then i think i will be able to control not more than 4 devices.(but how i still don't know ) and there will be no need of micro-controller at transmitter side at that time. am i right..??



encoder input is in the form of 4 bit data so simply using 4 bits u can control 16 devices as 2^4=16 so clear this thing first and u can do in coding that let say u want to transmit data of 8 bits then u have to break it in nibbles (4 bits) and then transmit it one by one and at receiver end this data received (2 times in 4 bits) form and combine it again in 8 bit no in this way u can control 2^8=256 devices
it is better option that u use controller for easiness in using directly alot of push button needed to select address and data so use micro controller
let say port 1 of micro controller is a port that is attach to encoder
p1.0=AD8 of encoder
p1.1=AD9 of encoder
p1.2=AD10 of encoder
p1.3=AD11 of encoder
and let say p3.7=TE (14 pin of encoder)
ground A0,A1,.........A7
now u dnt need of uart to transmit data let say our data is 1
then P1=0X01;
and low p3.7 that is attach to TE (14 pin of encoder) now encoder will serially transmit data to DOUT (17 pin) at some speed now after some time high p3.7 becoz we dnt need to transmit again and again now transmitter part is ok
at receiver side same connection do
ground A0,A1,.........A7
here 14 pin is VT means valid transmission when oin goes low it mean data come on port1 so read port and see is it one if 0x01it means on relay 1........etc
hope so now u understand i told u about wireless door bell that use same pair of encoder and decoder trick behind is same just ic no is different as i post all data pdf in previous posts.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

masagnik1226.ru_gpEn
Sun May 12 2024, 06:50 am
Martinorics
Sun May 12 2024, 02:03 am
Nigarcarm
Sat May 11 2024, 11:22 pm
JefferyBrazy
Sat May 11 2024, 02:33 pm
autogCar
Sat May 11 2024, 03:38 am
Dulcehet
Fri May 10 2024, 04:22 pm
ElvasKl
Fri May 10 2024, 04:54 am
RonaldNak
Thu May 09 2024, 07:45 pm