Kenny Baby wrote: > > I am trying to write a bcd down counter. If i have a hex value of > 0x81 and then decrement the file with 'decf file,f' the new value > will be 0x80, if i dec again i will get 0x7f. I thought that the dc > flag would be set when going from 0x80 to 0x7f. It doe's'nt appear to > in mpasm using a pic18c84. Is'nt the dc flag a carry/borrow. whis is > set when going up from 0x0f-0x10 and down from 0x80-0x7f. The data > sheets say the the dc flag is effected by 'decf file' inst. The incf and decf instructions affect Z only. If you want a digit carry bit (DC) on an increment or decrement, you have to add or substract the literal value one. Remember the DC bit is reversed when used as a borrow flag. -- Friendly Regards Tjaart van der Walt mailto:tjaart@wasp.co.za ________________________________________________________ | WASP International http://wasp.co.za | | R&D Engineer : GSM peripheral services development | |Vehicle tracking | Telemetry systems | GSM data transfer| |Voice : +27-(0)11-622-8686 | Fax : +27-(0)11-622-8973 | | WGS-84 : 26010.52'S 28006.19'E | |________________________________________________________|