Help With Assembly Code

M

Michael Hims

Guest
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 Hims" <michaelhimsQWQ@blueyonder.co.uk> schreef in bericht
news:RAzye.114556$Vj3.338@fe2.news.blueyonder.co.uk...
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)
 
"Alexander" <electricdummy@hotmail.com> wrote in message
news:daei1p$484$1@news2.zwoll1.ov.home.nl...
"Michael Hims" <michaelhimsQWQ@blueyonder.co.uk> schreef in bericht
news:RAzye.114556$Vj3.338@fe2.news.blueyonder.co.uk...
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 :)
 
"Michael Hims" <michaelhimsQWQ@blueyonder.co.uk> schreef in bericht
news:YKBye.84298$Vo6.11847@fe3.news.blueyonder.co.uk...
"Alexander" <electricdummy@hotmail.com> wrote in message
news:daei1p$484$1@news2.zwoll1.ov.home.nl...
"Michael Hims" <michaelhimsQWQ@blueyonder.co.uk> schreef in bericht
news:RAzye.114556$Vj3.338@fe2.news.blueyonder.co.uk...
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.
 

Welcome to EDABoard.com

Sponsor

Back
Top