Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

code not work

Status
Not open for further replies.

savnik

Member
I have the code below but isn't work
Code:
	LIST	p=16F84A		;tell assembler what chip we are using
	include "P16F84A.inc"		;include the defaults for the chip


						
count1  equ     0C      	; wait counter ls digit file register C
count2  equ	0D		; wait counter ms digit file register D

	org     0		; origin

 
	bsf	STATUS,RP0
	movlw   b'00000000'
	movwf   TRISA           ; set porta as outputs
	bcf	STATUS,RP0
	movlw   b'00000000'
	movwf   PORTA           ; set porta levels all low	

        bsf	PORTA,0         ; set porta bit 0 high
        	
rot_L	call 	wait		; wait for a bit
	bcf	STATUS,C	; clear carry bit
	rlf	PORTA,F		; rotate left porta, store result porta
	btfss	PORTA,4		; skip next line if top bit set
	goto	rot_L

rot_R	call 	wait		; wait for a bit
	bcf	STATUS,C	; clear carry bit
	rrf	PORTA,F		; rotate right porta, store in porta
	btfss	PORTA,0		; skip next line if bottom bit set
	goto	rot_R
	goto 	rot_L		; do it all again	

wait    
	movlw   d'250'	        ; load count1 with decimal 250
	movwf   count1	
	
d1	movlw   d'100'		; load count2 with decimal 100
	movwf   count2					
	
d2	decfsz  count2,F	; decrement and skip next line if zero
	goto 	d2		; if not zero		
	decfsz  count1,F	; decrement count1 if count2 is zero
	goto 	d1		; do inside loop again if count2 nz
	retlw 	0
      
	END
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top