pwm 18f2431


Closed Thread
Results 1 to 21 of 21

Thread: pwm 18f2431

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    63

    Default pwm 18f2431

    ive been doing a fair amount of research into writing basic code now, but at one point it gets a bit vague. im using the 18f2431, and in the data sheets it describes in assembley code (im presuming thats the language they use) and the function i require is cap1 0111 which makes PORTA.3 to measure the pwm of that specific signal. this is similar for cap2 and cap3 as well.

    ive been looking through the basic language and i get a few commands, such as PULSIN, which says it measures the pulse width on a pin. would this command suffice for the 18f2431 cap1 cap2 and cap3 pins? or is there something different? since i chose the pin because of its advantages of measuring signals pwm and ffrequency etc... it would seem a bit daft having chosen it too find that any random pic would be able to just be coded with PULSIN and measure it straight off.
    Last edited by robertpeach; - 17th August 2009 at 14:34.

  2. #2
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    ok i found hpwm aswell, which is specifically for pics with hardware suited for pwm's... so may have just been a bit unobservent! is there a way for the hpwm to be continually changing? e.g. instead of just having a specific pwm i can have it changing as the input averages change etc... almost as though instead of putting a number into the code i can put temporarily saved data such as hpwm 1, var, 20000?

    ok i just confused myself all over again. ive just been mixing up inputs and outputs. back to original question... is it possible to use the pulsin command to measure on the 18f2431, or does that not take advantage of the special motion feedback module that its provides...?

    sorry
    Last edited by robertpeach; - 17th August 2009 at 15:08.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Original question..
    The software solutions would work but you are correct in thinking the advantage of the motion feed back would be lost.

    The advantage with the motion feed back is it will run in the background and should be able to be used with an interrupt. I have not used that chip yet as I heard about it the same as you from Bruce. I would go with Bruce's idea on this one.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    thanks for the reply,

    yeah i want to use the motion feedback module since its obvious there will be advantages using it (otherwise it would have been pointless to create). its just im a bit sketchy with how i would go about that. the motion feedback module actually continuously measures the pulse width of the input signal, so that would run in the "background" and within my code, i would create interupts that would jump to cap1 and that would give me the pwm (that it was automatically measuring) at that moment in time. and then i can temporarily save that pwm and use it for my algorithms etc. so before the START of my program i would have had to set my cap1 cap2 cap3 all to be measuring the the pwm? (using the assembley code commands to take advantage of its special features)

  5. #5
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    i realise probably the reason noone has posted is because not many ppl have used the 18f2431, but any help at all would be beneficial to me. i kinda seem to have met a dead end with it...

    edit: after more digging, ive been looking into a program for interupts created by darrel taylor that seems quite convincing. it has specific interupts for the motion feedback modules.
    Last edited by robertpeach; - 18th August 2009 at 09:18.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I think you are correct that not many have used this chip. I was hopping Bruce Or Darrel would reply to this. When I get a chance I will look at the data sheet.

    DTs instant interrupts works well for what I have used it for so when the motion module is undrstood they should work well for that too.

    Sorry I can not be more help at this time.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Half-bridge PWM with a 16F684 ?
    By Byte_Butcher in forum General
    Replies: 7
    Last Post: - 17th January 2010, 22:18
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. PWM setting PIC16F887
    By Gevo in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th June 2008, 07:24
  4. using all pins of pwm in pic 18f2431
    By jorgequesada in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 21:43
  5. Tidying Up PWM Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st February 2005, 00:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts