1

I want to generate a predefined square signal (ones and zeros) in Gnuradio, but it doesn't work. What I did is using python block as:


    def work(self, input_items, output_items):
        
        n_2= '1111010111010111000100000001001100000101011100110101010000011011100111011011110101001111110110011110100110110010000010100000110101011001110100010100010011000101010010111100011110010011010101010011100111010010111001110101100000010000111110110101000111100100100101000000100100111010000010100001100111011101011110011100011100001100010110101001100011100101011001010111101010100101011110000000100101110111011101111110100001101011110011000100011001010001110011000111001011110010111110010111010011011100011101100110111000000111101011101010001111010000101101010101011111101111010000101111111101010111111001101010010110001110100000000101001101011000110011101001001001010111011001101001000100110011101100011000111110000000111111011011110111111011001110001100010101010010010011000111111110110001110111100000011110011000010000100100100000101001100100001101111101011000111101110010001100100001110110010010000000011111100010010111100111101010101100010101100110110010011001111001110010011110100101011010101001101101010100110100010101101100000011011111011101011100001010110100001100010110110100011110001000110000100100100001011010001000001010000101010000100101001110100001111110100110000011001010001011001001010011101100111000000001001111100010101010001100100101000011001101000001111001111101100111100101101010000100011001001011001110101101010000000111111000001010111001000110010111000011111000111101110100011011111001100000101010001100001111010101000011111000001100010101001101100100000000011110011101110110101111100000001010100110000001000010111111000100101000100111101011110110010100111111000011001111110001001101010011010000000100111111000100010101001100010000011110001000110101101000110010101110101011010011111011001100110011000101001100110000010110000111111010110011110000100010101000010100010110011111110010001110011011111100110011101001110011011110100001001001101001010010000001011110011100001100011011010110011011010001001001011000000101001101011010011000110111010000111011101011111111101010111001010010110011000110010111000101110010000100111011101101115'
        n_2  = np.array(list(n_2))
        n_2 = n_2.astype(np.float32)
        input_items[0] = input_items[0][:2047]
        for i in range(0, len(input_items[0])):
            
            output_items[0][i] = input_items[0][i] * n_2[i]
        
        
        
        return len(output_items[0])

I'm inputting to this block a square wave as seen in the screenshot below:

enter image description here

The number 5 at the end of the signal is a like an ending bit, when I compare the output signal with the numbers, they don't match. As here, after the peak of 5, the signal should output four ones as it repeats, but right after the peak, is a zero!! enter image description here

Edit:

I changed the input signal to be a constant source of, and still doesn't work. I even added a 3, as starting bit, and the result output is very weird!! The ending bit 5 is repeated several times, compared to the starting bit 3. And they should appear after each other, but they are separated by several bits! enter image description here

0 Answers0