Hello
If your shifting a variable then you can do so inside a calculation icon as follows.
var = var >> 1
will shift one place to the right
var = var << 1
will shift one place to the left
var = var >> 1 is the same as var = var / 2
var = var >> 2 is the same as var = var / 4
A right shift can also be done as a divide.
var = var << 1 is the same as var = var * 2
var = var << 2 is the same as var = var * 4
A left shift can also be done as a multiply.
How to shift register?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: How to shift register?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: How to shift register?
Hello
Instead of using this,
FCV_PORTB = FCV_PORTB << 1;
FCV_PORTB = FCV_PORTB << 2;
FCV_PORTB = FCV_PORTB << 3;
Try just using the one shift. The result is stored back in the register.
FCV_PORTB = FCV_PORTB << 1;
Instead of using this,
FCV_PORTB = FCV_PORTB << 1;
FCV_PORTB = FCV_PORTB << 2;
FCV_PORTB = FCV_PORTB << 3;
Try just using the one shift. The result is stored back in the register.
FCV_PORTB = FCV_PORTB << 1;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel