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.

Incrimenting a 16bit number with a PIC

Status
Not open for further replies.

chevymn1964

Full Member level 2
Joined
Apr 1, 2006
Messages
120
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Santa Rosa, Ca.
Activity points
2,551
Hey Everyone, I have another head scratcher... What would be a good way to incriment and decriment a 16 bit number? Im using a PIC16F676 and programming in assembly... Thanks for any help!
 

Thanks for the reply IanP, I already found that link and I have no clue how macro's work and how to impliment them into my code...
 

Code:
DEC_16BIT_NUMBER

	decfsz REGISTER_L,f	
	return		
	decfsz REGISTER_H,f	
	return		
;###################################
INC_16BIT_NUMBER

                incf REGISTER_L,f
                movf REGISTER_L,W 	
	xorlw 0X00 				
	btfss STATUS,Z 			
	return
                incf REGISTER_H,f
	movf REGISTER_H,W 	
	xorlw 0X00 				
	btfss STATUS,Z 			
	return

I usualy use this way. and I didn't get where is your problem.
 
You can visit this website for PIC math methods. This one has a huge source code library.

Code:
[url]http://www.piclist.com/techref/microchip/routines.htm[/url]

Regards
tr_pic
 

Hey Everyone, I've got it working with modifying the macro verson in IanP's link. Thanks for all the help!!!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top