MJLorton Solar Power and Electronic Measurement Equipment Forum

New proof of concept ideas, projects, inventions => New proof of concept ideas, projects, inventions => Topic started by: Mr Eastwood on August 31, 2013, 04:40:06 AM

Title: Creating simple delays in microcontrollers
Post by: Mr Eastwood on August 31, 2013, 04:40:06 AM
In a project I'm working on I decided to re-factor some code to make room for an extra feature I wanted to add.   So I decided to re-write the way my delays were coded, so instead of looping on NOP's  I decided to use the in-built timers for my chip;  this was probably the way I should have implemented it given my chip had a limited program code space of 8K.

Anyway I ended up creating a simple .net app to allow me to change the PIC register settings through trackbar-sliders and see what kind of delay I could get without having to work it out manually; also adding the ability to "loop" on the timer.     

There is also a feature to convert the finished delay to a simple few lines of C code setting the required registers.   The small app is only applicable to similar hardware timers to the 16F877A.