Hello
I'm working with microprocessors and using hi-tech C for my programs.
I have an assembly program that I would like to re-make into C. The assembly code is for a PIC12f629 for modelcars with lights and blinking LED's.
I could just use it as it is, but I'd like to learn more my self and make some changes to it.
Because the code is too large, I have put it here instead http://dl.dropbox.com/u/3995146/einsatz.txt
Here is a little code snip that explains my question.
In the code he has got this
I can understand the most of the assembly code, but I can't figure out where this program is getting it's timing from and where those 245 and 45 comes in. I know what they mean, but not what counts it.
I have been trying to figure out exactly how the program counts the time/ticks and decides what pin to turn on or off and when it resets and starts over. It's not timer0 because thats too fast and I don't think it's timer1 either as it's used for PWM and I can't see any other counters.
I hope someone can guide me in the right direction so I can find out what is going on and maybe explain to me what exactly happends in the code.
I'm working with microprocessors and using hi-tech C for my programs.
I have an assembly program that I would like to re-make into C. The assembly code is for a PIC12f629 for modelcars with lights and blinking LED's.
I could just use it as it is, but I'd like to learn more my self and make some changes to it.
Because the code is too large, I have put it here instead http://dl.dropbox.com/u/3995146/einsatz.txt
Here is a little code snip that explains my question.
In the code he has got this
Rich (BB code):
R_CNT_F1 equ 30h ; Counter for FLASH1
R_FLAG_F1 equ 31h ; FLAGS for FLASH1
Rich (BB code):
T_FLASH1 equ d'245' ; (1..255) duration of long off-time for FLASH1
T_BREAK1 equ d'45' ; (1..255) duration of short off-time for FLASH1
Rich (BB code):
movlw T_FLASH1 ; Time between 2 Flashes (long time)
btfss R_FLAG_F1,0 ; if short off-Time needed (Strobo double-flash)
movlw T_BREAK1 ; Time between 2 Flashes (short time)
subwf R_CNT_F1,W ; if R_CNT_F1 < T_FLASHx / T_BREAKx
btfss STATUS,C ; .. then
return ; return
I have been trying to figure out exactly how the program counts the time/ticks and decides what pin to turn on or off and when it resets and starts over. It's not timer0 because thats too fast and I don't think it's timer1 either as it's used for PWM and I can't see any other counters.
I hope someone can guide me in the right direction so I can find out what is going on and maybe explain to me what exactly happends in the code.