Rev 41 | Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 41 | Rev 60 | ||
---|---|---|---|
Line 62... | Line 62... | ||
62 | DateTime_t SystemTime; |
62 | DateTime_t SystemTime; |
Line 63... | Line 63... | ||
63 | 63 | ||
64 | //---------------------------------------------------------------------------------------------------- |
64 | //---------------------------------------------------------------------------------------------------- |
65 | void TIM1_IRQHandler(void) |
65 | void TIM1_IRQHandler(void) |
66 | { |
66 | { |
- | 67 | if(TIM_GetFlagStatus(TIM1, TIM_FLAG_OC1) == SET) |
|
67 | TIM_ClearFlag(TIM1, TIM_FLAG_OC1); // clear irq pending bit |
68 | { |
68 | TIM1->OC1R += 200; // Timerfreq is 200kHz, generate an interrupt every 1ms |
- | |
69 | 69 | TIM1->OC1R += 200; // Timerfreq is 200kHz, generate an interrupt every 1ms |
|
70 | CountMilliseconds++; |
70 | CountMilliseconds++; |
- | 71 | //if (GPIO_ReadBit(GPIO6, GPIO_Pin_3)) GPIO_WriteBit(GPIO6, GPIO_Pin_3, Bit_RESET); else GPIO_WriteBit(GPIO6, GPIO_Pin_3, Bit_SET); |
|
71 | //if (GPIO_ReadBit(GPIO6, GPIO_Pin_3)) GPIO_WriteBit(GPIO6, GPIO_Pin_3, Bit_RESET); else GPIO_WriteBit(GPIO6, GPIO_Pin_3, Bit_SET); |
72 | TIM_ClearFlag(TIM1, TIM_FLAG_OC1); // clear irq pending bit |
72 | 73 | } |
|
73 | // write any value to VIC0 Vector address register |
74 | // write any value to VIC0 Vector address register |
74 | VIC0->VAR = 0xFF; |
75 | VIC0->VAR = 0xFF; |
Line 75... | Line 76... | ||
75 | } |
76 | } |
Line 98... | Line 99... | ||
98 | TIM_ITConfig(TIM1, TIM_IT_OC1, ENABLE); |
99 | TIM_ITConfig(TIM1, TIM_IT_OC1, ENABLE); |
99 | TIM_CounterCmd(TIM1, TIM_START); |
100 | TIM_CounterCmd(TIM1, TIM_START); |
Line 100... | Line 101... | ||
100 | 101 | ||
101 | VIC_Config(TIM1_ITLine, VIC_IRQ, 5); |
102 | VIC_Config(TIM1_ITLine, VIC_IRQ, 5); |
102 | VIC_ITCmd(TIM1_ITLine, ENABLE); |
103 | VIC_ITCmd(TIM1_ITLine, ENABLE); |
103 | 104 | ||
104 | SystemTime.Year = 0; |
105 | SystemTime.Year = 0; |
105 | SystemTime.Month = 0; |
106 | SystemTime.Month = 0; |
106 | SystemTime.Day = 0; |
107 | SystemTime.Day = 0; |
107 | SystemTime.Hour = 0; |
108 | SystemTime.Hour = 0; |