Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Study the Sine wave inverter with pic16f73 and TLP250

Status
Not open for further replies.

arif01230

Member level 2
Joined
May 22, 2012
Messages
53
Helped
4
Reputation
8
Reaction score
6
Trophy points
1,288
Activity points
1,568
Sine wave inverter with pic16f73 and TLP250.

- - - Updated - - -

1.jpg PCB available in local market
 
So far you have given us a photogrpah of an unpopulated PCB, a link to what might be an AC line monitor and a reference to your local market which could be anywhere in the World.

What exactly are you looking for? If it's the schematic for the PCB you should contact the manufacturer, their name is on the board.


Brian.
 

what is the function and operation of three coil used in RB7 pin 18 to relay ?
 

I would guess it's an attempt at an RFI filter, the incoming relay power and the relay drive signals are fed through it. Unless the design is being used in an area of very high RF field strength it would serve no useful purpose. Maybe the designer added it to help reduce spikes from the relay de-energizing reaching the PIC but that would be better achieved by better board layout.

Brian.
 

If i short three coil ? Is any problem in the system?
 

I do not know why the designer found it necessary to add it but I can't see any reason why replacing the coils with wire links would make any difference to operation.

Brian.
 
I want to understand this Interrupt Service Rutine for sine SPWM using CCP1.

I made a flow chart to understand it , which I want to share with you. I need your help to understand this part.

Please tel me about this part:
Code:
	ORG     0x0004

	;BTFSC	CHG,1
	;GOTO	LED_IND	
            MOVWF   R_72
            MOVF    STATUS,W
            MOVWF   R_70		;satus_temp
            MOVF    PCLATH,W		;pc_temp
            MOVWF   R_71
            CLRF    PCLATH
            BTFSC   STATUS,RP0
            GOTO    Label_0002
	    GOTO    Label_0004



Label_0002  MOVF    R_72,W
            BCF     STATUS,RP0
            MOVWF   R_72
            BSF     STATUS,RP0
            MOVF    R_70,W
            BCF     STATUS,RP0
            MOVWF   R_70
            BSF     STATUS,RP0
            MOVF    R_71,W
            BCF     STATUS,RP0
            MOVWF   R_71



Label_0004  BTFSC   R_22,5
            GOTO    Label_000B
            MOVLW   0x81
            BSF     STATUS,RP0
            MOVWF   T2CON
            BCF     STATUS,RP0
            BCF     R_22,6
            CLRF    R_48
            GOTO    Label_000C

Label_000B  BCF     STATUS,Z
	    movlw	0X0B		;added for table read
	    subwf	duty,w
            BTFSS   STATUS,Z
            GOTO    Label_000C
            BCF     STATUS,Z
            MOVF    0x48,W
            BTFSC   STATUS,Z
            BCF     R_22,6
            BTFSC   STATUS,Z
            GOTO    Label_000C
            MOVWF   R_41
            BSF     R_22,6
            BSF     STATUS,RP0
            INCF    T2CON,f
            BCF     STATUS,RP0

Label_000C  BCF     STATUS,Z
	    movlw	0X01
	    subwf	duty,w		;added for table read
            BTFSS   STATUS,Z
            GOTO    Label_000D
            BTFSS   R_43,0
            GOTO    Label_000E
            BCF     PORTC,2	;CCP1 out
            CLRF    CCP1CON
            CLRF    CCPR1L
            CLRF    CCPR1H
            MOVLW   0x0C
	    MOVWF   CCP1CON
            BCF     R_43,0
	    BCF	    PORTC,1
	    BSF     PORTC,3
            MOVF    R_45,W
            MOVWF   R_46
            BTFSC   R_43,1
            BSF     R_43,2
            BTFSS   R_43,1
            BCF     R_43,2
            BTFSC   R_22,1
            GOTO    Label_000F
            DECFSZ  R_4A,f
            BTFSS   R_43,2
            BSF     R_22,1
            BTFSS   R_43,2
            GOTO    Label_000F
            DECF    R_51,f
            ;MOVLW   0x79
	MOVLW   0x40		;64.8% DUTY
            SUBWF   R_51,W
            ;MOVLW   0x79
	MOVLW   0x40		;64.8% DUTY
            BTFSS   STATUS,C
            MOVWF   R_51
            GOTO    Label_000D

Label_000E  BCF     PORTC,2
	    CLRF    CCP1CON
            CLRF    CCPR1L
            CLRF    CCPR1H
            MOVLW   0x0C
            MOVWF   CCP1CON
	    BSF	    PORTC,1
	    BCF     PORTC,3
            BSF     R_43,0
            MOVF    0x45,W
            MOVWF   R_46
            BTFSC   R_43,1
            BSF     R_43,2
            BTFSS   R_43,1
            BCF     R_43,2
            BTFSS   R_22,1
            GOTO    Label_000D

Label_000F  BCF     STATUS,C
            RRF     R_46,f
            BCF     STATUS,C
            RRF     R_46,f
            BTFSS   R_43,2
            GOTO    Label_0010
            MOVF    R_46,W
            SUBWF   R_51,f
            ;MOVLW   0x79
	    MOVLW   0x40		;64.8% DUTY
            BTFSS   STATUS,C
            MOVWF   R_51
            MOVF    R_51,W
	    SUBLW   0x3F
            ;SUBLW   0x78
            ;MOVLW   0x79
	    MOVLW   0x40	;64.8% DUTY ??????????
            BTFSC   STATUS,C
            MOVWF   0x51
            GOTO    Label_000D

Label_0010  MOVF    R_46,W
            ADDWF   R_51,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0xFF
            SUBWF   R_51,W
            BTFSS   STATUS    , C
            GOTO    Label_000D
            MOVLW   0xFE
            MOVWF   R_51

Label_000D  CLRF    R_53
	    movlw	0X07
	    movwf	pclath
	    call	table1
            MOVWF   R_3A
            BCF     STATUS,C
            RRF     R_3A,f
            BCF     STATUS,C
            RRF     R_3A,W
            MOVWF   R_3B
            BCF     STATUS,C
            RRF     R_3B,W
            MOVWF   R_3C
            BCF     STATUS,C
            RRF     R_3C,W
            MOVWF   R_3D
            BCF     STATUS,C
            RRF     R_3D,W
            MOVWF   R_3E
            BCF     STATUS,C
            RRF     R_3E,W
            MOVWF   R_3F
            BCF     STATUS,C
            RRF     R_3F,W
            MOVWF   R_40
            COMF    R_51,W
            MOVWF   R_58
            DECF    R_58,f
	;movlw	0X60		;?????????????????
            MOVLW   0x80
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0012

Label_001A  MOVLW   0x40
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0013

Label_001B  MOVLW   0x20
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0014

Label_001C  MOVLW   0x10
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0015

Label_001D  MOVLW   0x08
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0016

Label_001E  MOVLW   0x04
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0017

Label_001F  MOVLW   0x02
            SUBWF   R_58,W
            BTFSC   STATUS,C
            GOTO    Label_0018
            GOTO    Label_0019

Label_0012  MOVF    R_3A,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0x80
            SUBWF   R_58      , f
            GOTO    Label_001A

Label_0013  MOVF    R_3B,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0x40
            SUBWF   R_58,f
            GOTO    Label_001B

Label_0014  MOVF    R_3C,W
            ADDWF   R_53,f
            BTFSC   STATUS    , C
            GOTO    Label_0011
            MOVLW   0x20
            SUBWF   R_58,f
            GOTO    Label_001C

Label_0015  MOVF    R_3D,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0x10
            SUBWF   R_58,f
            GOTO    Label_001D
Label_0016  MOVF    R_3E,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0x08
            SUBWF   R_58,f
            GOTO    Label_001E

Label_0017  MOVF    R_3F,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011
            MOVLW   0x04
            SUBWF   R_58,f
            GOTO    Label_001F
Label_0018  MOVF    R_40,W
            ADDWF   R_53,f
            BTFSC   STATUS,C
            GOTO    Label_0011

Label_0019  BTFSC   R_43,0
            GOTO    Label_0020
            BCF     PORTC,2	;CCP1 out
            CLRF    CCPR1L
            MOVF    R_53,W
	    MOVWF   CCPR1L
            GOTO    Label_0021

Label_0020  BCF     PORTC,2
	    CLRF    CCPR1L
            MOVF    R_53,W
            MOVWF   CCPR1L

Label_0021  movf	duty,w
            BCF     STATUS,Z
	    sublw	0X4D
            BTFSS   STATUS,Z
            GOTO    Label_0022
	    movlw	0X00
	    movwf	duty		;added for table read

Label_0022  incf	duty,f		;added for table read
            BCF     STATUS,Z
	    movf	duty,w
	    sublw	0X29
            BTFSS   STATUS,Z
            GOTO    Label_0023
            BTFSS   R_43,0
            GOTO    Label_0023
PWM_REG     MOVLW   b'10001001'		;RA1 for OUTPUT REGULATION
            MOVWF   ADCON0
            MOVLW   0x1A
            MOVWF   R_42
LOOP_11     DECFSZ  R_42,f
            GOTO    LOOP_11
            BSF     ADCON0,GO
Label_0025  BSF     R_22,7
            BTFSC   ADCON0,GO
            GOTO    Label_0025
            MOVF    ADRES,W
            SUBWF   R_23,W
            BTFSC   STATUS,C
            BSF     R_43,01
            BTFSS   STATUS,C
            BCF     R_43,01
            MOVWF   R_45
            BTFSS   R_43,01
            GOTO    Label_0026
            BTFSS   R_22,01
            GOTO    Label_0027
            SUBWF   R_47,W
            BTFSS   STATUS,C
            DECFSZ  R_2F,f
            GOTO    Label_0027
            ;GOTO    Label_0028		;FOR SHT-CKT TRIP(close for no trip)

Label_0026  MOVLW   0x02
            MOVWF   R_2F
            COMF    R_45,f
            INCF    R_45,f
            GOTO    Label_0027		;end_int_2

Label_0023  BCF     PIR1,1		;no TMR2 to PR2 match	
            BTFSS   R_22,6
            GOTO    Label_0006
            DECFSZ  R_41,f
            GOTO    Label_0006
            BSF     STATUS,RP0		;SELECT BANK1
            DECF    T2CON,f		; not known
            BCF     STATUS,RP0		;SELECT BANK0
            BCF     R_22,6
Label_0027  BCF     PIR1,1		;;no TMR2 to PR2 match	
Label_0006  BCF     STATUS,RP0
            BCF     STATUS,RP1
            MOVF    R_70,W
            MOVWF   STATUS
            MOVF    R_71,W
            MOVWF   PCLATH
            MOVF    R_72,W
            RETFIE
 

arif01230, that is a disassembler listing, it would be far more productive to show the source code and state what language it was written in.

What you have shown is the binary instructions converted back to equivalent instruction names but it does not contain original label names or comments and it appears to have an embedded table in it which the disassembler has incorrectly converted to instructions. As it stands it makes very little sense.

Brian.
 

Hi arif01230 - where have you got this code? I have gone through the entire code one year ago or so. It seemed to me that the programmer took every effort to confuse the newbies. If observed carefully, you will find that some of the instructions and corresponding comments are contradictory. If you see the comment, you will assume something else, whereas actual operation is something other because just before that very instruction, bank has been selected accordingly. I detected the trick while running the code in simulator. It is better not to rely on this code.

If you want to grasp the idea of sine wave inverter, please have a look in the topics offered by Tahmid Mahbub on SPWM. I have got immense help from that posts and successfully built SPWM inverter using PIC16F72, H Bridge driver IR2110 and Quad AND Gate IC HC7408.
 
  • Like
Reactions: awaisu

    awaisu

    Points: 2
    Helpful Answer Positive Rating
How to use code tags when including code to your post?

- - - Updated - - -

Dear swapan

"successfully built SPWM inverter using PIC16F72, H Bridge driver IR2110 and Quad AND Gate IC HC7408."

Can you please share your knowladge and your experience ?

- - - Updated - - -

Dear swapan

Which compiler you use in your SPWM inverter ?

How to use code tags when including code to your post?

test code tags .........

- - - Updated - - -

Code:
How to use code tags when including code to your post?

test code tags .........
 

Can you please share your knowladge and your experience ?

Surely. But I suggest you to study the resources on SPWM written by Mr. Tahmid Mahbub. The link is given below. https://tahmidmc.blogspot.in/p/blog-page.html

I am sure you will get a clear concept from it and be able to build the inverter yourself. Still if you need any help, post it here with specific problem - experts will certainly help you.
 
Dear swapan

Which PIC compiler you use in your SPWM inverter ? CCS c , mikroC or PIC Basic ?
 

what will be the value of “?value?” ?

INC_TRICKLE_DUTY: ;
'SELFCHECK PW,d'100' ;d'100'

if PWM_DUTY_CYLE > “?value?” then GOTO MAIN_FAILURE_CHECK

PWM_DUTY_CYLE = PWM_DUTY_CYLE +1

hpwm 1,PWM_DUTY_CYLE,PWM_FREQUENCY ' pwm on
;
goto main_failure_check
Code:
ASM Code:

INC_TRICKLE_DUTY:
SELFCHECK PW,d'100'	;d'100'
GOTO	MAIN_FAILURE_CHECK
incf	pw,1
movf	pw,w
movwf	ccpr1l
;call	delay40
goto	main_failure_check



When given 1: macro

selfcheck      macro a, bxx
	        movlw bxx
	        xorwf a,0
	        btfsc status,z
endm


When given 2:  Crystal = 16MHz

When given 3:  
‘PWM Duty = (CCPR1L:CCP1CON(5:4)) x Tosc x TMR2 prescale.

MOVLW	d'01'
MOVWF	PW
MOVWF	CCPR1L

BCF	CCP1CON,4
BCF	CCP1CON,5
BCF	CCP1CON,0
BCF	CCP1CON,1
BSF	CCP1CON,2
BSF	CCP1CON,3

MOVLW	b'00000101'
MOVWF	T2CON          ‘TMR2 prescale =1:4

When given 3:  
BSF	STATUS,RP0
MOVLW	d'166'		;6kHz CHARGING PWM
MOVWF	PR2
BCF	STATUS,RP0

- - - Updated - - -

what will be the value of “?value?” ?


INC_TRICKLE_DUTY:

if PWM_DUTY_CYLE > “?value?” then GOTO MAIN_FAILURE_CHECK

PWM_DUTY_CYLE = PWM_DUTY_CYLE +1

hpwm 1,PWM_DUTY_CYLE,PWM_FREQUENCY ' pwm on
goto main_failure_check

- - - Updated - - -

How to Calculate ?

- - - Updated - - -

How to manage the Battery charging with PWM DUTY CYLE?


if my Charging PWM is 6KHz then

1. what will be the value of PWM DUTY CYLE when Batt_Volt < 13.5V and Charging Current CHG_I < 1V (initial condition) ?

2. what will be the value of PWM DUTY CYLE when Batt_Volt < 13.5V and Charging Current CHG_I > 1V ?

3. what will be the value of PWM DUTY CYLE when Batt_Volt >13.5V and Charging Current CHG_I < 1V ?

4. what will be the value of PWM DUTY CYLE when Batt_Volt > 13.5V and Charging Current CHG_I > 1V ?

- - - Updated - - -

How to manage the Battery charging with PWM DUTY CYCLE?
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top