![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #16 | |
| Quote:
__________________ Mike ML. | ||
| |
| | #17 |
|
Hi. The trick of extracting prescaler value by toggling T0SE bit til TMR0 increases seems very interesting, but it doesen't work for me. I'm testing it in Proteus VSM simulator wit a pic16f630. Do you know if it works on real-life pics. Thanks.
| |
| |
| | #18 |
|
Perhaps a Proteus VSM problem? It works in "real-life" PICs just fine. I've used it so far in frequency counters using the 12F683, 16F628A, and 16F88. Have fun Gentlemen. Regards, Mike Last edited by Mike, K8LH; 30th October 2009 at 01:13 PM. | |
| |
| | #19 |
|
It doesen't work neither with MPLAB SIM (I can only test on simulators at the moment), but it works perfectly toggling T0CS instead of T0SE. Thank you very much for the inspiration. P.S. I hope you can understand my english. Bye Pierluigi | |
| |
| | #20 |
|
The problem with toggling the T0CS bit as that the prescaler may start clocking the system clock during the short time that the system clock is selected as the source. I wonder if you're missing something as simple as making sure the T0CKI pin is set as an output before you start toggling T0SE?
Last edited by Mike, K8LH; 30th October 2009 at 03:28 PM. | |
| |
| | #21 |
|
I think the code is OK. Code: start bsf STATUS,RP0 ; Set tmr0 as counter movlw b'11100111' ; on rising edge with 1:255 prescaler. movwf OPTION_REG ; bcf TRISA,2 ; Set tmr0_pin as output. bcf STATUS,RP0 ; clrf TMR0 call toggletest goto start toggletest movf TMR0,W movwf temp clrf count toggle incf count,F bsf STATUS,RP0 bsf OPTION_REG,T0SE bcf OPTION_REG,T0SE bcf STATUS,RP0 movf TMR0,W subwf temp,W btfsc STATUS,Z goto toggle comf count,F incf count,F return Thank you. Bye. | |
| |
| | #22 |
|
You're setting the RA2 pin as an output. Is that the T0CKI pin for the PIC source code you're testing? T0CKI is on the RA4 pin on some PICs. Mike <added> I see now that your 16F630 has T0CKI on RA2... Last edited by Mike, K8LH; 30th October 2009 at 03:51 PM. | |
| |
|
| Tags |
| 100mhz, counter, frequency, frequency counter |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Frequency Counter | Powzoom | Electronic Projects Design/Ideas/Reviews | 1 | 30th January 2009 11:21 PM |
| 100mhz oscillator circuit | gray5596 | Electronic Projects Design/Ideas/Reviews | 6 | 9th May 2008 02:59 PM |
| Frequency counter | yasser11 | Electronic Projects Design/Ideas/Reviews | 2 | 5th April 2006 04:49 PM |
| Frequency Counter | Gregory | Electronic Projects Design/Ideas/Reviews | 4 | 28th January 2006 03:16 PM |
| frequency counter | samcheetah | Electronic Projects Design/Ideas/Reviews | 4 | 5th May 2004 11:42 PM |