One of my favorite compromise parity checkers was originally implemented in hardware and published in electronics design. In the original the ac was declared as an accumulator it can be replaced as a local variable. If you use this any public way credit the sources. It is a clever algorithm w.. int parity(char ch) { /* Implemented in C Based on the original hardware implementation in Electronics design. Walter Banks Byte Craft Limited September 1991 Electonics Design Aug 22, 1991 Noor Singh Khalsa EG&G P.O Box 809, MS E-1, Los Alamos, NM 87544 (505) 667-0200 */ ch = (ch >> 1) ^ ch ; return (((ac = (((ch >> 2) ^ ch)) & 0x11) == 0) ? 1 : ((ac ^ 0x11) == 0) ); if ((ch = (((ch >> 2) ^ ch)) & 0x11) == 0) return 1; if ((ch ^ 0x11) == 0) return 1; return 0; } Brian Millward wrote: > I am fairly new to PIC programming and I am building a radio clock to decode > Rugby MSF transmissions. > > > > It all works, but I have not done any parity checking. > > > > I have some BCD variables and a checksum bit and I need to check that all > the bits add up to an odd number. > > > > I have thought of checking the lsb, then shifting right and repeating etc, > adding all the bits together, but I am sure that there is an easier way I > just cannot think of it > > > > Apologies for seeming to be a bit dense, but I am trying to master it. > > > > By the way, I am using CCS 'C' compiler. > > > > Thanks for any help you may be able to give. > > > > Regards ... Brian > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist