LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a For Loop run in the decrementing mode?

Thank you everyone for givining me some ideas.  What I have been trying to do is calculate a CRC table and this required shift bits to the right location in a 32bit word.  This word then would be put into and array.  I have looked at the C code closer and found that it doesn't matter if I increment the For loop.  Here is what I'm trying to emulate:

 

DWORD dwpoly = xxxxxxxx;

int i, j;

DWORD dwCRC;

for(i=0; i<256; i++)

{

dwCRC = i;

for (j=8; j>0; j--)

  {

    if(dwCRC & 1)

         dwCRC=(dwCRC >> 1) ^ dwpoly;

    else

         dwCRC >> 1;

  }

dwCRC32table[i] = dwCRC

 

}

 

Anyone delt with CRC's?

 

Thanks again.

 

Scott

0 Kudos
Message 11 of 15
(2,717 Views)

There are quite a few CRC programs written in LabVIEW available. For example, have a look at unclebump's attachment in the following thread:

http://forums.ni.com/ni/board/message?board.id=170&message.id=142902#M142902

Maybe whatever you need is all there already. Good luck!

 

0 Kudos
Message 12 of 15
(2,704 Views)

This is the decrementing code in C language

#include <stdio.h>
main()
{
int i, n;
printf("Enter n: ");
scanf("%d", &n);

for (i = n; i>=1; i--)
{
printf("\n%d", i);
}
getch();
}

 

0 Kudos
Message 13 of 15
(2,346 Views)

WilliamJwow,

1. This is a LabVIEW board

2. This thread is over 11 years old

 

Just saying your first post is completely irrelevant.  Have a nice day!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 15
(2,342 Views)

Hmmmm....

 

Comparing ....

 


@WilliamJwow wrote:

This is the decrementing code in C language

#include <stdio.h>
main()
{
int i, n;
printf("Enter n: ");
scanf("%d", &n);

for (i = n; i>=1; i--)
{
printf("\n%d", i);
}
getch();
}

 


 

with

 

I think I will stick with LabVIEW. Thank you for reminding how painful it was to code in C.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 15
(2,339 Views)