Mike, 99+99=198 in decimal if Wreg=198 after DEW your Wreg is 98 C=1 DC=0 Andre Abelian -----Original Message----- Thanks for setting that up and testing, it's appreciated. I don't know how hard it is to set up but you might try the following; DC= 1 C = 1 W = 32 (This would be the result of adding 99 + 99) Then execute the 'DAW The result should be (according to Microchip for the 18F series) DC= 1 C = 0 W= 98 Using a 18F452, I arrived at the results (as above) that Microchip said you should get. I found a question nearly identical to mine in the Microchip Developers conference and their answer was as above. I still don't know why but I asked. Maybe I'll get a response in a day or two. http://asp.microchip.com/webboard/wbpx.dll/~devtools Search for DAW Thanks again Mike Jones ----- Original Message ----- From: "Andre Abelian" To: Sent: Tuesday, February 04, 2003 2:46 PM Subject: [PIC]: DAW how it works (BCD) > Hi to all, > > I did some test using DAW instruction on MPLAB ICE2000 > and this is the result. > > Movlw 0x0F ; w reg has d=15: B=00001111 > DAW ; do decimal adjustments > Movwf BCD_REG ; BCD_REG has d=21 b=00010101 C=0 > > > Second digit (F) 05 > First digit (0) + 01 > Result 015 ; 0 means C=0: 1 is bits 4,5,6,7 and > 5 is bits > 0,1,2,3 > > > Now lets deal with higher numbers > > Movlw 0xEF ; w reg has d=239: b=11101111 > DAW ; do decimal adjustments > Movwf BCD_REG ; BCD_REG has d=85 h=55 b=10101010 > > > Second digit (F) 15 ; decimal > First digit (E) + 14 ; decimal > Result 155 ; 1 means C=1: 5 is bis 4,5,6,7 and > 5 is bits > 0,1,2,3 > > > Andre Abelian > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body