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

Back to Subject List

Thread Closed: Issue successfully resolved

???
08/05/04 14:02
Read: times


 
Msg Score: +1
 +1 Good Question
#75471 - Memory mapped I/O hassle
I am in the process of developing code in assemblly for a full machine control. It has 31 digital inputs and 12 digital outputs. Added to this I have a VFD , 2 thumbwheel switches, and have to use the UART. ( 89c51rd2). So will have to resort to memory mapped I/O scheme. The hardware is over and things are fine upto this stage. OK so where is the problem?

Problem is in addressing the outputs. I would very much like to use a direct control like "SETB Px.0" or "CLR Px.0". However in the memory mapped scheme doing such a bit control involves lots of circus with boolean arithmetic as I HAVE TO update 8 bits ( 1 byte ) at a time.

Let me explain : Assume IOBYTE_1 consists of :

10HPMOTOR equ IOBYTE_1.0
SOL_LOAD equ IOBYTE_1.1
....
....
SOL_REV equ IOBYTE_1.7

Thus if I first switch on 10HPMOTOR with the value 01H and then if I switch on SOL_REV, I should output value 81H as I have to keep the motor also ON. Tell you what - this very soon multiplies to a huge number of combinations.

I am using ASEM_51 assembler and I thought I will cheat it as below :
===============

DSEG AT 20H

IOBYTE_1:    DS   1


BSEG AT 20H

10HPMOTOR:   DBIT  1
SOL_LOAD:    DBIT  1
....
....
SOL_REV:     DBIT  1

=================

After the above I just use " SETB 10HPMOTOR " and then call the output routine to write the value of IOBYTE_1.

The assembler creates the hex file with no errors. But the logic fails :-(

Any ideas ? ( Other than coding in C, changing assembler etc)

Thanks folks.

Raghu





List of 17 messages in thread
TopicAuthorDate
Memory mapped I/O hassle            01/01/70 00:00      
   RE: Memory mapped I/O hassle            01/01/70 00:00      
      Problem defenition - Erik            01/01/70 00:00      
   RE: Memory mapped I/O hassle            01/01/70 00:00      
      Automatic up I/O update - Russell            01/01/70 00:00      
   RE: Memory mapped I/O hassle            01/01/70 00:00      
      RE: Memory mapped I/O hassle            01/01/70 00:00      
         RE: Memory mapped I/O hassle            01/01/70 00:00      
            RE: Memory mapped I/O hassle            01/01/70 00:00      
               RE: Memory mapped I/O hassle            01/01/70 00:00      
            Syntax - Anders, Rob, Charles            01/01/70 00:00      
               RE: Syntax - Anders, Rob, Charles            01/01/70 00:00      
                  Problem solved - Russell            01/01/70 00:00      
               RE: Syntax - Anders, Rob, Charles            01/01/70 00:00      
                  RE: Syntax - Anders, Rob, Charles            01/01/70 00:00      
   RE: Memory mapped I/O hassle            01/01/70 00:00      
      Thread can close happily            01/01/70 00:00      

Back to Subject List