0% found this document useful (0 votes)
299 views

NRZi Algorithm

The document discusses an assignment on data communication involving designing an algorithm and logic circuit to generate an NRZI signal for a given bit stream. It provides background on NRZI encoding, which uses signal transitions to represent 1s and the lack of transitions to represent 0s. It then gives a C++ program that simulates the NRZI encoding algorithm and provides an example output signal. The key steps are: 1) the algorithm checks each bit and changes the output signal based on the previous bit value, 2) the program outputs the encoded NRZI signal timing diagram for a given input data string.

Uploaded by

Chinmay Mohanty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
299 views

NRZi Algorithm

The document discusses an assignment on data communication involving designing an algorithm and logic circuit to generate an NRZI signal for a given bit stream. It provides background on NRZI encoding, which uses signal transitions to represent 1s and the lack of transitions to represent 0s. It then gives a C++ program that simulates the NRZI encoding algorithm and provides an example output signal. The key steps are: 1) the algorithm checks each bit and changes the output signal based on the previous bit value, 2) the program outputs the encoded NRZI signal timing diagram for a given input data string.

Uploaded by

Chinmay Mohanty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT

on

DATA
COMMUNICATION
(CS 3001)

By
Chinmay Mohanty
Q5. Design an algorithm and a logic circuit that will generate NRZI
signal for a given bit stream.

In telecommunication, a non-return-to-zero (NRZ) line code is a binary code in which ones are
represented by one significant condition, usually a positive voltage, while zeros are represented
by some other significant condition, usually a negative voltage, with no other neutral or rest
condition.

Non-return-to-zero, inverted (NRZI, also known as Non-return to Zero IBM, Inhibit code or IBM
code) was devised by Bryon E. Phelps (IBM) in 1956. It is a method of mapping a binary signal to
a physical signal for transmission over some transmission media. The two-level NRZI signal
distinguishes data bits by the presence or absence of a transition at a clock boundary.

Which bit value corresponds to a transition varies in practice, and the name NRZI is used for
both. Run-length limited (RLL) codes are generally described using the convention that a logical
1 is transmitted as a transition, and a logical 0 is transmitted as no transition. The HDLC and
Universal Serial Bus protocols use the opposite convention: a logical 0 is transmitted as a
transition, and a logical 1 is transmitted as no transition.

Example:

The representation and coding of NRZ-I is done in:

1. Algorithm
2. Logic Circuit Design
#include<iostream>
#include<string>
using namespace std;
//Program - CPP simulation of Encoding Algorithm NRZ-I

/*
Input - Data as string
Output - Timing diagram of the various encoding algorithms
*/

int main(void)
{
string data;
cout<<"Enter the data: - ";
cin>>data;
int len = data.length();

cout<<"\n";
cout<<"Encoded Signal:\n";

// In NRZI algorithm whenever 1 occurs output changes (if low, then to high,
else if high, then to low)

// zero is represented by __, lower-to-higher one is _- and Higher-to-Lower One


is -_

string nrzi="";
for(int i=0; i<len ; i++)
{
if( i==0 )
{
if( data[i] == '0') nrzi+= "__";
else nrzi+="_-";
}
else if( data[i] == '0' )
{
if( nrzi[i*2-1] == '_') nrzi += "__";
else nrzi += "--";
}

else if ( data[i] == '1' )


{
if( nrzi[i*2-1] == '_') nrzi += "_-";
else nrzi += "-_";
}
cout<<nrzi.substr(i*2,2);
}
}

OUTPUT:
Enter the data :- 10011001111000110101100

Encoded Signal:
_------__------__--__--------__----____--_____

Logic Circuit

You might also like