Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Programming timer0 in PIC 16f628

Status
Not open for further replies.
If you trace the path of execution you will see that the portion I highlighted (plus the return instruction) never gets executed.

Mike.
 
i got it ............. thanks a heaven.......

in another part of the coursework i am required to use delay functions to generate delay of 1sec, 750ms, 500ms and 250ms.

can you check that the code i wrote for the delay function is correct??

delay1s movlw D'1249994' ;
movwf D_Ctr1 ;
D_L1 nop ;
decfsz D_Ctr1 ;
goto D_L1 ;
nop ;
return ;

delay750ms movlw D'937498' ;
movwf D_Ctr1 ;
D_L1 nop ;
decfsz D_Ctr1 ;
goto D_L1 ;
nop ;
return ;

delay500ms movlw D'624994' ;
movwf D_Ctr1 ;
D_L1 nop ;
decfsz D_Ctr1 ;
goto D_L1 ;
nop ;
return ;

delay250ms movlw D'312494' ;
movwf D_Ctr1 ;
D_L1 nop ;
decfsz D_Ctr1 ;
goto D_L1 ;
nop ;
return ;
 
Your theory is correct as to how you would generate a delay but unfortunately the biggest number that W can hold is 255 and so movlw D'624944' would actually load W with 48. For seeing how longer delays are generated see .

One other thing, when posting code if you type
Code:
 before it and
after it then it will keep it's format.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top