Discussion in "8051 Discussion Forum" started by    hotzinfo    Sep 18, 2010.
Thu Sep 30 2010, 05:46 pm
#11
Thanks mazoka for help..
i rechecked my hardware again and again and when i burn your codes on them ,whole transmitter and receiver worked well but with wired connection only.Again with wireless i caught in problem. Transmitter was transmitting data accordingly but receiver received absurd result
I soldered whole circuit on varoboard and grounded with same.
my exact circuit diagram is as follows.(Notice that : i have used port 2 instead of port 1 in transmitter. )


when i checked my codes tx_rx.rar (which i had uploaded earlier) with proteus ,it simulted the code fine.but when i checked it on hardware it shows no result(not even with wire )



i tried to make two codes(assembly as well as in c) (checksum bit based filtering data). but they too are not successful on even proteus. ... i am attaching these two codes here. please help me by telling me about my mistakes..

i still tried it with encoder and decoder ic(HT12E and 12D). but again failure.....:(
i am really worried about it. i am running out of time .please help me urgently...do i need to change RF..??


[ Edited Thu Sep 30 2010, 05:51 pm ]
Thu Sep 30 2010, 05:53 pm
#12
my circuit diagram is as follows (Notice i have changed to port 2 instead of port 1 in transmitter)

Fri Oct 01 2010, 12:30 am
#13
hi pash119
i see the code u posted above and correct that there was some errors
in c tx code
error was u was adding a
0x25=37 decimal
0x62=98 decimal
0xf0= 240 decimal becoz all high 4 bits of ports were at logic one so read as 0xf0
now u add it
37+98+240=375 it should be saved in int but u save it in char so loosing higher byte of data
in Proteus i ground higher 4 pins of port now data read is 0x08=8 in decimal

in c receiver side
edit code as
if ((a+b+c+d)==0) continue;
other is all right

now come to the asm
in asm tx side code u forget to add a line after JNB TI,$ in TX function now i correct it

in asm rx code
in receiver function CLR TI should be before return not before JNB RI,$
other is all right i upload the new edited code and Proteus diagram

now come to ur 2nd problem
i am feeling that ur RF portion is doing problems
i purchased a sparkfun module RF-433 tx and rx from 1 year ago and i was also getting the same problem as u it doe't mean that spaerk fun makinh faulti modules but i think by chance i get faulty even on sparkfun site people use it with AVR and with some trick i problem was that i was getting a noise every time not recieved a correct data sent by transmitter
it is better to replace module if time is short then and if ucan do it easily other wise i hav a shortcut that i used after a long struggle
as u listen a name wireless doorbell normally it uses the circuit as i upload in word file the brief description is in the file but this type of door bell is not for our demand
our demand can full filled by that wireless door bell which uses a LP801B and LP8029M4 RF transmitter and receiver encoder and decoder it is a china product so i hardly find its data sheet in Chinese language i am uploading that also here
so u get it then ur work become easy and not necessary that its uses this pair may be uses any other pair but should be encoder decoder pair


[ Edited Fri Oct 01 2010, 12:34 am ]
Fri Oct 01 2010, 12:35 am
#14
all attachments are here

Attachment


Attachment

Attachment
 pash119 like this.
Fri Oct 01 2010, 01:43 pm
#15
Thank you very much mazoka..you are like a god for me ...i was really depressed for for my projects..thank you once again...for very quick reply.

now i checked the C code and amend it according to you. its working fine on proteus. need to check on hardware still remain.

i find you 100% right in your coding but still i am confused regarding few of my basic concept.

first regarding TX code in C
M agreed that when i kept open the upper ports of tx (P2.0 -P2.3) it takes F as a count. and sum goes out of char limit.

suppose that when i add the bits
(0x25)+(0x62)+(0xFE)=(0x185) which is equivalent to 389(decimal) and (1 10000101) in binary. when i will try to put these value in sum which will be of 8 bit, it will automatically discard the 9th bit which is 1 here.

so finally we would have value in sum 0x85 (or 10000101).
and its 2's compliment/checksum byte would be 0x7B.

so on receiver side when i add all these values (0x25)+(0x62)+(0xFE)+(0x7B)=(0x200)
again in 0x200 , we would be left only with 0x00 which is required for sum check.

so i don't think we need extremely need to ground the upper ports.
even i tried it on proteus,it worked well. i mean only changed in receiver code what u had explained me earlier.

am i right in these calculation?? i need your advice in this matter..

(2) problem is with receiver
i know that you have changed the correct logic but i feel little confusion in it..??

if ((a+b+c+d)!=0) continue; what i made logic in it is...that if sum of a+b+c+d is not equal to zero it should start iteration again,thats why continue statement because sum would be 0 only when correct bit is received. so if the sum of a+b+c+d is equal to 0 meaning condition fails, it would not execute continue statement ,and directly jump over to P2=c; that is what i desired.

i know i am wrong here ,but couldn't justify it..?? please help me on that and share few tips for better coding..??

i 'll check this program on hardware today itself and will get back to you with results..

Thanks once again..
Fri Oct 01 2010, 05:25 pm
#16
Hi majoka...
m back with the hardware test results.

result were not so as i expected. even i found some strange thing in circuit.
when i burn the C codes , receiver didn't give any response while reseting the receiver and transmitter many times. i checked the circuit both with wired connection and by wireless.
but no led lit up...at anytime...

some better result were found when i burn the assembly hex file.
but they were not satisfactory not even with wired connection, because i had to reset the receiver a lot (in fact time by time)
but with wireless too it was failed. No sign of led blinking. no led lit up....

i tested the whole circuit by grounding the transmitter upper ports(Port 2). and by changing the delay given in transmitter program. but all in vain....

what i am suppose to do now..?
should i try encoder HT12E and decoder HT 12D.? i don't know exactly how to interface that IC with Micro-controller's serial port?

please suggest me w
Sat Oct 02 2010, 01:09 am
#17
hi pash119
regarding to ur first problem

first regarding TX code in C


ur right that u say and u will get a result 0 i just point out there nothing else

(2) problem is with receiver


oho ur right i did a mistake here dear sorry for that i dnt want to misguide u ok i explain it for furthure conflict
continue

Passes control to the begining of the loop.

continue causes control to pass to the end of the innermost enclosing while, do, or for statement, at which point the loop continuation condition is re-evaluated. The syntax is simply

continue;

For example,

for (i = 0; i < 20; i++)
  {
    if (array[i] == 0)
      continue;
    array[i] = 1/array[i];
  }

This example changes each element in the array with its reciprocal, but skips elements which are equal to zero.


Sat Oct 02 2010, 01:10 am
#18
Hi pash119,

Its recommended to use encoder/decoder with RF coz modules use NRZ encoding. This has been discussed already in this forum. Please take a look at this post.

http://www.8051projects.net/forum-t32853-post.html
Sat Oct 02 2010, 01:35 am
#19
for hardware point of view condition seem to very critical and strange behavior
as u mention in ur earliest post that

i rechecked my hardware again and again and when i burn your codes on them ,whole transmitter and receiver worked well but with wired connection only.Again with wireless i caught in problem. Transmitter was transmitting data accordingly but receiver received absurd result


it mean hardware is correct wirely then remaining is wireless it mean problem is in rf modules that r not receiving data correctly
last time try it to send a character and check it with wired ones and then wirelessly then i think scenario will be cleared
try this one last time
crystal @ 11.0592 MHz and AT89C51
Tx program
#include<reg51.h>

void DelayMs(unsigned int) ;
void main ()
{
        TMOD=0x20;
        TL1=0xE8;
        TH1=0xE8;   // baud rate 1200 bps only
        SCON=0x50;
        TR1=1;
        while(1)
        {
                SBUF='P';
                while(TI==0);
                TI=0;       
                DelayMs(1000);
}
}


//---------------------------------------
// 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--;
    }
}


Rx program
#include<reg51.h>

sbit led = P1^0;

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')
				led=~led;
                RI=0;
             
       
        }
}


attach a led on port p1.0 ans see that it is blinking or not
do it wirelessly and with wire
when u r doing wirely then ground should be common of both tx and rx portion mean drives both circuit with same supply
in case of wireless ground not common it is better u drive tx and rx portion with two different supplies so ground remain separate try it and tell the results
Sat Oct 02 2010, 02:24 am
#20
as ajay sugguest that should use encoder decoder pair may be thats why my RF module not work at that time i still hav that i will try again but at that time i snt get it in local market so i dnt use it
any how u have so u should have try it for better results
here r the pin connections for these chips




Get Social

Information

Powered by e107 Forum System

Downloads

Comments

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
Jamescon
Thu May 09 2024, 12:52 pm
RobertSkats
Thu May 09 2024, 10:23 am
hvCar
Thu May 09 2024, 05:53 am