Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Doubt in the rotation asm pic16F

aless2056

Newbie level 6
Joined
May 11, 2020
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
108
Guys, I'm a beginner and I'm in doubt in the RRF Rotation instruction. Assuming I have this value

0000 0011 0011 1100
AH = 0000 0011
AL = 0011 1100

Did I do that?

RRF AH, F
RRF AL, F
RRF AH, F
RRF AL, F

Will the result be?

AH = 0000 0000
AL = 1100 1111
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,429
Helped
4,297
Reputation
8,599
Reaction score
4,258
Trophy points
1,393
Activity points
128,881
Hi,

The answer is: it depends.

I don't want to do your homework.
So please show the states after each commend. Step by step.


Klaus
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,859
Helped
4,854
Reputation
9,726
Reaction score
4,640
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
126,484
You should study the data sheet, it explains all the instructions and gives examples.

'AH' and 'AL' presumably are register names and independent 8-bit values.
RRF AH, F AH is 0000 0011 before the instruction so rotating it right through the carry flag, bit 7 = whatever was in C, and C becomes what was in Bit 0
The same applies to the AL register but note there is only one carry bit so it may transfer a bit from one register to the next.

We can't predict what the result will be without knowing what was in C at the outset.

Brian.
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top