Menu

Who has a working pure sine wave inverter code in gcb and diagram

samco
2023-05-17
2023-05-18
  • samco

    samco - 2023-05-17
     

    Last edit: samco 2025-03-14
    • Anobium

      Anobium - 2023-05-17

      I will let others offer solutions but they will need to know the frequency and magnitude.

       

      Last edit: Anobium 2023-05-17
    • Sod Almighty

      Sod Almighty - 2023-05-17

      Do you work for a fellow named Dave, by any chance....?

       
  • samco

    samco - 2023-05-17

    thanks for your respond @Anobium it will be the following, 50Hz 220V sine wave o/p, feedback control , 220V i/p charging with with current about 10 to 15A ,Led display

     
  • samco

    samco - 2023-05-17

    thanks for your respond @Anobium it will be the following, 50Hz 220V sine wave o/p, feedback control , 220V i/p charging with with current about 10 to 15A ,Led display, using pic16f88,72,73, 16Mhz,20Mhz

     

    Last edit: samco 2023-05-17
  • Anobium

    Anobium - 2023-05-18

    I think you posted on this in the past. Generating a Sine Wave see https://www.engineersgarage.com/how-to-generate-sine-wave-using-pwm-with-pic-microcontroller-part-19-25/ this code will port.

    Re the electrics - you were advised previously. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/28151ce38d/?limit=25#ba6c/77de as follows:

    To add a note of caution...
    You may be only building this in 'code' and not in hardware, but If you are building this in hardware, my advice would be: Be incredibly careful.

    The slightest mistake in the hardware could lead to a potentially life threatening failure. The slightest mistake in code could also lead to potentially life threatening failure.

    I've made (purely hardware) inverters myself, and when they go bang, they go bang!

     
  • samco

    samco - 2023-05-18

    thank you for you quickly respond but all i asked is for gcb language so i can get little understand of how to implement it, here, I found this while am searching for example in gcb and is your guide to someone, now what i dont understand is how to add a feedback table and charging stage i will be happy is any one here can guide me the more thanks
    ; ----- Configuration
    #chip 16F684,8

    Dim TBL_POINTER_NEW, TBL_POINTER_OLD, TBL_POINTER_SHIFT, SET_FREQ as Integer
    
    SET_FREQ = 410
    TBL_POINTER_SHIFT = 0
    TBL_POINTER_NEW = 0
    TBL_POINTER_OLD = 0
    DUTY_CYCLE = 0
    
    Dir portc.2 out
    HPWM 1, SET_FREQ, DUTY_CYCLE
    On Interrupt Timer2Match call HandleSineWave
    
    Do
    
    Loop
    
    Sub HandleSineWave
    
        TBL_POINTER_NEW = TBL_POINTER_OLD + SET_FREQ
        if (TBL_POINTER_NEW < TBL_POINTER_OLD) then
            P1M1 = !P1M1 ' Reverse direction of full-bridge
        End if
    
        TBL_POINTER_SHIFT =  FnLSR(TBL_POINTER_NEW, 11)
        DUTY_CYCLE = TBL_POINTER_SHIFT
    
        readtable sin_table, DUTY_CYCLE,  CCPR1L
    
        TBL_POINTER_OLD = TBL_POINTER_NEW
        TMR2IF = 0
    
    End Sub
    
    table sin_table
    0,25,49,73,96,118,137,
    159,177,193,208,220,231,239,245,249,250,249,245,
    239,231,220,208,193,177,159,137,118,96,73,49,25
    end table
    
     
  • samco

    samco - 2023-05-18

    please I really need help and how it should be placed well.
    feedback pointer and charging mode
    ; ----- Configuration
    #chip 16F684,8

    Dim TBL_POINTER_NEW, TBL_POINTER_OLD, TBL_POINTER_SHIFT, SET_FREQ as Integer
    
    SET_FREQ = 410
    TBL_POINTER_SHIFT = 0
    TBL_POINTER_NEW = 0
    TBL_POINTER_OLD = 0
    DUTY_CYCLE = 0
    
    
    Dir feedback in  'as portA.2
    Dir portc.2 out
    HPWM 1, SET_FREQ, DUTY_CYCLE
    On Interrupt Timer2Match call HandleSineWave
       waituntill switch_button=1
    Do
          if switch_button =on and mains=1then goto charging_mode
          if switch_button =off and mains =1 then goto charging_mode
          else
          mains =0
    Loop
    charging_mode:
    relay=o //put relay off
    on pwm for charging
    return
    

    if feedback <9 then feedback =feedback +1
    else
    feedback >10
    end if
    Sub HandleSineWave

        TBL_POINTER_NEW = TBL_POINTER_OLD + SET_FREQ
        if (TBL_POINTER_NEW < TBL_POINTER_OLD) then
            'P1M1 = !P1M1 ' Reverse direction of full-bridge
      direction =1
      portB.0=1
        portB.1=0
        portB.2=1
        portB.3=0
        direction =0
        else
        portB.0=1
        portB.1=0
        portB.2=1
        portB.3=0
        direction=1
        End if
    
        TBL_POINTER_SHIFT =  FnLSR(TBL_POINTER_NEW, 11)
        DUTY_CYCLE = TBL_POINTER_SHIFT
    
        readtable sin_table, DUTY_CYCLE,  CCPR1L
    
        TBL_POINTER_OLD = TBL_POINTER_NEW+feedback
        TMR2IF = 0
    

    feedback =TBL_POINTER _NEW
    End Sub

    table sin_table
    0,25,49,73,96,118,137,
    159,177,193,208,220,231,239,245,249,250,249,245,
    239,231,220,208,193,177,159,137,118,96,73,49,25
    end table
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.