MikroBasic to PBP Pro: Boost mode SMPS


Results 1 to 29 of 29

Threaded View

  1. #10
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: MikroBasic to PBP Pro: Boost mode SMPS

    Frustrated. Not sure what I am missing now. The CCP1 pin is always high, LED flashes correctly.

    Code:
    DEFINE OSC 48
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    DEFINE CCP1_REG PORTC
    DEFINE CCP1_BIT 2   
    
    
    final_period var byte
    final_duty var byte
    high_duty var byte
    low_duty var byte
    
    
    ADCON1 = 00001011
    ADCON2 = 00000011
    
    
    TRISA = 00001111
    TRISB = 01110000
    TRISC = 00000000
    CMCON = 7
    
    
    CCP1CON = 00111100
    PR2 = 44
    high_duty=(final_duty>>2)        'high 6 bits in CCPR1L
          low_duty=(final_duty<<6)         'low two bits for CCP1CON
          low_duty=(low_duty>>2)           'shift back to CCP1CON<5:4>
          low_duty.3=1                     'PWM configuration bit
          low_duty.2=1                     'PWM configuration bit
    CCPR1L=high_duty
    CCP1CON = $0C
    T2CON = 4
    
    
    main:
    PORTC.0 = 1
    pause 500
    PORTC.0 = 0
    Pause 500
    goto main
    Last edited by jmgelba; - 25th October 2011 at 18:39.

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