|
|||||||
| Home | Forums | Rules | Articles | Store | Gallery | Blogs | Register | Donations | FAQ | Calendar | Search | Today's Posts | Mark Forums Read | Search |
|
Please consider donating to help us continue to serve you.
Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving |
|
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England
|
Just started on a design for a simple PIC micro SMPS.
This one converts 30 to 55 volts to 12 volts. PIC SMPS
__________________
http://www.murtonpikesystems.co.uk PCBCAD40 pcb design software. Last edited by nigelwright7557; 26th October 2010 at 12:26 AM. |
|
|
|
|
#2 |
|
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England
|
Here is the simple PIC12f508 code.
;INTERNAL OSC, INTERNAL MCLR, POWER UP TIMER ON 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_ON & _CP_OFF & _IntRC_OSC INCLUDE MACRO.ASM ;ACCESSES REGISTER BANK BIT #DEFINE RB0 STATUS,5 ; #DEFINE FEEDBACK GPIO,0 ;12 VOLT FEEDBACL #DEFINE MOSFET GPIO,1 ;MOSFET 1=ON STATEA EQU 1 FIRSTA EQU 0 FIRSTB EQU 0 ;*********************** FIRSTRAM EQU 7 ;JUST POINTER TO FIRST RAM LOCATION DEL1 EQU 7 DEL2 EQU 8 DEL3 EQU 9 COUNTL EQU 10 COUNTH EQU 11 TEMP EQU 12 LASTRAM EQU 1FH ;;;;;;;;;;;;;;;;;;;;; ORG 0 ;SETUP PICI/O AND OPTIONS MOVLW FIRSTA MOVWF GPIO CLRWDT MOVLW STATEA TRIS GPIO MOVLW 0C0H ;WEAK PULL UPS OFF & WAKE UP ON PIN CHANGE OFF OPTION ;;;;;;;;;;; ;POWER UP DELAY CALL WAIT1MS MLOOP CLRWDT BTFSC FEEDBACK GOTO MLOOP ;DO NOWT OF OVER 12 VOLTS. BSF MOSFET ;MOSFET ON MOVLW 33 ;WAIT 100US MOVWF TEMP TIME CLRWDT DECFSZ TEMP,F GOTO TIME BCF MOSFET ;MOSFET OFF ;MUST HAVE MOSFET OFF TIME FOR INDUCTOR TO RECOVER. MOVLW 33 MOVWF TEMP TIME2 CLRWDT DECFSZ TEMP,F GOTO TIME2 GOTO MLOOP ;******************** WAIT1MS MOVLW 1 GOTO MSS MS250 MOVLW 250 MSS MOVWF DEL1 MS MOVLW 249 MOVWF DEL2 DD CLRWDT DECFSZ DEL2,F GOTO DD DECFSZ DEL1,F GOTO MS RETLW 0 ;***********************
__________________
http://www.murtonpikesystems.co.uk PCBCAD40 pcb design software. |
|
|
|
|
#3 |
|
diyAudio Member
Join Date: Feb 2009
Location: Greater Seattle Area
|
Any reason not to use a switchmode IC such as UC3843 or similar?
I recommend running faster than 20 kHz. Otherwise, you'll hear your magnetic components whine quite clearly. I also recommend using a buck or buck/boost topology. It looks like you're running very high peak currents through the mosfet and zener diode. I don't think that's good for the reliability of those components. Or better yet... Leave the design effort to the pros and go with one of National Semiconductors' SimpleSwitchers. On some ICs all you need is a resistor network and a couple of caps. On others, you have to supply an inductor and a diode as well. It's not rocket science, but it is slightly more cumbersome than the average linear regulator design. If you don't need a high output power, something like the cheapo flyback supply described by Dwaine Reid in Electronic Design April 8, 2010. "Build Your Own Ultra-Low-Cost Isolated DC-DC Converter" would work. You should be able to get to the article through a google search (or go to Electronic Design directly). ~Tom |
|
|
|
|
#4 | |
|
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England
|
Quote:
I can use an 8 pin PIC that is around 60p. The zener is just a fast diode, used wrong part from library. The inductor is 70p. The P channel MOSFET can be a cheap part. The circuit relies on a PIC input threshold of 2 volts, so all I have to do is scale the feedback voltage for the PIC. I have used the watchdog on the PIC in case of failure sending 35 volts to the 12 volt supply.
__________________
http://www.murtonpikesystems.co.uk PCBCAD40 pcb design software. |
|
|
|
|
|
#5 |
|
Banned
|
It's a bit hard to read the schematic. I've redrawn it to make it a bit more comprehensible. Is this what you've got?
PIC_switcher.jpg w |
|
|
|
|
#6 |
|
diyAudio Member
|
So wait, it's all software loops? And fixed? :barf:
__________________
See my Electronics webpage -- the home of Vacuum Tube Drag Racing. The key to being a successful Audiophile: "I reject your reality and substitute my own!" |
|
|
|
|
#7 |
|
diyAudio Member
Join Date: Apr 2010
|
Both this and the Electronic Design article are dead simple. but I can see "possibilities" where such a low-cost design could have a lit more features.
But yeah, two loops to make a fixed width rectangular wave is awfully basic - the PIC might as well be a 555 timer chip. First off, I'd go to C rather than assembly - embedded C compilers are pretty darn good thesedays, and they're available for every microcontoller, usually from at least three sources - the manufacturer, third parties such as IAR, and freeware/GCC versions. Even "pay" versions have free eval code-limited versions with the limitation way above the code needed for this. If you don't know C, it's worth learning. Dunno what 60p is in USD, but TI has microcontrollers starting at USD $0.25: MSP430 Value Line - TI.com and projecting from the 1k cost, one with a 10-bit A/D is less than twice that. That's what I'd use to read the output voltage for feedback. I've wondered why switching regulator chips seem to be relatively expensive (several US dollars each) when the parts for something like this are so cheap, but I recall using a LT1072 many years ago, and such chips have features that would take a good deal of design, coding and fine-tuning time to build into a microcontroller-controlled SMPS. OTOH, there does seem to be a bit of info out there: microcontroller SMPS - Google Search |
|
|
|
|
#8 |
|
diyAudio Member
|
Cool project, had plan to do one myself with PIC
you made the code? But I have to say I DO NOT like assembler
|
|
|
|
|
#9 | |
|
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England
|
Quote:
It is just a first fraft.
__________________
http://www.murtonpikesystems.co.uk PCBCAD40 pcb design software. |
|
|
|
|
|
#10 |
|
diyAudio Member
Join Date: Jul 2005
Location: Montréal QC
|
I used to use a PWM controller in my previous job :
Microchip dsPIC33FJ12MC201 IT's a motor control PIC with several PWM channels and ADC/DACs...It does what you want - and only $1.80, IIRC! You can write to it in C, and the free IDEs are great. MPLAB!
__________________
http://blog.liammartin.com |
|
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Controlling a relay with a PIC microcontroller | rtarbell | Parts | 9 | 12th October 2006 09:29 PM |
| PIC Microcontroller starter kit?? | Zero Cool | Everything Else | 15 | 25th July 2006 01:24 PM |
| wiring config..of 4 pin multi (pic) | jonz | Everything Else | 0 | 1st October 2004 10:55 PM |
| New To Site? | Need Help? |
| Page generated in 0.12043 seconds (83.80% PHP - 16.20% MySQL) with 11 queries |