Continue to Site

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.

SHIFT LEFT & SHIFT RIGHT with the 8051 and PIC18

Status
Not open for further replies.

Stefke

Newbie level 1
Joined
Jan 28, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
shift 8051

Dear developers

How can I implement an shift left and shift right instruction with using the default instructionset for the 8051 and PIC18

Can somebody help me with give code examples for create SHIFT functions in assembly only?

Thanks
Stefke
 

pic18f rotate right

Use the rotate instructions, making sure the carry flag is clear before that.
For the 8051 assume the byte to rotate is in the accumulator, for the PIc assume it's in file register named Byte.

Ex 8051
clr C
rlc A ;for shift left
rrc A ;for shift right

Ex PIC18
bcf STATUS,C
rlcf Byte ;for left shift
rrcf Byte; for right shift

If you need multiple shifts, repeat the above steps the required # of times.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top