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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/28/04 09:49
Read: times


 
#76526 - RE: how to do calculations
Responding to: ???'s previous message
hi,

also, u used EQU in that software. this is not in the instruction set or do all assemblers use it no matter which chip the assembler is being used for?

EQU is the directive for the text preprocessor of compiler. For example,
REFRESH_DATA	EQU	0x40
Here it says: if you see anywhere in code the word "REFRESH_DATA" then just replace it with 0x40 immediately.

i calculated the way u said and but i got 490 machine cycles, not 1200

Oh, I recall that example beack to here and show you how:

; pre-processor directives; they do not add time
REFRESH_DATA	EQU	0x40
RSH_DAT		EQU	P1.0
RSH_CLK		EQU	P1.1
; ...

; refresh subroutine: here we start to calculate.
; I`ll comment line by letter and number of machine cycles of each command
RSH_MATRIX:
	MOV	R0,#REFRESH_DATA			; A - 1
RSH_NEXT_BYTE:
	MOV	A,@R0					; B - 1
	MOV	R7,#8					; C - 1
RSH_NEXT_BIT:
	CLR	RSH_CLK					; D - 1
	RRC	A					; E - 1
	MOV	RSH_DAT,C				; F - 2
	SETB	RSH_CLK					; G - 1
	DJNZ	R7,RSH_NEXT_BIT				; H - 2
	INC	R0					; I - 1
	CJNE	R0,#(REFRESH_DATA+20),RSH_NEXT_BYTE	; J - 2
	RET						; K - 2

Now we start our calculations.
First of all, let calculate loops.
- loop RSH_NEXT_BIT:
D...H = 7 machine cycles. And it repeats 8 times so it takes 56 cycles.
- loop RSH_NEXT_BYTE:
B...C + (D...H)*8 + I...J
2 + 56 + 3 = 61 cycles. It repeats 20 times (note REFRESH_DATA+20) so 61 * 20 = 1220 machine cycles.
Finally add state A and K: 1220 + 1 + 2 = 1223

Just only one note: in this example, the routine refreshes 160 columns (20*8). In your case this number is smaller.

Regards,
Oleg




List of 62 messages in thread
TopicAuthorDate
Need help with LED display            01/01/70 00:00      
   RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
         RE: Need help with LED display            01/01/70 00:00      
            RE: Need help with LED display            01/01/70 00:00      
               RE: Need help with LED display            01/01/70 00:00      
                  RE: Need help with LED display            01/01/70 00:00      
                     RE: Need help with LED display            01/01/70 00:00      
                        RE: Need help with LED display            01/01/70 00:00      
                           RE: scroll            01/01/70 00:00      
                           RE: Need help with LED display            01/01/70 00:00      
                              RE: Need help with LED display            01/01/70 00:00      
                                 RE: Need help with LED display            01/01/70 00:00      
                                 RE: Need help with LED display            01/01/70 00:00      
                                 READY FOR SCHEMATICS            01/01/70 00:00      
                                    RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                       RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                       RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                          RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                             RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                                RE: READY FOR SCHEMATICS            01/01/70 00:00      
                                                   construction of marix            01/01/70 00:00      
                                                      RE: construction of marix            01/01/70 00:00      
                                                      RE: construction of marix            01/01/70 00:00      
                                    No reason to shout!            01/01/70 00:00      
                              RE: Need help with LED display            01/01/70 00:00      
                                 RE: Need help with LED display            01/01/70 00:00      
                                    RE: Need help with LED display            01/01/70 00:00      
                                 RE: Need help with LED display            01/01/70 00:00      
                                    RE: Need help with LED display            01/01/70 00:00      
         RE: Need help with LED display            01/01/70 00:00      
   Multiplexing scheme            01/01/70 00:00      
      RE: Multiplexing scheme            01/01/70 00:00      
         RE: Multiplexing scheme            01/01/70 00:00      
            RE: Multiplexing scheme            01/01/70 00:00      
            RE: Multiplexing scheme            01/01/70 00:00      
               RE: Multiplexing scheme            01/01/70 00:00      
                  RE: Multiplexing scheme            01/01/70 00:00      
                     RE: Multiplexing scheme            01/01/70 00:00      
                        RE: Multiplexing scheme            01/01/70 00:00      
                           RE: Multiplexing scheme            01/01/70 00:00      
   RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
         RE: Need help with LED display            01/01/70 00:00      
            RE: Need help with LED display            01/01/70 00:00      
               RE: Need help with LED display            01/01/70 00:00      
               RE: Need help with LED display            01/01/70 00:00      
                  RE: Need help with LED display            01/01/70 00:00      
                     RE: 100Hz            01/01/70 00:00      
   RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
      RE: Need help with LED display            01/01/70 00:00      
         RE: Need help with LED display            01/01/70 00:00      
            RE: Need help with LED display            01/01/70 00:00      
      how to do calculations            01/01/70 00:00      
         RE: how to do calculations            01/01/70 00:00      
            RE: how to do calculations            01/01/70 00:00      
               RE: how to do calculations            01/01/70 00:00      
               RE: how to do calculations            01/01/70 00:00      

Back to Subject List