Dear sougata,
the current code looks like this:
This is all, there is no interruption. I am using the PIC 16F628A as a minion.Code:WHILE CMCON.6 = 0 Value = Value + 1 WEND
I changed the code to fit my minion, but it can count only to 255 as it is an 8-Bit timer here.
How do I deal with an overflow, means INTCON.T0IF = 1 or INTCON.2 = 1. It should be something like ValueNew = ValueOld + 256.
Current code, not tested
Finally Value should contain TIMER_ZERO's value.Code:TIMER_ZERO VAR WORD ' VARIABLE TO STORE TIMER0 OPTION_REG = %00000111 INIT: TMR0 = 0 'Full register contains t0-value INTCON.2 = 0 ' START TIMER0/Overflow-Bit = 0 MAIN_LOOP: Value = Value + 1 IF CMCON.6 != 0 THEN M ' IF Komp.output DIFFERS THEN GET THE READING GOTO MAIN_LOOP M: INTCON.2 = 1 ' STOP TIMER0/Simulate overflow TIMER_ZERO = TMR0 'As it is 8-Bit GOTO INIT ' DO IT OVER AGAIN




Bookmarks