Rol
Source: Positron16 Compiler User Manual, PDF page 352
Syntax
Rol Variable {,Set or Clear}
Overview
Bitwise rotate a variable left with or without the microcontroller’s Carry flag.
Parameters
Variable may be any standard variable type, but not an array. Set or Clear are optional parameters that will clear or set the Carry flag before the rotate. If no parameter is placed after the Variable, the current Carry flag state will be rotated into the LSB (Least Significant Bit) of variable.
Example.
' Demonstrate the Rol Command
'
Device = 24FJ64GA002
' Select the device to compile for
Declare Xtal = 32
Declare Hserial_Baud = 9600
' UART1 Baud rate
Declare Hrsout1_Pin = PORTB.14
' Select the pin for TX with USART1
Dim bIndex As Byte
Dim MyByte As Byte
Dim Byteout As Byte
RPOR7 = 3
' Make Pin RP14 U1TX
'
' Rotate the carry through MyByte
'
MyByte = %10000000
Rol MyByte
Rol MyByte
Rol MyByte
Rol MyByte
Rol MyByte
Rol MyByte
Rol MyByte
Rol MyByte
'
' Set each bit of MyByte with every rotate
'
MyByte = %00000000
For bIndex = 0 To 7
Rol MyByte, Set
HRSOutLn Bin8 MyByte
Next
HRSOutLn "----------"
'
' Clear each bit of MyByte with every rotate
'
MyByte = %11111111
For bIndex = 0 To 7
Rol MyByte, Clear
HRSOutLn Bin8 MyByte
Next
HRSOutLn "----------"
'
' Transfer the value of MyByte to Byteout, but reversed
'
MyByte = %10000000
Byteout = %00000000
For bIndex = 0 To 7
Rol MyByte
Ror Byteout
HRSOutLn Bin8 Byteout
Next
'
' Configure for internal 8MHz oscillator with PLL
' OSC pins are general purpose I/O
'
Config Config1 = JTAGEN_OFF, GCP_OFF, GWRP_OFF, BKBUG_OFF,_
COE_OFF, ICS_PGx1, FWDTEN_OFF, WINDIS_OFF,_
FWPSA_PR128, WDTPOST_PS256
Config Config2 = IOL1WAY_OFF, COE_OFF, IESO_OFF, FNOSC_FRCPLL,_
FCKSM_CSDCMD, OSCIOFNC_ON, POSCMOD_NONE