# How should I modulate a $16$ bit input using FSK?

I need to graph a $16$ bits binary sequence, assuming that it'll be a FM analog signal I need to apply FSK to it.

So, I think I should use the formula

$A \cos(2\pi f_1 t)$ for binary $1$'s

$A \cos(2\pi f_2 t)$ for binary $0$'s

But I'm really confused about how to set a method for getting the graph for my $16$ bit sequence ...

• Can you indicate what tool(s) you are using to simulate / graph your signals? – user2718 Mar 14 '13 at 13:49
• You need to consider/define you're bit duration. Once this is defined, you can represent your binary sequence as a series of pulses with the desired bit duration. You'll need to define the bit period to do the modualation as well. Specifically how you code this depends on the tool(s) you are using. – user2718 Mar 14 '13 at 17:39
• I just want to try and write a software code where a user inputs any 16 bit binary sequence, I should validate it (lenght, only 0's and 1's) and graph it next. Let's say, any user inputs 1010010011100011 next after validation for this input it will be charted – diegoaguilar Mar 15 '13 at 11:57
• I consider that Amplitude will be reflected in the Y axis and Time in X axis, am I wrong? – diegoaguilar Mar 15 '13 at 12:01
• The questions asked above are important and I don't think you've addressed them. Another important point: you may not want to just switch between two cosines at frequencies $f_1$ and $f_2$, as the equations you provided above suggest. That approach will yield a signal with discontinuous phase, which in many cases is undesirable. Instead, you could use an NCO to implement a continuous-phase frequency-modulated signal. – Jason R Mar 15 '13 at 14:02

Since the comments on the question and the OP's responses don't seem to be converging, here goes.

• Pick a data rate $R$ bits/second (e.g. $10$ kilobits/second) that is acceptable to your client or boss.
The FSK signal will then convey one bit every $R^{-1} = T$ seconds (every $T= 100$ microseconds if you chose the $R =10$ kbps data rate suggested as an example), and the $16$ bits that you need to transmit will be transmitted by an FSK signal $x(t)$ that will have a total duration $16T$ seconds ($1600$ microseconds for the example). Specifically, let us assume that you need to define what $x(t)$ is for all $t$ in the interval $[0, 16T]$.

• Number the $16$ bits typed in by the user as $a_0, a_1, \ldots, a_{15}$ where each $a_i$ can have value $0$ or $1$. Include in your program a snarky error message to be sent to the user if any of the $a_i$ have value other than $0$ or $1$

• Pick two positive integers $m_0$ and $m_1$. The FSK signal described below will use frequencies $m_0/T$ Hz and $m_1/T$ Hz. It is convenient, and possibly might even please your client or boss, if you choose consecutive integers as $m_0$ and $m_1$ such that the FSK signal fits in the frequency band allocated to the system.

• Define the signal $x(t)$ as follows. For $i = 0, 1, 2, \ldots, 15$, $$x(t) = A \sin\left(2\pi\left[(1-a_i)m_0 + a_i m_1\left]\frac{t}{T}\right.\right.\right),~~~ iT \leq t < (i+1)T.$$ Several points need to be noticed with respect to this definition:

• The quantity in square brackets has value $m_0$ if $a_i = 0$ and value $m_1$ if $a_i = 1$ and so during the time interval $[iT, (i+1)T)$, the signal consists of either $m_0$ periods or $m_1$ periods of a sinusoid. At the endpoints of the interval, the signal has value $0$. The signal thus has the phase continuity that is desirable in an FSK signal as noted by @JasonR in a comment.

• If you are using some programming language to create an array of $16$ gazillion points that you will then pass to a graphics package to display as a graph of values of $x(t)$ as a function of $t$, then note that the formulas used to create the first gazillion points will differ from the formula used to create the next gazillion points etc.. The formula needs to use $a_i$ to compute the values of the $i$-th subset of gazillion points. If you want to have a nice smooth graph of the sinusoids, it is necessary to have $m_0$ and $m_1$ be onsiderably smaller than a gazillion so that you get plenty of points per period of each sinusoid. Your graph will also have a long horizontal axis that will likely extend past one page even if printed in landscape mode on legal-size paper.