If you look at your code all you will need is to define D1 through D5. The code will reuse these for each routine. Since you are not saving something that needs to be reused later, then reusing the registers shouldn't be a problem. Your code could look like this: cblock d1 d2 d3 d4 d5 endc ;All your delays go here Hope this helps! Best regards, Steven Kosmerchock Phoenix, Az USA --- Aslam Jallali wrote: > Hello to you > Using the delay generator from > I have generated 21 different delay routines. (I > need these for different > LED flash sequences). The question is: do I need to > define 21 different > temporary registers in CBLOCK? i.e. see below > please. What is $+2? In the > manual it says return program counter (see my > comment beside the code line) > I appreciate your input & advice on this one ;-) > Regards > > > CBLOCK 0x20 ; RAM starts at address 20h > D1 > D2 > D3 > . > . > . > D21 > ENDC > > Follwoing are the two example and then the third one > is that I merge them. > ; Delay = 0.2 seconds > cblock > d1 > d2 > endc > > ;199998 cycles > movlw 0x3F > movwf d1 > movlw 0x9D > movwf d2 > Delay_0 > decfsz d1, f > goto $+2 ; Does this mean go > two lines back (delay_0)? > decfsz d2, f > goto Delay_0 > > ;2 cycles > goto $+1 > > ; Delay = 0.4 seconds > cblock > d1 > d2 > d3 > endc > > ;399999 cycles > movlw 0x36 > movwf d1 > movlw 0xE0 > movwf d2 > movlw 0x01 > movwf d3 > Delay_0 > decfsz d1, f > goto $+2 > decfsz d2, f > goto $+2 > decfsz d3, f > goto Delay_0 > > ;1 cycle > nop > > ; delay for 0.2 and 0.4 can I call form this code > upon delay 0.2s or ; ; > 0.4s or if I add more into it > > cblock > d1 > d2 > d3 > d4 > d5 > > endc > > delay_0.2s ;199998 cycles > movlw 0x3F > movwf d1 > movlw 0x9D > movwf d2 > Delay_0.2 ; note 0.2 and 0.2s > decfsz d1, f > goto $+2 > decfsz d2, f > goto Delay_0.2 > > ;2 cycles > goto $+1 > > delay_0.4s ;399999 cycles > movlw 0x36 > movwf d3 > movlw 0xE0 > movwf d4 > movlw 0x01 > movwf d5 > Delay_0.4 > decfsz d3, f > goto $+2 > decfsz d4, f > goto $+2 > decfsz d5, f > goto Delay_0.4 > > ;1 cycle > nop > > _________________________________________________________________ > MSN 8 helps eliminate e-mail viruses. Get 2 months > FREE*. > http://join.msn.com/?page=features/virus > > -- > http://www.piclist.com hint: The list server can > filter out subtopics > (like ads or off topics) for you. See > http://www.piclist.com/#topics > _______________________________ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics