CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

assembler issue with "ANDLW" PIC16F886

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
julien lochen



Joined: 16 May 2008
Posts: 14

View user's profile Send private message

assembler issue with "ANDLW" PIC16F886
PostPosted: Tue May 27, 2008 10:03 am     Reply with quote

Hello,

Is it correct to use a temp variable as parameter with "ANDLW" ?

My code is:

///////////////
variables UDATA 0x30 ;varibales data stored at locations starting at 0x30.
temp_1 RES 1 ; temp_1 stored at 0x31
temp_2 RES 1 ; temp_1 stored at 0x32
temp_3 RES 1 ; temp_1 stored at 0x33
temp_4 RES 1 ; temp_1 stored at 0x34
temp_5 RES 1 ; temp_1 stored at 0x35
temp_6 RES 1 ; temp_1 stored at 0x36
temp_7 RES 1 ; temp_1 stored at 0x37
temp_8 RES 1 ; temp_1 stored at 0x38

...

CLRW ;W <- 0x00
banksel PORTA
MOVF PORTA,0 ;W <- PORTA
banksel temp_8
MOVWF temp_8 ;temp_8 <- W (= D7_D6_D5_D4_D3_D2_D1_D0)
RLF temp_8,1 ;temp_8 <- d6_d5_d4_d3_d2_d1_d0_c, c=d7
RLF temp_8,1 ;temp_8 <- d5_d4_d3_d2_d1_d0_c_d7, c=d6
MOVLW 0x80 ; W <- x80
ANDLW temp_8 ; W[7:0] <- (temp_8[7:0] & W[7:0]) => W[7:0]= d5_0_0_0_0_0_0_0_0
banksel PORTC
IORWF PORTC,1 ;PORTC[7:0] <- (PORTC[7:0] | W[7:0]) => PORTC[7:0] = d5_x_x_x_x_x_x_x
banksel TRISC
MOVLW 0x00
MOVWF TRISC
///////////////////////

temp_8's value is xBD and W's value is x80 but after the execution of "ANDLW temp_8" I have temp_8 = x00, I was expecting temp_8 = x80

thanks, julien lochen
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 27, 2008 11:39 am     Reply with quote

Please ask questions about MPASM on the Microchip forum:
http://forum.microchip.com/tt.aspx?forumid=16
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group