pwm 18f2431


Closed Thread
Results 1 to 21 of 21

Thread: pwm 18f2431

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    You have lost me.
    Where is the file being saved? Are you meaning save the data to eeprom?

    This page has several samples.
    http://www.melabs.com/resources/samples.htm
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    sorry im quite bad at explaining, but ill try my best. ill check that site out as well thanks

    basically its being saved in the thing called SRAM, if im correct. which is similar to normal ram but its for special functions. Basically its just implemented as static ram. with an address of F69H for CAP1BUFH, which is the place where "capture 1 register highbyte", the place where the measurement (period in my case) has been stored temporarily, till it is overwritten by the next measurement.

  3. #3
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    ok its easier than i thought... u can just right the file address in your calculation.... e.g. (F69H)/5

    am i right... or wrong again? sorry picbasicpro should be here today for me to learn from trial and error... looking at example codes and old manuals on the internet only goes so far

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


    Did you find this post helpful? Yes | No

    Default

    From Micros web site
    Static RAM or SRAM
    Static Random Access Memory. Program memory you can Read/Write on the target board that does not need refreshing frequently.
    Calling it SRAM is a little misleading.

    In your case I think you have the idea. You are talking about program variables. Variables to be used inside the program. Not permanent storage.

    You have for the 18Fs four variable sizes to pick from
    bit, byte, word, long

    near the begining of your code you will have something like
    Code:
    F69H  VAR  BYTE
    Then you can use F69H as in your example.
    The value will be erased at power down.
    Last edited by mackrackit; - 19th August 2009 at 11:09. Reason: spelling
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    ahhh thank you, thats cleared many things up for me. my picbasic pro just arrived so ill be testing all my attempted codings now!

    cheers mack

  6. #6
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    ok well these are the bare bones of my code so far... i havnt actually created the algorithm yet so i havnt actually got a proper dutycycle to put in yet. and things like config settings etc i still have yet to choose. just hope its going in the right direction

    '''''''''''''''''''''''''''''''''''Assembley to collect period on cap1 cap2 and cap3''''''
    asm

    cap1m0 = 0101
    cap1ren = 1
    cap2m0 = 0101
    cap2ren = 1
    cap3m0 = 0101
    cap3ren = 1

    endasm

    '''''''''''''''''''''''''''values put in var for us in calculation''''''''''''''''''

    F69H VAR BYTE 'Value of period at CAP1 ready for calculation
    F67H VAR BYTE 'Value of period at CAP2 ready for calculation
    F65H VAR BYTE 'Value of period at CAP3 ready for calculation

    ''''''''''''''''''''''''''''''''''''Algorithm for finding average''''''''''''''''''''''''


    'yet to write it



    '''''''''''''''''''''''''''''''''''pwm output'''''''''''''''''''''''''''''''''''''''''''' '''

    HPWM 1, 127, 20000
    'obviously unfinished and dutycycle would not be a fixed 50%

  7. #7
    Join Date
    Aug 2009
    Posts
    63


    Did you find this post helpful? Yes | No

    Default

    whoops just realised the pwm output wasnt quite anything...

    DutyCycle var byte 'byte being the one that is answer of algorithm when thats created
    CCP1CON=0 'output of pwm pin
    TRISC= $00000000

    HPWM 1,DutyCycle,20000

    end
    hopefully that should work

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