Temporizator pt. stergatoare


Schema electrica


Codul in assembler pt. pic12f508:

   ;===== Timer ======13/07/06==
;	internal clock
;	standard RC osc 4.000 MHz  - 1us pe instructiune
;	Program realizat de Ing. Bergthaller Iulian-Alexandru 
;------------------------------------------------------------
	list p=12f508 ;controller
	#include 
	__CONFIG        _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
	radix   dec
    	errorlevel  -302            ; suppress message 302 from list file
;------------------------------------------------------------
;       cpu init
	cblock 0x07	; Beginn General Purpose-Register
	contor
	count1	
	count2	
	count3
	count4	
	transo
	wdh
;--------------------------
	endc
#DEFINE reload	GPIO,5
#DEFINE pump	GPIO,4
#DEFINE motor	GPIO,0
#DEFINE beep	GPIO,1
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
	org	0x00
init	movwf	OSCCAL	; 4-MHz-Kalibrierung
	bcf	STATUS,PA0	; Bank 0 
	clrf	GPIO		; aus!
	bsf	STATUS,PA0	; Bank 1 
	movlw	0xF8
	TRIS	GPIO
	bcf	STATUS,PA0	; Bank 0 
	movlw	0x06
	movwf	transo

;***************************************************
	call	buzz
	call	haltb
	call	buzz
	call	haltb
	call	buzz
	call	haltb
;***************************************************
;* Lcd data subroutine                             *
;***************************************************	

scan	call	haltb
	btfsc	reload
	goto	scan
	call	action
	movf	transo,W
	movwf	count4
	call	halta
	goto	scan
;*****************************************
action
	bsf	motor
	call	haltb
	bcf	motor	
 	retlw	0x00
;*****************************************
;***************************************************
buzz	movlw	0xFA
	movwf	contor
b1	movlw	0x1A	  ;2A 20
	movwf	wdh
b2	nop
	decfsz	wdh,F	
	goto 	b2
	bsf	beep
	movlw	0x1A	  
	movwf	wdh
b3	nop
	decfsz	wdh,F	
	goto 	b3
	bcf	beep
	decfsz	contor,F	
	goto 	b1		
	retlw	0x00

;***************************************************
haltc	
	movlw	0xFA
	movwf	contor
h1	movlw	0xFA	  
	movwf	wdh
h2	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	decfsz	wdh,F	
	goto 	h2		
	decfsz	contor,F	
	goto 	h1		
	retlw	0x00
;***************************************************
haltb	movlw	0xFA
	movwf	contor
j1	movlw	0xFA	  
	movwf	wdh
j2	nop
	decfsz	wdh,F	
	goto 	j2		
	decfsz	contor,F	
	goto 	j1		
	retlw	0x00
;***************************************************
halta	
r4	movlw	0x04
	movwf	count3
r3	movlw	0xFA
	movwf	count1
r1	movlw	0xFA	  
	movwf	count2
r2	nop
	decfsz	count2,F	
	goto 	r2
	btfss	pump
	goto	r5
	call	buzz
	call	haltb
	decfsz	transo,F	; daca transo pozitiv atunci r5 altfel=1
	goto	r5
	movlw	0x01
	movwf	transo
	call	buzz
	call	haltc	
r5	decfsz	count1,F	
	goto 	r1		
	decfsz	count3,F    
	goto	r3 
	decfsz	count4,F    
	goto	r4 
	retlw	0x00
;------------------------------------------------------------
	org	0x1FF	; use the read value from chip
	movlw	0x1E	;
;------------------------------------------------------------
	end
;============================================================


Back to my home page

Last updated October, 2006

© Copyright 2006 Bergthaller Iulian-Alexandru
Make your own free website on Tripod.com