# FPGA-Based Manchester Decoder for IEEE 802.15.7 Visible Light Communications
## 2 Architecture of the Receiver
### Approximation of the Inverse Tangent
The result is rotated back to the octant calculated in point 1 with the simple operation reported in the last column of Table 4. Like the ideal four-quadrant extension of \(\mathrm{atan}(x)\), the approximation of Table 4 is undefined when both I and Q are null. Figure 4 compares the \(\mathrm{atan}(x)\) approximations with \(m=47.7434\) (blue curve) and \(m=45^{\circ}\) (magenta curve) as calculated in Equation (9), and the reference function (red-dashed curve). On top of the picture, the three trends are reported; on the bottom panel, the phase errors \(\varphi_{e}\), calculated with respect to the reference inverse tangent, are highlighted. The graph reports the data for the first octant (\(0\leq x<1\)) only, since they repeat unchanged in the remaining octants. We can see that with \(m=47.74^{\circ}\) the error ranges between \(\pm 2.74^{\circ}\), while with \(m=45^{\circ}\) the error is between \(-4.07^{\circ}\) and \(0^{\circ}\). In addition to the maximum error, it should be noted \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Sign(I)** & **Sign(Q)** & **111 \(|\)Q1** & **Octant** & **Angle** & \(\boldsymbol{\varphi}\) \\ \hline + & + & \(|11|>|Q|\) & 0 & \(0\leq\varphi<45^{\circ}\) & \(0^{\circ}+m\,\cdot\,|\,Q|\,/\,|1|\) \\ + & + & \(|11|\leq|Q|\) & 1 & \(45^{\circ}\leq\varphi<90^{\circ}\) & \(90^{\circ}-m\,\cdot\,|\,11|\,/\,|Q|\) \\ - & + & \(|11|<|Q|\) & 2 & \(90^{\circ}\leq\varphi<135^{\circ}\) & \(90^{\circ}+m\,\cdot\,|\,11|\,/\,|Q|\) \\ - & + & \(|11|\geq|Q|\) & 3 & \(135^{\circ}\leq\varphi<180^{\circ}\) & \(180^{\circ}-m\,\cdot\,|\,Q|\,/\,|11|\) \\ - & - & \(|11|<|Q|\) & 4 & \(-180^{\circ}\leq\varphi<-135^{\circ}\) & \(-180^{\circ}+m\,\cdot\,|\,11|\,/\,|Q|\) \\ - & - & \(|11|\geq|Q|\) & 5 & \(-135^{\circ}\leq\varphi<90^{\circ}-90^{\circ}-m\,\cdot\,|Q|\,/\,|11|\) \\ + & - & \(|11|\leq|Q|\) & 6 & \(-90^{\circ}\leq\varphi<-45^{\circ}\) & \(-90^{\circ}+m\,\cdot\,|\,11|\,/\,|Q|\) \\ + & - & \(|11|>|Q|\) & 7 & \(-45^{\circ}\leq\varphi<0^{\circ}\) & \(0^{\circ}-m\,\cdot\,|Q|\,/\,|11|\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Calculation of the approximated 4-quadrant atan. Figure 4: Top: Comparison between inverse tangent (red-dashed curve) and proposed approximations (blue and magenta curves) in the first octant, where the \(\mathrm{atan}\) argument \(\mathrm{x}\) ranges from 0 to 1. Bottom: Error of proposed approximations. that once the receiver is synchronized, the phase will be around \(\pm 90^{\circ}\), which corresponds to the origin of the octant in both cases (see Table 4). In the origin, the error is null, and remains reasonably low even near the origin. As discussed before, this behavior is important for the system to correctly maintain the lock condition. As we anticipated, the error calculated here should be related through Equation (9) to the number of samples per bit \(N\). From Equation (9), we deduce that the accuracy granted by the proposed approximations, considering the maximum errors, corresponds to values of \(N\approx 130\) and \(N\approx 90\) for \(m=47.74^{\circ}\) and \(m=45^{\circ}\), respectively. However, this is a quite conservative estimation, and from a practical point of view, \(N\approx 100\) with \(m=45^{\circ}\) represents a good compromise.