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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/05/12 15:26
Read: times


 
#185320 - Ok back to the task at hand
Responding to: ???'s previous message
OK I’m using ASM51 cross assembler from metalink and writing code for a control problem.

For my task I must use I2C to send control bytes to two different addresses. I have no problem with doing this but where it gets tricky is that I have to break up these two bytes into 2 bit sections to control individual dual input multiplexors.
So for each of the 8 multiplexors I have 4 outputs each of which can be selected to switch on one at a time using my 2 bit input.
My first attempt at this resulted in me being only able to control two multiplexors at a time, one for address 1 and the other in address 2.
The problem was that when I built my control byte I used the 2 bit mux input and then shifted it to the mux position where I wanted to make my change so it looked like -> 00000011 and then shifted -> 00110000
So this way if my previous message looked like -> 00001100, I lose my original setting.

What I really need is to be able to update my message with the two new bits that are needed.

Is it possible to set up the code so I can change only 2 bits of a byte at a time


Here is what I was thinking of doing

********************************************************
MESSAGE	DATA	0x50		; byte containing previous message
MUX_BIT_NO	DATA	0x51		; byte containing the position of the first bit to be changed

BIT_1		BIT	0x08		; first of 2 bit change
BIT_2		BIT	BIT_1+1	; second of 2 bit change
-----------------------------------------------------------------------------------------
MOV	A, MESSAGE			; reload the old message into ACC
MOV	A.MUX_BIT_NO, BIT_1		; change first bit
MOV	A.MUX_BIT_NO+1, BIT_2	; change second bit
MOV MESSAGE, A			; save new message
RET
----------------------------------------------------------------------------------------
END
*******************************************************

Let me know if you think that this might work, or if there is an easier way to solve the problem

 



List of 40 messages in thread
TopicAuthorDate
Assembly coding micro-converters            01/01/70 00:00      
   Code indented            01/01/70 00:00      
      Assemblers often have different syntax            01/01/70 00:00      
         Assembler            01/01/70 00:00      
            Why not use Keil A51 ?            01/01/70 00:00      
               why assembler?            01/01/70 00:00      
                  Libraries?!?!?            01/01/70 00:00      
                     Libraries good, but not always best            01/01/70 00:00      
                        Ok back to Data and Bit            01/01/70 00:00      
                           Manual            01/01/70 00:00      
                           ok back            01/01/70 00:00      
                              I C            01/01/70 00:00      
               Keil A51            01/01/70 00:00      
                  junk downloaders            01/01/70 00:00      
                  take a look at ASEM51            01/01/70 00:00      
                     asem-51 macros            01/01/70 00:00      
                        You don't have to use 'em            01/01/70 00:00      
                  re-think about tools            01/01/70 00:00      
                     ADuC842            01/01/70 00:00      
                        learn            01/01/70 00:00      
                           There are PLENTY of debuggers ...            01/01/70 00:00      
                              Documentation            01/01/70 00:00      
                                 interrupt vectors            01/01/70 00:00      
                                 Memo to Reinhard Keil            01/01/70 00:00      
                                 Keil docs are not bad.            01/01/70 00:00      
                                 Well ... Last time I had questions about ASEM51 ...            01/01/70 00:00      
                                    the good and the bad            01/01/70 00:00      
                                       Well, I must have mistyped            01/01/70 00:00      
                                          asem/asm            01/01/70 00:00      
                                          linker support?            01/01/70 00:00      
                                             it's provided by ASEM-51, I suppose            01/01/70 00:00      
   Ok back to the task at hand            01/01/70 00:00      
      make it easy for yourself            01/01/70 00:00      
         I’m afraid the hard ware is non negotiable            01/01/70 00:00      
            well, ....            01/01/70 00:00      
               Dinosours, I2Cs, Gang-bang???            01/01/70 00:00      
                  1st            01/01/70 00:00      
                     Simple approach            01/01/70 00:00      
                        yes            01/01/70 00:00      
                           For Free :-)            01/01/70 00:00      

Back to Subject List