Continue to Site

Casading of 2 general purpose register

Status
Not open for further replies.

scdoro

Member level 5
Member level 5
Joined
Jan 12, 2005
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,040
Hi,
I am new to PIC assembly .
would like to know for PIC16F872, can i casade two general purpose register together ( 8 bit + 8 bit = 16 bit ) and increment the two register from 0 - 65535 , as if it is a 16 bit counter ?
is that possible ?
if so, may i know how can the source code be written in assembly?
thanks
 

I cannot give you the code in assembly because it will be a no challenge for you to do.

To do it is to monitor the most significant bit of your first byte, if it becomes 1 and returned to zero, it means the next increment stage will be the least significant bit of your 2nd byte.
 

The way you can do it is to clear the C flag, then add 01h to lower register using standard ADD instruction. Next put C into a byte in such a way that it will look like this: 0000 000C and clear C flag and the last thing to do is to ADD this byte to the upper register and check C flag if you have overflow ie FFFFh - to - 0000h ..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top