Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/13/02 04:35
Read: times


 
#20769 - RE: 16 bit shift left
I'm sorry. After 25 years in the software business (but using only high level languages) you would think I would know you can't simplifiy a programming problem into a couple of sentences.
I have 16 switches. Using a encoder/debouncer I get a BCD value of which of the 16 buttons was pressed. This only takes 4 lines of my I/O which is good. HOWEVER, I need (for other reasons) to determine which button was pressed via a bit flag in memory. So if, for example, button 7 was pressed I do NOT want 0000 0000 0000 0111 in memory. To the rest of the code this would indicate that buttons 1 2 and 3 were pressed. So I wanted to take the BCD value (7 in this example) and use it as my loop counter to shift left 7 times which would give me 0000 0000 0100 0000. Of course I would initialize the memory location with 0000 0000 0000 0001 before the loop routine was called. I had hoped I could use the DPTR register but seems there is no shift left opcode with that particular one.

Am I making things hard?

Thanks for all your help so far.

List of 16 messages in thread
TopicAuthorDate
16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
But why not the carry bit?            01/01/70 00:00      
RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      

Back to Subject List