We are going to build this today. I am using the PIC12f675 from Microchip. THer is a video below to show the inner workings.
Remove these ads by
Signing UpStep 1Get the Parts
Perf Board
6 volt battery pack (AA) (If you want, it can have a power switch and cover.)
7805 regulator (I use it in case I use a power supply.)
220uF capacitor
2 0.1 ceramic disc capacitors (it should say 104 on it.)
2n2222 NPN bi-polar junction transistor (use this transistor or a power transistor...I say this because 2n2222 can drive up to 1 amp but really, a transistor with 500mA will work.)
7 680ohm Resistors (I say seven because it has 1 "power led" See Notes at the bottom to hear why. This other LED also strobes like the others.)
potentiometer (I like 100K...gives me good range)
7 LEDs ( I prefer blue but any bright LED will work.)
PIC Programmer (I used the old fashioned QuickWriter.)
...and most importantly the PIC12f675 Microprocessor!
Optional:
IC socket (this can double the height of your chip which may affect your LEDs positively or negatively.)
Three pin terminal block (female headers work too.)
| « Previous Step | Download PDFView All Steps | Next Step » |








































I would replace the pot with an UP and DOWN buttons.
A
The Source Code for it is:............................................................................................
; STROBOSCOPE 2011 07 04
; To compile cvasm16.exe strobosc.src
include '12f675.inc'
_BODEN_OFF EQU 3FBFh
_MCLRE_OFF EQU 3FDFh
_INTRC_OSC_NOCLKOUT EQU 3FFCh
_WDT_ON EQU 3FFFh
FUSES _BODEN_OFF
FUSES _MCLRE_OFF
FUSES _INTRC_OSC_NOCLKOUT
FUSES _WDT_ON
; Define some variables in the general purpose FILE
; register area.
STATUS EQU 0003H
GPIO EQU 0005H
ADCON0 EQU 001FH
CMCON EQU 0019H
OPTION_REG EQU 0081H
TRISIO EQU 0085H
WPU EQU 0095H
ANSEL EQU 009FH
CLOCK1 EQU 0021H; -- CLOCK ----
POTMSB EQU 0022H; AD CH 3
; ------ MAIN PROGRAM -------------
CALL INIT ; INITIALIZATION
STROBE
BSF GPIO,0 ; TURN ON LED
CALL DELAY100US ;
BCF GPIO,0 ; TURN OFF LED
CALL DELAY100US;
CALL DELAY100US;
CALL DELAY100US;
CALL GETPOTAD2
OFFLOOP
CALL DELAY100US;
CLRWDT ; REFRESH WATCHDOG TIMER
MOVF POTMSB,1 ; TEST IF POTMSB IS ZERO
BTFSC STATUS,2; TEST STATUS FOR ZERO
GOTO STROBE ; =ZERO, NOT TO DECREMENT
DECF POTMSB,1;
GOTO OFFLOOP ; 3 CLOCK CYCLES
GOTO STROBE
;------------------------------------------------------------------------
GETPOTAD2
MOV ADCON0,#00001001B ; LEFT JUSTIFIED, CH 2
BSF ADCON0,1 ; START AD CONVERSION
WAITPOTAD2
BTFSC ADCON0,1 ; DATA READY?
GOTO WAITPOTAD2 ;
MOV POTMSB,ADRESH ;
RET ;
;------------------------------------------------------------------------
;-------------------- INIT --------------------------
INIT
BCF STATUS,5
CLRF GPIO
MOVLW 00000111B ;
MOVWF CMCON ; DISABLED COMPARATOR
BSF STATUS,5 ; PAGE 2
CLRF ANSEL ; DIGITAL IO
MOVLW 00100010B ; weak pull up gp1, GP5
MOVWF WPU ;
MOVLW 00111100B ;
MOVWF ANSEL ; SET AN3, AN2 AS A/D + INTERNAL RC
MOVLW 00001000B ;
MOVWF OPTION_REG ;
MOV ADCON0,#00000000B ;LEFT JUSTIFIED, AD REF=VDD, START AD3 FIRST
MOVLW 00111110B ; GP0 AS OUTPUT, GP1,2,3,4,5 as input
MOVWF TRISIO ;
MOVLW 10000000B ; CENTER FREQUENCY
MOVWF OSCCAL ;
BCF STATUS,5
CLRF INTCON ;
CLRWDT ;
RET
;------------------- END INIT --------------------------
;-------------------DELAY100US-------------------------------------
DELAY100US
MOV CLOCK1, #36 ;
D100LOOP
DECFSZ CLOCK1,1 ;
GOTO D100LOOP ;
RET
;-------------- END DELAY100US ---------------------
STROBOSCOPEOBJECT.doc is:
:10000000182005142E2005102E202E202E20102022
:100010002E206400A20803190128A2030828012841
:1000200009309F009F149F1813281E08A200080083
:10003000831285010730990083169F0122309500B5
:100040003C309F000830810000309F003E3085002A
:100050008030900083128B01640008002430A100DE
:06006000A10B302808008E
:1042000000000000000000000000000000000000AE
:10421000000000000000000000000000000000009E
:10422000000000000000000000000000000000008E
:10423000000000000000000000000000000000007E
:10424000000000000000000000000000000000006E
:10425000000000000000000000000000000000005E
:10426000000000000000000000000000000000004E
:10427000000000000000000000000000000000003E
:10428000000000000000000000000000000000002E
:10429000000000000000000000000000000000001E
:1042A000000000000000000000000000000000000E
:1042B00000000000000000000000000000000000FE
:1042C00000000000000000000000000000000000EE
:1042D00000000000000000000000000000000000DE
:1042E00000000000000000000000000000000000CE
:1042F00000000000000000000000000000000000BE
:084000007F007F007F007F00BC
:02400E009C3FD5
:02FFFE00750686
:00000001FF