Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Help With Assembly Code
Hi,
I recently bought the pic programmer kit from velleman and need some code quick. I need to measure the width of pwm pulses coming from a r/c rx. It is a pic16f627-04p. Can anyone provide me with the code? I think the language is assembly. Thanks Michael |
#2
|
|||
|
|||
I recently bought the pic programmer kit...and need some code
Michael Hims http://www.google.com/search?q=piclist |
#3
|
|||
|
|||
"Michael Hims" schreef in bericht
k... Hi, I recently bought the pic programmer kit from velleman and need some code quick. I need to measure the width of pwm pulses coming from a r/c rx. It is a pic16f627-04p. Can anyone provide me with the code? I think the language is assembly. Thanks Michael Michael, I don't recommend a -04 pic since it runs only op to 4 MHz which equals to 1 MIPS. This might be to slow for good measurement. Since you don't know how to program (from your question I think at all) you made the wrong first step. Step 1: What do I want to do? (Answer: measure the width of pwm pulses) Step 2: What frequency are the pulses on??? Step 3: What duty-cycle steps do I want to measure (1/100th or just 1/10th steps) If it's 1/100th, your code should run cyclic at least at 100 * pulse frequency If your pulses come with 10 kHz your code should run cyclic at 1/1 000 000 second this is for the -04 Pic just one instruction. Of course interrupt based some time can be saved but still..... Step 4: How will my intructions my code approx be with what hardware and how long will it take Step 5: Choose the right PIC. For code examples look at: http://www.piclist.com/ The best way to handel this is program it yourself. If you come to a real obstacle, It would be my pleasure to help you. Good Luck, Alexander p.s. I Don't give a fish, I teach how to fish (or something like that) |
#4
|
|||
|
|||
"Alexander" wrote in message ... "Michael Hims" schreef in bericht k... Hi, I recently bought the pic programmer kit from velleman and need some code quick. I need to measure the width of pwm pulses coming from a r/c rx. It is a pic16f627-04p. Can anyone provide me with the code? I think the language is assembly. Thanks Michael Michael, I don't recommend a -04 pic since it runs only op to 4 MHz which equals to 1 MIPS. This might be to slow for good measurement. Since you don't know how to program (from your question I think at all) you made the wrong first step. Step 1: What do I want to do? (Answer: measure the width of pwm pulses) Step 2: What frequency are the pulses on??? Step 3: What duty-cycle steps do I want to measure (1/100th or just 1/10th steps) If it's 1/100th, your code should run cyclic at least at 100 * pulse frequency If your pulses come with 10 kHz your code should run cyclic at 1/1 000 000 second this is for the -04 Pic just one instruction. Of course interrupt based some time can be saved but still..... Step 4: How will my intructions my code approx be with what hardware and how long will it take Step 5: Choose the right PIC. For code examples look at: http://www.piclist.com/ The best way to handel this is program it yourself. If you come to a real obstacle, It would be my pleasure to help you. Good Luck, Alexander p.s. I Don't give a fish, I teach how to fish (or something like that) Thanks Alexander, however I wanted the code so I could find out if the pic could do this and then I would learn the language. Think of it as me starving to death, so you give me a fish, but then to save myself from starving to death again, i teach myself to fish, if you get me :-) |
#5
|
|||
|
|||
"Michael Hims" schreef in bericht
. uk... "Alexander" wrote in message ... "Michael Hims" schreef in bericht k... Hi, I recently bought the pic programmer kit from velleman and need some code quick. I need to measure the width of pwm pulses coming from a r/c rx. It is a pic16f627-04p. Can anyone provide me with the code? I think the language is assembly. Thanks Michael Michael, I don't recommend a -04 pic since it runs only op to 4 MHz which equals to 1 MIPS. This might be to slow for good measurement. Since you don't know how to program (from your question I think at all) you made the wrong first step. Step 1: What do I want to do? (Answer: measure the width of pwm pulses) Step 2: What frequency are the pulses on??? Step 3: What duty-cycle steps do I want to measure (1/100th or just 1/10th steps) If it's 1/100th, your code should run cyclic at least at 100 * pulse frequency If your pulses come with 10 kHz your code should run cyclic at 1/1 000 000 second this is for the -04 Pic just one instruction. Of course interrupt based some time can be saved but still..... Step 4: How will my intructions my code approx be with what hardware and how long will it take Step 5: Choose the right PIC. For code examples look at: http://www.piclist.com/ The best way to handel this is program it yourself. If you come to a real obstacle, It would be my pleasure to help you. Good Luck, Alexander p.s. I Don't give a fish, I teach how to fish (or something like that) Thanks Alexander, however I wanted the code so I could find out if the pic could do this and then I would learn the language. Think of it as me starving to death, so you give me a fish, but then to save myself from starving to death again, i teach myself to fish, if you get me :-) I get your drift, so hopefully you'll see shore soon Still I don't give you fish, because I don't know what fish to give without more information. Let's start with the fish lessons: first initialize the input's, in the datasheet this is explained. then make the input an interrupt (on change). Start a timer (not interrupt based) this is also explained in the datasheet. If the input changes, check in what direction and read out the timer if applicable or reset it otherwise (also explained in the datasheet). So if you want to know how long the pulse stays high, read the timer on change to low and reset the timer on change to high. Then make some conversions in to get the exact time The last thing to do is make an output of some kind so you can see the measured time. Now get starting and post the Errors or the problems. Good luck, Alexander p.s. sometimes I say RTFM, because with some minor changes you can find everything you need there. |
#6
|
|||
|
|||
On Tue, 05 Jul 2005 17:38:57 +0000, Michael Hims wrote:
Hi, I recently bought the pic programmer kit from velleman and need some code quick. I need to measure the width of pwm pulses coming from a r/c rx. It is a pic16f627-04p. Can anyone provide me with the code? I think the language is assembly. I'm not a PIC programmer yet, but I looked up the 16F627, and they have an input capture function - that is, the hardware can measure frequency and probably pulse width for you - r/c pulses are way slow, so you have all the time in the world. But there's a lot more to a program than just a chunk of code that can initialize the timer capture registers and interrupts, then handle the interrupts and keep track of the intervals - then you still have to _do_ something with that information. Learning to program it shouldn't be hard - it only has 32 instructions! Good Luck! Rich |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lets talk code and Safety Ideas | Home Repair | |||
Keeprite EnviroPlus90 power vent water leak | Home Repair | |||
blower keeps running on 383KAV gas furnace - error code is 33 | Home Repair | |||
Do you have Past Woodpeck Weekly Special Email? | Woodworking | |||
Repairing home in Pennsylvania BS! | Home Repair |