for loop in PIC18 assembly language

Thread Starter

TheRekz

Joined Oct 25, 2009
13
I want to do a for loop which counts till the exit condition i > 50, is this right:

Rich (BB code):
COUNT EQU 0

LOOPING:   
  MOVLW 50
  CPFSGT COUNT
  INCF COUNT 1
  BRA END_LOOP
  BRA LOOPING
  
END_LOOP:  
 ; end of loop here
 

t06afre

Joined May 11, 2009
5,934
This is how I would have done it a PIC16
MainLoop:
movlw 0x32 ;setting up loop counter 50 times
movwf data1
clrf data2 ;just clear data2
Loop:
incf data2,1 ;this is your loop task
decfsz data1,f
goto Loop
 
Top