Hello,
Making delay in a microcontroller is relatively simple.
I suggest do not used for delay loops in creating delay because your MCU has nothing else to do execept for the delay loop.
I suggest use the timer module - it is simple to use real - time and scalable. the timer is simply a counter that will count from 0,1 ..255 in case of a 8-bit timer or 0,1, ...65535 in case for a 16 - bit counter. you can always scale the time increment for every count and this scale is a multiple of your machine cycle period.
For example if the MPU machine cycle period is 1microsec, you can scale the timer to 256 so that each count will increment every 256microseconds. You divide 20milliseconds/256microseconds = 78.125 counts. So when the timer is already D'77' then you can start processing what should be done after that 20ms delay. or you can load the count your timer should start at timer = D'255' - D'78' and generate the service routine on the timer overflow. This assumes that your timer is 8 - bit.
I have done various TMR0 counting, delay and other applications using PIC microcontroller but not the microcontroller that you mentioned. But I suspect your microcontroller has a timer feature and its operation should be the same of that of PIC.
I know this is not what you want to get but I hope its helping you a bit,
Regards,
Jack