output confusion

I use an RF 315/434 MHz ASK RECEIVER and 315/434 MHz ASK TRANSMITTER for the communication between two 89c52 microcontrollers. I am a beginner. In the transmitter microcontroller i use the normal code for transmission of 1,2,3... by using sending some filters 'A' then 'B' and data and then 'Z' to check whether the data is receiving correctly. i use SMOD 0x50 TMOD 0x20 baud rate 9600.
in the main loop

for(i=0;i<100;i++)
                {
                        led=0x00;
                        serial_tx('A'); led=0x01;
                        serial_tx('B'); led=0x01;
                        serial_tx(i);   led=0x01;
                        serial_tx('Z'); led=0x01;
                        msdelay();
                }


in debugger when i is 0 it shows the value i=0x00; when i is 1, i=0x01...

and in the receiver same SMOD 0x50, TMOD 0x20 baud rate 9600,
in serial_read() temp=SBUF is stored

unsigned char temp, temp1, store;
while(1)
        {
                serial_read();
                if(temp=='A')
                {
                        serial_read();
                        if(temp=='B')
                        {
                                serial_read();
                                temp1=temp;
                                serial_read();
                                if(temp=='Z')
                                {
                                        P1=temp1; // data stored and sent to port1

                                }
                        }
                }
        }


here port 1 is connected with 8 led. but i am not sure of how the data sequence is being received. The lights are blinking with some randomness. Any solution regarding this. And the data sent to P1 is in binary ? Thanks in advance.

Parents
  • Binary? What is binary in your view?

    A number is a number. But you can express the value of that number in binary, octal, decimal, hexadecimal or whatever numeric base. It is still a number.

    So your variable has a value [0..99]. When the receiving side picks up this value and places it on the processor port, it will of course be mapped binary. So the least significant bit will toggle fast. Next bit at half the speed. Next bit again at a quarter of the speed.

    Any number written to a processor port will come out as binary, since the mapping of the processor pins is that they have a weight of:

    2^0 = 1
    2^1 = 2
    2^2 = 4
    2^3 = 8
    2^4 = 16
    2^5 = 32
    2^6 = 64
    2^7 = 128

    So they have a binary mapping, and will thereby represent a written value as binary.

Reply
  • Binary? What is binary in your view?

    A number is a number. But you can express the value of that number in binary, octal, decimal, hexadecimal or whatever numeric base. It is still a number.

    So your variable has a value [0..99]. When the receiving side picks up this value and places it on the processor port, it will of course be mapped binary. So the least significant bit will toggle fast. Next bit at half the speed. Next bit again at a quarter of the speed.

    Any number written to a processor port will come out as binary, since the mapping of the processor pins is that they have a weight of:

    2^0 = 1
    2^1 = 2
    2^2 = 4
    2^3 = 8
    2^4 = 16
    2^5 = 32
    2^6 = 64
    2^7 = 128

    So they have a binary mapping, and will thereby represent a written value as binary.

Children
More questions in this forum