Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC16F628 Tachometor ASM

Status
Not open for further replies.

diegotheslinger

Newbie level 3
Joined
Jul 22, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
Hello! Was wondering if anyone could help give an overall idea of how to implement a tach with a 16F628 in asm.

As of now, I have four 7-segments hooked up and multiplexed with a TMR2 interupt to update each digit at about 6ms. (just reduced it down till it didn't flicker) I have a halleffect sensor i would like to hook up to RA4 to count with TMR0. (right?) This is my first time using this chip and trying to do counting so I don't know exactly how to start.

I cleared T0CS in option_reg to set it to counter mode and selected count on low-to-high edge. I also assigned the prescaler to TMR0. (looks like the lowest setting halves the count 1:2) Also RA4 is set as an input with trisa.

So my question is how do I want to go about counting pulses? Should I let TMR0 count up, have an interupt (say every 100ms), pull out the value, multiply by 10 (to get rotations per second), then multiply by 60 (rotations per minute). Then with this number break it down to 1000's, 100's, 10's, and 1's and display it on the four 7-segments?

Am I kinda on the right track?

-thanks


*edit* Oh yeah there is a bit more info on what I am doing at <... Vicetronics ....>.
 
Last edited:

Here it is :
 

Attachments

  • !!! Tacho PIC16F628.rar
    67.3 KB · Views: 60
  • !!! Tachometer RPM I PIC16F628.rar
    420.8 KB · Views: 54
  • !!! Tachometer RPM II PIC16F628.rar
    326 KB · Views: 48

I wrote the asm for a Timer some years ago.

I did the counting in binary & when the timer was stopped, I then converted the binary to BCD using arithmetic.

I can post the code if you wish.

The TMR0 prescale can be set to 1:1 by assigning the prescaler to the WDT (even though you may not be using the WDT).

However, I think (without really thinking about it) I would use TMR1 to count the pulses rather than TMR0 since it is a 16 bit counter.

Len
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top