How to?????? >> square wave inverter. Feedback option needed


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2013
    Location
    Dhaka, Bangladesh
    Posts
    20

    Exclamation How to?????? >> square wave inverter. Feedback option needed

    Hi,
    I design a Full bride Inverter. But I want to add feedback option to my project. I got 50Hz freq from my full bridge.
    plz anyone help me!!!!!!!!!! How I add feedback to my project??????


    Code:
    DEFINE OSC 16
    ON INTERRUPT GOTO UPDATE
    
    DIR VAR BYTE
    '************************* Assign some Interrupt associated aliases 
    T0IE VAR INTCON.5 ' TMR0 Overflow Interrupt Enable 
    T0IF VAR INTCON.2 ' TMR0 Overflow Interrupt Flag 
    GIE VAR INTCON.7 ' Global Interrupt Enable 
    PS0 VAR OPTION_REG.0 ' Prescaler ratio bit-0 
    PS1 VAR OPTION_REG.1 ' Prescaler ratio bit-1 
    PS2 VAR OPTION_REG.2 ' Prescaler ratio bit-2 
    PSA VAR OPTION_REG.3 ' Prescaler Assignment (1=assigned to WDT 0=assigned to oscillator) 
    T0CS VAR OPTION_REG.5 ' Timer0 Clock Source Select (0=Internal clock 1=External PORTA.4)
    
    PWM1 VAR PORTC.5 ' Alias servo pin1
    PWM2 VAR PORTC.6 ' Alias servo pin2 
    TRISC = 000000 ' Configure PORTC as outputs 
    PORTC = 0 ' Clear PORTB 
    '********************* Initiate the interrupt 
    GIE = 0 ' Turn off global interrupts 
    PSA = 0 ' Assign the prescaler to external oscillator 
    PS0 = 1 ' Set the prescaler 
    PS1 = 1 ' to increment TMR0 
    PS2 = 1 ' every 256th instruction cycle 
    T0CS = 0 ' Assign TMR0 clock to internal source 
    TMR0 = 0 ' Clear TMR0 initially 
    T0IE = 1 ' Enable TMR0 overflow interrupt 
    GIE = 1 ' Enable global interrupts
    
    MAIN:
    
    GOTO MAIN
    
    DISABLE
    UPDATE:
    TMR0 = 100
    IF DIR = 0 THEN
    PWM1 = 1
    PWM2 = 0
    DIR = 1
    ELSE 
    PWM2 = 1
    PWM1 = 0
    DIR = 0
    ENDIF
    T0IF = 0
    RESUME
    ENABLE

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: How to?????? >> square wave inverter. Feedback option needed

    Just some observations first:
    "PORTC = 0 ' Clear PORTB", your comment says Clear PORTB yet your code states PORTC = 0
    "MAIN:

    GOTO MAIN" Add a pause in there; "MAIN: : PAUSE 10 : GOTO MAIN"

    With that out of the way, what do you wish to look at for feedback? If you have an analog voltage, you can use an ADCIN 0, FB command followed with:
    IF FB > X then
    take action
    endif
    IF FB < X then
    no action
    endif

    Let's start there before I type 3 pages and still not answer your question.

    Mike

Similar Threads

  1. Replies: 6
    Last Post: - 31st March 2014, 13:25
  2. generating square wave
    By boscox in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th April 2012, 07:29
  3. square wave inverter with pic 16f72
    By Rupesh in forum mel PIC BASIC
    Replies: 0
    Last Post: - 25th December 2011, 17:42
  4. Generating square-wave of 200kHz
    By sirvo in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd March 2011, 21:06
  5. square to sine wave help
    By TONIGALEA in forum General
    Replies: 6
    Last Post: - 2nd July 2006, 09:32

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