i need help for 12F1571 pwm


+ Reply to Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 35

Thread: i need help for 12F1571 pwm872 days old

  1. #1
    Junior Member tadd's Avatar
    Join Date
    Dec 2014
    Posts
    66
    Thumbs Up
    Received: 15
    Given: 0
    Total Downloaded
    90.24 MB

    1 Not allowed!

    Default i need help for 12F1571 pwm

    i need pwm 1-2-3 not working , where is the problem?

    Code:
        Device = 12F1571 
        Declare Xtal = 4
        
        Config1 FOSC_INTOSC,WDTE_OFF,PWRTE_ON,MCLRE_Off,CP_Off,BOREN_OFF,CLKOUTEN_OFF
        Config2 WRT_OFF,PLLEN_On,STVREN_OFF,BORV_LO,LPBORen_OFF,LVP_OFF
        Declare Hserial_Baud = 9600
        
    TRISA = 00000
    ANSELA = 00000
        
    '
    ' Create variables for the Ln routine
    
    PWM1CLKCON = 000000
    PWM2CLKCON = 000000
    PWM3CLKCON = 000000
    
    
    PWMLD = 000111
    PWMOUT = 000111
    
    
    PWM1PHH = 000011   'PHASE
    PWM1PHL = 111111
    PWM2PHH = 111111
    PWM2PHL = 111111
    PWM3PHH = 111111
    PWM3PHL = 111111
    
    
    PWM1DCH = 000111  'DUTY CYCLE
    PWM1DCL = 011111
    PWM2DCH = 111111  
    PWM2DCL = 111111
    PWM3DCH = 111111  
    PWM3DCL = 111111
    
    PWM1PRH = 000001  'PERIOD
    PWM1PRL = 000111
    PWM2PRH = 111111  
    PWM2PRL = 111111
    PWM3PRH = 111111  
    PWM3PRL = 111111
    
    
    PWM1OFH = 50   'OFFSET
    PWM1OFL = 10
    PWM2OFH = 240
    PWM2OFL = 100
    PWM3OFH = 240
    PWM3OFL = 100
    
    
    PWM1TMRH = 22   'TIMER
    PWM1TMRL = 4
    PWM2TMRH = 255
    PWM2TMRL = 255
    PWM3TMRH = 255
    PWM3TMRL = 255
    
    PWM1CON = 101000
    PWM2CON = 101000
    PWM3CON = 101000
    
    
    PWMEN = 000111
    
    main:
    delayms 10
    toggle porta.5
    goto main

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,332
    Thumbs Up
    Received: 40
    Given: 39
    Total Downloaded
    3.36 GB

    1 Not allowed!

    Default Re: i need help for 12F1571 pwm

    Can you see PORTA.5 toggling every 10mS?

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member tadd's Avatar
    Join Date
    Dec 2014
    Posts
    66
    Thumbs Up
    Received: 15
    Given: 0
    Total Downloaded
    90.24 MB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    PORTA.5 toggle 80ms , 6,24Hz

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,332
    Thumbs Up
    Received: 40
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    But PORTA.5 should be high for 10mS then low for 10mS?

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Junior Member tadd's Avatar
    Join Date
    Dec 2014
    Posts
    66
    Thumbs Up
    Received: 15
    Given: 0
    Total Downloaded
    90.24 MB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    yes, high pulse width 80mS and low pulsewidth 80mS , APFCON register pwm1 out pin is PORTA.1
    Last edited by tadd; 31st May 2017 at 11:29.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,332
    Thumbs Up
    Received: 40
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    I'm confused. Somebody who knows the ins and outs here?

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    473
    Thumbs Up
    Received: 58
    Given: 0
    Total Downloaded
    330.54 MB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    The INTOSC defaults to 500KHz. To set it to match 'Declare Xtal = 4' set the OSCCON IRCF bits to %1101.

    Also, you'll need to add a '%' prefix to all of those binary constants.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Junior Member tadd's Avatar
    Join Date
    Dec 2014
    Posts
    66
    Thumbs Up
    Received: 15
    Given: 0
    Total Downloaded
    90.24 MB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    thank you friends but main problem is pwm, there is no movement pwms output pins

    i need 3 working pwm

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    491
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    3.57 GB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    I have not had time to take an in depth look at the data in regard to the PWM operation of the device however a couple of things struck me...

    1st, you are only assigning 6 bits to your registers as the registers are 8 bit I would say that is bad practice because...
    a) By writing all 8 bits you can be absolutely certain that all the bit are as they should for what you are doing.
    b) You have no idea if the complier is seeing them as the MSB or LSB bits and so it may be setting different bits to those you think you are setting.
    c) Those trying to help you cannot be certain if they are the MSB or LSB which makes it difficult to check if you are setting the correct bits to the correct value.
    When writing to registers that have unimplemented and/or Read Only bits I always set those bit to 0 - seems to work

    2nd, unless I am missing something I think your settings for the PWMxCON registers are incorrect. Should they not be 11100000 as you have bit 6 set at 0 so the PWM outputs are disabled and I would have thought they should be enabled in order to get a PWM signal out.
    Last edited by Stephen Moss; 1st June 2017 at 09:01.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,332
    Thumbs Up
    Received: 40
    Given: 39
    Total Downloaded
    3.36 GB

    0 Not allowed!

    Default Re: i need help for 12F1571 pwm

    Stephen

    I thought the "6 bits" was due to the way this web site treats percent characters. But looking further I think you might be right.
    The compiler throws an error if I try his code - "Value will overflow a byte variable", which is correct.

    Charlie
    Last edited by charliecoultas; 1st June 2017 at 09:10.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. PWM to Analog Out using CCP PWM Mode
      By fgcity in forum Proton Plus Compiler v3
      Replies: 1
      Last Post: 2nd September 2015, 13:32
    2. Replies: 8
      Last Post: 2nd August 2013, 12:57
    3. Pwm ????
      By NEX in forum Proton Plus Compiler v3
      Replies: 4
      Last Post: 22nd December 2012, 12:40
    4. Pwm
      By naseerak in forum Proton Plus Compiler v3
      Replies: 11
      Last Post: 25th October 2008, 08:54

    Tags for this Thread

    Posting Permissions

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