question about a program in language C using pic18f4520
question about a program in language C using pic18f4520
I need to create a c language program from pic18f4520 (mplab), the program is to create a rpm counter from 0-9999, can anyone tell me the steps I have to follow to make the program. if someone has the program ready, you can send me
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: question about a program in language C using pic18f4520
Hello and welcome to the forums.
2) Create the program
What have you done so far, we won't write the program for you but we can likely help if you get stuck.
Also you don't explain how you are counting revs. I take it you receive some sort of digital pulse.
I would likely do something like this.
1) Use a timer to measure time
2) Count the number of pulses over a short period of time
3) Multiply up your counter so that the period of time now covers a minute to give you RPM
I have done something similar recently using an encoder, this gives a revolution pulse but also a 1440 pulse per rev count so that I can work out the direction of movement and RPM much more accurately without big multiplication errors.
Next is how you are going to output the count? Using a LCD? Using a series of 7-seg displays? Using comms?
1) Learn Ccan anyone tell me the steps I have to follow to make the program.
2) Create the program
What have you done so far, we won't write the program for you but we can likely help if you get stuck.
Also you don't explain how you are counting revs. I take it you receive some sort of digital pulse.
I would likely do something like this.
1) Use a timer to measure time
2) Count the number of pulses over a short period of time
3) Multiply up your counter so that the period of time now covers a minute to give you RPM
I have done something similar recently using an encoder, this gives a revolution pulse but also a 1440 pulse per rev count so that I can work out the direction of movement and RPM much more accurately without big multiplication errors.
Next is how you are going to output the count? Using a LCD? Using a series of 7-seg displays? Using comms?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: question about a program in language C using pic18f4520
thanks for the help, I'll simulate the program in proteus using the 7 segment display