- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm developing a system using a PRS component set to 17 bit.
With 17 bit I can reach 2^17 = 131071 combination.
I have no problems regard the decoding (my system read a code of 17 bit and decode by means of PRS the combination).
I need a firmware routine that generate the 131071 combination because I have to print the entire combination on an external support (that my system have to read).
Could you provide a generic firmware routine that generate the 17 bit sequence as PRS component ("generic" because I have to provide the routine to my supplier that using a standard MCU and not a sOC)?
Thanks and regards
Solved! Go to Solution.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Normally LFSR is used to generate psuedo random sequence generator.
If your requirement is to go through all the 2^17 combinations, a simple counter output might do the job.
If you want to generate a random sequence, same logic can be replicated in firmware.
For a 10 bit random sequence generator
for(i=0; i<11; i++) b = 1<<i;
Then pick a primitive polynomial (x^10 + x^3 + 1 is an example)
Start with a seed for x, say
x = 0x8;
rotate x to the left, and copy the exclusive or of bits 10, 3 and 0 into
bit 0:
y1 = (b[10] & x) ? 1 : 0;
y2 = (b[3] & x) ? 1 : 0;
y3 = (b[0] & x) ? 1 : 0;
x = x << 1 | (y1 ^ y2 ^ y3);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Normally LFSR is used to generate psuedo random sequence generator.
If your requirement is to go through all the 2^17 combinations, a simple counter output might do the job.
If you want to generate a random sequence, same logic can be replicated in firmware.
For a 10 bit random sequence generator
for(i=0; i<11; i++) b = 1<<i;
Then pick a primitive polynomial (x^10 + x^3 + 1 is an example)
Start with a seed for x, say
x = 0x8;
rotate x to the left, and copy the exclusive or of bits 10, 3 and 0 into
bit 0:
y1 = (b[10] & x) ? 1 : 0;
y2 = (b[3] & x) ? 1 : 0;
y3 = (b[0] & x) ? 1 : 0;
x = x << 1 | (y1 ^ y2 ^ y3);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content