Electronics (alt.electronics)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Michael Hims
 
Posts: n/a
Default 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   Report Post  
JeffM
 
Posts: n/a
Default

I recently bought the pic programmer kit...and need some code
Michael Hims


http://www.google.com/search?q=piclist

  #3   Report Post  
Alexander
 
Posts: n/a
Default

"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   Report Post  
Michael Hims
 
Posts: n/a
Default


"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   Report Post  
Alexander
 
Posts: n/a
Default

"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   Report Post  
Rich Grise
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lets talk code and Safety Ideas geoman Home Repair 7 January 23rd 05 07:09 PM
Keeprite EnviroPlus90 power vent water leak Norman Home Repair 6 December 14th 04 05:46 AM
blower keeps running on 383KAV gas furnace - error code is 33 Thomas Miller Home Repair 10 October 12th 04 01:05 AM
Do you have Past Woodpeck Weekly Special Email? Jeremy Woodworking 2 August 8th 04 03:24 AM
Repairing home in Pennsylvania BS! TOM KAN PA Home Repair 7 May 12th 04 03:06 PM


All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 DIYbanter.
The comments are property of their posters.
 

About Us

"It's about DIY & home improvement"