PIC code

Status
Not open for further replies.
Is there any problem with my PIC code?

1. you may better put the .asm file it would be better.

2. you may have to code the ORG and reset vector
3. Generally it is better to get the habit of leaving meaning full comments for every line, as it would help you in future as you write bigger and many more programs, and blind codes without comments cause confusion while debuggingg and adoppting patches in future programs tomorrow .

I am also a learner at this very stage so I wanted to share my thoughts
 
Your code looks fine except for the goto delay rather than call delay,
Code:
OUT_IN
		movlw	b'00000010'	
		movwf	PORTA
		[COLOR="Blue"]call[/COLOR]	delay
		clrf	PORTA
Loop1		movf	TMP,0
		sublw	00h
		btfsc	STATUS,2
		goto 	main
		goto	Loop1

OUT_OUT
		movlw	b'00000001'	
		movwf	PORTA
		[COLOR="blue"]call[/COLOR] 	delay
		clrf	PORTA
Loop2		movf	TMP,0
		sublw	01h
		btfsc	STATUS,2
		goto 	main
		goto	Loop2

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…