Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] equ in MPLAB assembly

Status
Not open for further replies.

vishy71

Full Member level 2
Full Member level 2
Joined
Dec 16, 2010
Messages
126
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Iran
Activity points
2,296
Hi
I wanna discribe RB0 as a bit register!for example we can write this code in BASIC:

x0 var portb.0

so x0=RB0! and then we can use this bit like as this:
x0=0
or
0x=1

but in Assembly how we can do this?
thanks

---------- Post added at 12:19 ---------- Previous post was at 11:01 ----------

Hi

this is my purpose:

movlw 0xfe
movwf tmp

now: if tmp.0=1 then RB0=1,delay,RB0=0,return else RB0=0,delay,return
if tmp.1=1 then RB0=1,delay,RB0=0,return else RB0=0,delay,return
....

thanks
 

Hi,

This might be what you want -

Code:
		movlw	0xfe
		movwf	temp

		movf	temp,w
		btfss	STATUS,Z
		goto	notZero
isZero	bsf	PORTB,0
		call	Delay
		; etc

notZero	bcf		PORTB,0
		call	Delay
		;etc
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Code:
; if tmp.0=1 then RB0=1,delay,RB0=0,return else RB0=0,delay,return

                                btfsc         tmp,0
                                bsf           portb,0
                                btfss         tmp,0
                                bcf           portb,0
                                call           delay
                                bcf           portb,0
                                return

; if tmp.1=1 then RB0=1,delay,RB0=0,return else RB0=0,delay,return

                                btfsc         tmp,1
                                bsf           portb,0
                                btfss         tmp,1
                                bcf           portb,0
                                call           delay
                                bcf           portb,0
                                return
That is it !.

Hope its clear.
 
Last edited:
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
wow!thanks to all! and special thanks for wp100 because of his helps!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top