Andre, My apologies, I should have been a little more clear. When I said W=32 I was thinking, but not writing, packed BCD 32, or 0x32. I'm not really sure how that should be written. However, the status bits DC and C should both be set to '1' before the DAW in order to simulate the results an addition (ADDWFC or similar) of two packed BCD numbers, 99.+ 99 in this case. BTW I heard from Microchip already, not much but they said they will look into it. Not sure what that means but it's a start. Mike Jones ----- Original Message ----- From: "Andre Abelian" To: Sent: Tuesday, February 04, 2003 3:59 PM Subject: Re: [PIC]: DAW how it works (BCD) > Mike, > > If Wreg = d'32' that is 0x20 > After DAW every thing remains the same d'32' and C=0 DC=0 > The only time DC will be 1 when goes over d'15' and > C will be 1 if your number goes over 99. > > 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 > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body