138 Chapter 8 Analyzing Digital Sources and Cables
#endif //
!defined(AFX_LFSR_H__5947F6F9_1DBE_4E6E_9AFB_77D5D8857A10__INCLUDED_)
lfsl.cpp
The following source code is provided for the tfsl.cpp file.
// Implementation of the CLFSR class
#include “LFSR.h”
#include <stdio.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
// enable this to light up pixels 1,2,3 as red,green,blue
// in horizontal order
// Pixel 1 represents the top left corner of the screen
// when this is enabled, all other pixels are black
//#define RGB_TEST
// Construction/Destruction
unsigned long pixelvalue;
CLFSR::CLFSR()
{
}
CLFSR::~CLFSR()
{
}
void CLFSR::Reset()
{
state=0;
seed=0x08000001;
}
// Pixel 1 should be 0x000000
// Pixel 2 should be 0x00 (7-bits) , Opcode(10-bits), SeedHigh(7 bits)
// Pixel 3 should be SeedLow (24 bits)
// All other pixels are then set based on the results of the LFSR
calculations.
// The 10-bit Opcode is custom per Quantum Data’s request and it will be
set to ‘00,0000,0111’.
unsigned long CLFSR::GetPixel()
{
unsigned long temp;