![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hi I have setup TMR2 in the beginning of the program.Now I need to reset TMR2 in the middle of the program by pressing a button. what i want to know is do I need to write all this lines including PR2 register,pre scaler etc.. or only bsf INTCON,PEIE is enough for reset the TMR2? Code: movlw .249 movwf PR2 bsf INTCON,PEIE bsf INTCON,GIE | |
| |
| | (permalink) |
| Just turn it off with bcf T2CON,TMR2ON. Mike. | |
| |
| | (permalink) |
| Oh I see its very simple.Ok I'll turn that TMR2ON bit OFF & ON to make it reset. Thanks mike. | |
| |
| | (permalink) | |
| Quote:
Since it's an 8 bit timer you can just use CLRF TMR2 without stopping it which will clear both the pre and post scalers at the same time. | ||
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| No, it's not that bad. The pre and postscaler ratios aren't changed neither is the value you've already loaded into PR2. The pre and post scalers are counters themselves. Writing to TMR2 (any value) sets these back to zero automatically. It's all in the datasheet by the way. | |
| |
| | (permalink) | ||
| Quote:
Quote:
| |||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Brown-out reset on LF PIC | bananasiong | Micro Controllers | 10 | 17th May 2007 01:33 AM |
| single-sided pcb layout challenge | Mike, K8LH | Micro Controllers | 25 | 5th May 2007 10:32 PM |
| 74LS90 power-on auto reset | Torben | Electronic Projects Design/Ideas/Reviews | 17 | 20th December 2006 05:18 AM |
| vx-5r reset problem | tom muleady | General Electronics Chat | 2 | 5th July 2006 07:01 PM |
| uC 'network' reset circuitry | rockin_rick | Electronic Projects Design/Ideas/Reviews | 8 | 30th May 2006 02:03 AM |