| ??? 12/18/03 19:37 Read: times |
#60988 - How can access SFR via lookup table? |
Hi,
here is just a question for interest. My program uses five PCA modules and has five software blocks which work at same way - they use different variables` locations but do exactly same things each at own PCA module. So to reduce code space I made only one subroutine which accepts DPTR as a pointer to the look-up table of one of those blocks. All things are good but... Due some reason each software block needs to manipulate with own PCA module control register which is in SFR space. Okay, at first attempt I just included its address into look-up table so my "universal" subroutine is able to do something like: MOV A,#MY_CCAPM_ADDR_DIMENSION MOVC A,@A+DPTRAnd now accumulator has the address of corresponded SFR, and... and what? I cannot access it directly anyhow! (= Okay, I set down and thought about. Then I produce the new code which works: MOV A,#MY_CCAPM_VECTOR MOVC A,@A+DPTR INC AUXR1 ; select another DPTR MOV DPTR,#CCAPM_MODIFY JMP @A+DPTR LABEL: INC AUXR1 ; restore base lookup pointer ; .....and CCAPM_MODIFY: XRL CCAPM0,#CONTROL_MASK LJMP LABEL XRL CCAPM1,#CONTROL_MASK LJMP LABEL XRL CCAPM2,#CONTROL_MASK LJMP LABEL XRL CCAPM3,#CONTROL_MASK LJMP LABEL XRL CCAPM4,#CONTROL_MASK LJMP LABEL Yes, you know, you know! (= I used 0,6,12,18 values at DPTR+MY_CCAPM_VECTOR... Now the question: all works good but I do not like such way - it looks not aesthetically (= Any suggestions? Fresh ideas? Thank you! |
| Topic | Author | Date |
| How can access SFR via lookup table? | 01/01/70 00:00 | |
| RE: How can access SFR via lookup table? | 01/01/70 00:00 | |
| RE: How can access SFR via lookup table? | 01/01/70 00:00 | |
| RE: How can access SFR via lookup table? | 01/01/70 00:00 | |
| RE: How can access SFR via lookup table? | 01/01/70 00:00 | |
| macros indeed! | 01/01/70 00:00 | |
| RE: macros indeed! | 01/01/70 00:00 | |
| RE: macros indeed! | 01/01/70 00:00 | |
| RE: How can access SFR via lookup table? | 01/01/70 00:00 | |
| Eureka | 01/01/70 00:00 | |
| RE: Eureka | 01/01/70 00:00 | |
RE: Eureka | 01/01/70 00:00 |



