Page 1 of 1
How to measure Radio controller receiver pulse
Posted: Tue Nov 17, 2009 12:48 pm
by LEE
How to measure radio controller receive pulse 1 msec to 2 msec repeated 20msec delay? Anyone, using flow code 4 (PIC) decode the pulse and print at E-blocks LCD or drive a simple stepper motor.
Re: How to measure Radio controller receiver pulse
Posted: Tue Nov 17, 2009 5:21 pm
by Benj
Hello Lee
What target and clock frequency did you have in mind? This should be fairly simple so I will put together a basic example for you.
Re: How to measure Radio controller receiver pulse
Posted: Tue Nov 17, 2009 5:30 pm
by Sean
Your program seems to need to do perform several functions in addition to the pulse measurement. If this is the case, you will probably need to use interrupts and some internal hardware assistance to maintain any degree of accuracy.
The features available to you will depend on the chip you are using as your target device. The CCP modules attached to some of the timers can be very useful for this purpose, as can multiple INT pins.
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 12:07 pm
by LEE
the clock speed at 4Mhz, as standard speed
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 12:15 pm
by Benj
Hello Lee
What target device are you gointo be using?
Also are you using a crystal or using the internal oscillator?
The internal oscillator will work but will not give you very good accuracy.
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 12:44 pm
by LEE
External 4Mhz Xtal, as long It can print out data 0 to 255 on E-Blocks LCD will be OK. The data enought to comunicate with the 1Hpower Yaskawa industrial 220V servo drive and motor. Actually, it like an RC servo but, is a big servo. I can use a touch screen /PLC direct to control the 1Hpower servo motor, It will take more than 5 PLC I/O (very tedious to write the PLC function) . If I make decoder(PIC) save a lot of work and prevent copycat.
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 12:48 pm
by medelec35
Hiya Lee.
Target Device = microcontroller you are using, e.g 16F88
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 1:06 pm
by Sean
Hello Lee,
I have used Yaskawa servos in the past (SGDA series). I assume you are configuring the drive for one of the digital step input options and expect it to follow the input servo signal via the PIC.
If you can let us know which PIC device you are using, and any other details you are willing to tell us about the project, we should be able to help.
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 3:01 pm
by LEE
Hello sean,
Yes, you are right, I let the servo drive detect the pulse (program the drive close loop). the target device PIC 16F84 or 16F88 will be alright. the porpose of this project I am taking, is wood cutting machine. I can progam the data angle 10 to 120 degree from a touch screen to the PLC produce the 20msec delay pulse and one wire to the decoder (PIC 16F84 or 16F88) . The decoder will be able send signal to the servo drive/motor to rotate the circular saw at the request angle..I found this method to control servo motor intresting, can control few servo motor inside the 20msec delay as long the PLC transistor I/O fast enought. As same to the RC heli 8 chanel I own ( I am old now, not much flight the Heli, bussy for my business in industry machine).
this project is a wood working machine, making circular coffe table (finger joint rubber wood). as the coffe table diameter got biger, so do the angle joint!
this is my first time joint this forum some of the technical word still new to me.
thank for the help.
Re: How to measure Radio controller receiver pulse
Posted: Wed Nov 18, 2009 3:17 pm
by Sean
The 16F88 will be the better option for this project.
We will post some pulse measuring code on the forum in the next day or two.
The display and stepper functions should be supported by existing Flowcode components.
Re: How to measure Radio controller receiver pulse
Posted: Fri Nov 20, 2009 12:05 pm
by Sean
Hello Lee,
Here is a PIC16F88 test program that measures the duration of a pulse.
It relies on the fact that the 16F88 is using a 4MHz xtal. This allows TMR1 to be clocked at 1MHz - providing 1us resolution.
The system uses the CCP1 module attached to TMR1 to perform the pulse measurement and generate interrupts when pulse edges are detected.
The CCP1 module is initialized to capture a positive edge on the CCP1 pin (RB0). This generates an interrupt that causes TMR1 to start running, and the CCP1 module capture to be swapped to the negative edge.
When a negative edge is detected, the CCP1 registers contain the TMR1 value (number of microseconds since the positive edge). This value is used to update the PulseWidth variable. The capture is also swapped back to positive, and TMR1 is stopped and cleared.
This system can measure pulses upto around 32ms at 1us resolution.
The value returned in the PulseWidth variable is consistantly low by 30 counts (30us). This is due to the interrupt response time. The program compensates for this error when using the value.
Simple division and subtraction operations are used to remove the 1ms servo pulse offset, and scale the result to the required range:
1ms servo pulse = 0
2ms servo pulse = 250
These ranges and values can be changed, if required, using simple calculations.
The value is displayed on an EB-005 LCD E-Block. The use of the RB0 pin as the CCP1 input means that the EB-005 can not be used with its default connection settings. The Flowcode LCD component and EB-005 board are both configured to use connections RB1 to RB6 (EB-005 jumper links moved to the PATCH position and wire links used to connect the appropriate pins).
This is only a test/demonstration program. It will require further development to meet your application requirements (especially when controlling powerful machinery), including protection against false measurements etc.
Re: How to measure Radio controller receiver pulse
Posted: Tue Nov 24, 2009 12:30 pm
by LEE
Hello sean,
Sercurity and emergency switch is build in hard wiring and PLC ladder program in the machine. Thanks for the flow code program, I will further expend for my machine.
In future, how can I contribute some of my flow code project that I have done, in detail, picture to this forums ? Please let me know.
Sorry for some delay reply to this forums, I just came back form Taiwan and China, business trip.
Thanks