Jan 21, 2011 #1 vishy71 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 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
Jan 21, 2011 #2 W wp100 Advanced Member level 6 Joined May 15, 2009 Messages 3,051 Helped 884 Reputation 1,783 Reaction score 733 Trophy points 113 Location Prime Meridian Activity points 0 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
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
Jan 21, 2011 #3 PaulHolland Advanced Member level 2 Joined Jan 15, 2003 Messages 661 Helped 95 Reputation 190 Reaction score 34 Trophy points 1,308 Location Holland Activity points 4,852 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: Jan 21, 2011
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.
Jan 21, 2011 #4 vishy71 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 wow!thanks to all! and special thanks for wp100 because of his helps!