Do you need to program the PIC micro?
Yes PIC code is here.
You can work out i/o from the code for a circuit diagram.
;INTH0.ASM
;**********
;INTERNAL OSC, INTERNAL MCLR, POWER UP TIMER ON
;
;ON POWER UP WAIT ONE SECOND
;IF MAINS IS THER RAMP UP PHASE ANGLE UNTIL FULLY ON AND KEEP ON UNTIL MAISN FAILS
LIST R=DEC
LIST P=PIC12F508
;INCLUDE REGISTER DEFINITIONS
INCLUDE P12F508.INC
;_MCLRE_ON EQU H'0FFF'
;_MCLRE_OFF EQU H'0FEF'
;_CP_ON EQU H'0FF7'
;_CP_OFF EQU H'0FFF'
;_WDT_ON EQU H'0FFF'
;_WDT_OFF EQU H'0FFB'
;_LP_OSC EQU H'0FFC'
;_XT_OSC EQU H'0FFD'
;_IntRC_OSC EQU H'0FFE'
;_ExtRC_OSC EQU H'0FFF'
__CONFIG _MCLRE_OFF & _WDT_OFF & _CP_OFF & _IntRC_OSC
INCLUDE MACRO.ASM
;ACCESSES REGISTER BANK BIT
#DEFINE RB0 STATUS,5
;
#DEFINE TRIAC GPIO,0
#DEFINE SWITCH GPIO,1 ;
#DEFINE MAINS GPIO,2 ;
#DEFINE LED GPIO,5 ;
STATEA EQU 6
FIRSTA EQU 0
;***********************
FIRSTRAM EQU 7 ;JUST POINTER TO FIRST RAM LOCATION
DEL1 EQU 7
DEL2 EQU 8
WAITTIME EQU 9
LOOPCOUNT EQU 10
MAINSFLAG EQU 11
TIMEOUTL EQU 12
TIMEOUTH EQU 13
LASTMAINS EQU 14
LASTRAM EQU 1FH
;;;;;;;;;;;;;;;;;;;;;
ORG 0
MOVWF OSCCAL
MOVLW FIRSTA
MOVWF GPIO
CLRWDT
MOVLW STATEA
TRIS GPIO
MOVLW 0C0H ;WEAK PULL UPS OFF & WAKE UP ON PIN CHANGE OFF
OPTION
CALL WAIT1SEC ;LET POWER SUPPLY CAP CHARGE UP.
;;;;;;;;;;;;;;;;;;;;;;;
MLOOP BCF LED
BCF TRIAC
CALL WAITMAINSEDGETIMEOUT
BC MLOOP
MOVLW 8
MOVWF WAITTIME
LOOP1
CALL TOGGLELED
MOVLW 25
BTFSC SWITCH
MOVLW 50
MOVWF LOOPCOUNT
LOOP2
MOVF WAITTIME,W
CALL WAITWMS
CALL WAITMAINSEDGETIMEOUTZ ;WAIT MAINS EDGE WITH TIMEOUT WITH TRIAC ON
BC MLOOP
DECFSZ LOOPCOUNT,F
GOTO LOOP2
DECFSZ WAITTIME,F
GOTO LOOP1
RUNLOOP
BCF LED ;KEEP LED OFF TO SAVE POWER
CALL WAITMAINSEDGETIMEOUTZ ;WAIT MAINS EDGE WITH TIMEOUT WITH TRIAC ON
BNC RUNLOOP
GOTO MLOOP
;******************************
WAITMAINSEDGETIMEOUT
CLRF MAINSFLAG
MOVLW 4
BTFSC MAINS
MOVWF MAINSFLAG
;
MOVLW LOW 1071 ;15MS TIMEOUT
MOVWF TIMEOUTL
MOVLW HIGH 1071
MOVWF TIMEOUTH
WM1 MOVF GPIO,W ;14 US LOOP
ANDLW 4
XORWF MAINSFLAG,W
BNZ MAINSCHANGED
DEC16 TIMEOUTL ;(4US)
MOVF TIMEOUTL,W
IORWF TIMEOUTH,W
BNZ WM1
SETC
RETLW 0
MAINSCHANGED
CLRC
RETLW 0
;********************
;WAIT MAINS EDGE WITH TRIAC ON
WAITMAINSEDGETIMEOUTZ
CLRF MAINSFLAG
MOVLW 4
BTFSC MAINS
MOVWF MAINSFLAG
;
MOVLW LOW 1071 ;15MS TIMEOUT
MOVWF TIMEOUTL
MOVLW HIGH 1071
MOVWF TIMEOUTH
BSF TRIAC
WM1Z
MOVF GPIO,W ;14 US
ANDLW 4
XORWF MAINSFLAG,W
BNZ MAINSCHANGEDZ
DEC16 TIMEOUTL ;(4US)
MOVF TIMEOUTL,W
IORWF TIMEOUTH,W
BNZ WM1Z
BCF TRIAC
SETC
RETLW 0
MAINSCHANGEDZ
BCF TRIAC
CLRC
RETLW 0
;********************
WAIT1MS MOVLW 1
GOTO WAITWMS
MS250 MOVLW 250
;ALSO ENTERED HERE
WAITWMS MOVWF DEL1
MS MOVLW 249
MOVWF DEL2
DD NOP
DECFSZ DEL2,F
GOTO DD
DECFSZ DEL1,F
GOTO MS
RETLW 0
;***********************
WAIT1SEC
CALL MS250
CALL MS250
CALL MS250
GOTO MS250
;***********************
WAIT100US
MOVLW 25
MOVWF DEL2
DD100 NOP
DECFSZ DEL2,F
GOTO DD100
RETLW 0
;**********************
TOGGLELED BTFSC LED
GOTO WAS1
WAS0 BSF LED
RETLW 0
WAS1 BCF LED
RETLW 0
;**********************
END
Thanks for sharing the code.
I have nothing against micros. The reason I brought up the MOC is for the benefit of users who are not versed in micro programing.
BTW, what is the easiest language to learn for beginners to program pic micros?
I have nothing against micros. The reason I brought up the MOC is for the benefit of users who are not versed in micro programing.
BTW, what is the easiest language to learn for beginners to program pic micros?
BTW, what is the easiest language to learn for beginners to program pic micros?
You can use assembler or C for programming PIC's.
I can happily use either.
The total resistance seen by the mains at start up (after the current pulse has saturated the transformer core) will be 28r.
The first current pulse starts to charge the output capacitor, and does not cause saturation. (Unless remanent flux is very high in the same direction as the flux generated by the first pulse.) Flux can be calculated by integrating induced voltage/turns divided by core cross section, and adding to initial flux (remanence). Current is irrelevant. Since in the first period output cap limits voltage to a much lower value than the nominal, saturation is very unlikely.
for the conditions you supplied, I showed that a 27r to 30r added resistor would prevent a close rated fuse blowing at start up on a 230Vac mains supply.
5r and 10r are way short of my suggested values.
If your solution is (was) good, it doesn't mean a different solution is bad. In this case the facts telling lower value is better were already known. And nobody complained about fuses.
rhythmsandy
For what it is worth, I had the same problem with the 200/300 watt/channel amp that I had built with lights dimming. With 22,000uF per rail in the power supply at 68 volts the 35A bridge rectifier was vulnerable to overload at switch-on. This problem was minimized by having a 'soft start' 15 ohm 10 watt resistor connected in series between the rectifier and the 22,000uF input capacitor in each P/S leg.
Each of these 15 ohm resistors (in each leg) were then bypassed by relay contacts which operated when the charge across the capacitors reached 70% of the final P/S voltage. The relay will drop out when the P/S volts drops down to about 30% .
The relay used for this P/S 'soft start' is simply wired in series with the appropriate value of resistance of suitable wattage across one leg of the power supply.
Using a 'soft start' on both the primary and the secondary sides of the Mains transformer will greatly diminish or even eliminate any 'dimming of the lights' as well as protecting the power supply from exploding, ageing electrolytic power supply caps.
C.M
http://www.diyaudio.com/forums/members/rhythmsandy.html
For what it is worth, I had the same problem with the 200/300 watt/channel amp that I had built with lights dimming. With 22,000uF per rail in the power supply at 68 volts the 35A bridge rectifier was vulnerable to overload at switch-on. This problem was minimized by having a 'soft start' 15 ohm 10 watt resistor connected in series between the rectifier and the 22,000uF input capacitor in each P/S leg.
Each of these 15 ohm resistors (in each leg) were then bypassed by relay contacts which operated when the charge across the capacitors reached 70% of the final P/S voltage. The relay will drop out when the P/S volts drops down to about 30% .
The relay used for this P/S 'soft start' is simply wired in series with the appropriate value of resistance of suitable wattage across one leg of the power supply.
Using a 'soft start' on both the primary and the secondary sides of the Mains transformer will greatly diminish or even eliminate any 'dimming of the lights' as well as protecting the power supply from exploding, ageing electrolytic power supply caps.
C.M
http://www.diyaudio.com/forums/members/rhythmsandy.html
And nobody complained about fuses.
From a design perspective, the protective performance of a mains side fuse is much improved if the fuse current rating can be reduced by using a NTC in conjunction with a time-delay/slow blow fuse. There is a risk that a fuse may sometimes blow when the mains switch is quickly operated such that the main filter capacitor is discharged, but the NTC temperature has not reduced by much - however fuse operation has quite wide tolerances, as does other influences such as transformer inrush and filter capacitance and fuse current step values.
- Status
- Not open for further replies.