View previous topic :: View next topic |
Author |
Message |
wanraimi
Joined: 20 Feb 2013 Posts: 11
|
|
Posted: Mon Mar 25, 2013 10:54 am |
|
|
owh tq for your help..
I'm sorry cause I'm very stress to completed my project.
Can i ask another question,
how to measure pulse in 1s? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19559
|
|
Posted: Mon Mar 25, 2013 12:05 pm |
|
|
EX_FREQ.C
Shows how to measure the frequency of a signal. RPM=freq*60
Best Wishes |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Mon Mar 25, 2013 12:21 pm |
|
|
wanraimi wrote: | owh tq for your help..
I'm sorry cause I'm very stress to completed my project.
Can i ask another question,
how to measure pulse in 1s? |
I don't understand your question.
Do you want to count the number of pulses in one second?
OR
Do you want to measure the average period of ~1second's worth of pulses?
Come to think of it, you've already posted code which measures frequency in Hz, then multiplies by 60.
You then complained, the readout is too coarse.
At the risk of causing you further distress:-
Please answer the questions you've been asked so far.
I repeat, we are all trying to help you, but you're not making it easy for us.
Mike
EDIT
How soon to your project submission date? |
|
|
wanraimi
Joined: 20 Feb 2013 Posts: 11
|
|
Posted: Wed Mar 27, 2013 9:59 am |
|
|
ow okey sorry i will story a bit about my project..
1)I using phototransistor as my sensor, the sensor duty to count the amount of pulse that resulting from rotary encoder, I buy this sensor from cytron (RE08).
2)my dc motor spec is
-DC12V
-Output Power: 0.6 Watt
-Rated Speed: 130RPM
-Rated Current: 100mA
-Rated Torque: 58.8mN.m
-Sample application: Lightweight mechanism
3) this project i do for my final year project in my study place.
my project title is "DC motor control using controller area network (CAN)"
this project spec.
-have 2 pic18f458
-2 pic18f458 will communicate each other using CAN-bus
-1st pic will control motor to run with desired speed and other one pic will display the rpm speed using lcd display.
-this project also have pid controller to setting back the speed when the speed not run same with the desired speed.
4)my experience in programming is very new, until now i still learn about ccs programming. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Mar 28, 2013 2:19 pm |
|
|
OK. This is better.
You've got two issues to deal with, hardware and software.
This list is by no means comprhensive.
Hardware:-
Make sure that all the bits work correctly, BEFORE you even think about code.
I'm assumng that you've go some means to convert a 5V PWM signal to one which can drive your 12V motor.
Control this converter with a signal generator (or something similar) to make sure it drives the motor without burning out or creating nasty pulses.
Will you be wanting to reverse the motor? If yes, test for that.
Test the rotation sensor.
Make sure it creates good 0-5V pulses with sharp edges at all speeds from slow to maximum.
Software:-
You're going to be faced with a steep learning curve.
Make sure the PICs are working properly by trying out some of the CCS examples.
Do the LED flasher. Make sure it runs at the correct speed. You will then have reasonable confidence that the PICs are good.
CCS provides code for LCD, PWM, ADC, CAN. I'd leave CAN till last, as it needs both boards to test completely.
Try them all out in turn,
Make certain that each works as intended before attempting to use several together.
Use this forum for code, For example, you'll find code for using an ADC to control PWM etc. it's already been done for you.
Build up your system in small, simple steps.
Best of luck. I think you're going to need it.
Mike
EDIT
I've just noticed.
You've already run a thread on this topic.
Comments from before still apply.
I'd leave doing the CAN bus 'til last.
Run LCD, PID etc all on the one PIC.
Add an RS232 link to a PC.
Use the RS232 link for diagnostics at the development stage.
It's a lot more user friendly than an LCD.
Also works both ways. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9249 Location: Greensville,Ontario
|
|
Posted: Fri Mar 29, 2013 5:30 am |
|
|
Mike's 100% right..leave the CAN code to last ! Use simple easy to understand,easy to implement RS232 for the PIC2PIC interface.
Once that's 100%, then beat your brain up trying to get CAN 'up and running.
That way you KNOW ANY problems are due to implementing CAN, and not anything else.The motor control PID,LCD stuff,PWM, sensorIF,etc is maybe 3-4 nights work.CAN could be the 'stumbling' block,though if I read your post right ,the second PIC is just a 'remote display unit',so code should be 'simple'.
hth
jay |
|
|
wanraimi
Joined: 20 Feb 2013 Posts: 11
|
|
Posted: Fri Mar 29, 2013 6:45 am |
|
|
okey thank you for your help..
I will try the best and follow the advice. |
|
|
|