Re: Cycle around a sequence

2012-02-07 Thread Christoph Hansen
Mark Lawrence schrieb: I'm looking at a way of cycling around a sequence i.e. starting at some given location in the middle of a sequence and running to the end before coming back to the beginning and running to the start place. About the best I could come up with is the following, any better id

Re: problem with bcd and a number

2011-08-04 Thread Christoph Hansen
MRAB schrieb: The value is MSB * 100 + (LSB>> 4) * 10 + (LSB& 0xF) i would say (MSB >> 4)*100 + (MSB & 0xF)*10 + (LSB >> 4) but who knows -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with bcd and a number

2011-08-04 Thread Christoph Hansen
nephish schrieb: thanks for any tips on this. I'll try. In BCD a (decimal) digit is stored in a halfbyte (or a 'nibble'). So, in a byte you can store two decimal digits. For instance 42 would be nibble1 nibble2 0100 0010 42 >>> c=0b0110 >>> c 66 >>> c >> 4