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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/05/01 16:00
Read: times


 
#9756 - RE: 8052 subroutines
The following is the troublesome portion of my code, I realise it isn't very good as it is my first program and is not yet complete!!! I plan on interfacing the code with LabVIEW

Thanks, Siobhan

$MOD52

CLOCK EQU P3.0
ENABLE EQU P3.1
CLEAR EQU P3.6
;____________________________________

CSEG
ORG 0000h

CLR CLEAR


;the following values will come from the LabVIEW via the serial port
MOV R0,#080h ;represents 10000000
MOV R1,#040h ;represents 01000000
MOV R2,#020h ;represents 00100000
MOV R3,#010h ;represents 00010000
MOV R4,#08h ;represents 00001000
MOV R5,#04h ;represents 00000100
MOV R6,#02h ;represents 00000010
MOV R7,#01h ;represents 00000001


CLR CLOCK


MOV A,R0 ;places the value in R0 into the accumulator

CALL LOAD

CLR ENABLE

CALL BEAMDELAY ;this is the delay which will be (hopefully)
;specified by user in LabVIEW.
;(will use serial port SFRs for this)
SETB ENABLE
CLR CLOCK



;_______________________________________
LOAD:
PUSH ACC

MOV P2,A

CALL DELAY ;one P2.2 high need to call delay so clock/whatever
;pin has time to go to logic high

SETB CLOCK

CALL DELAY ;instead of this delay may use a special Clock Delay as in Clock1.asm

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY

SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

RL A

CLR CLOCK

MOV P2,A

CALL DELAY
SETB CLOCK

CALL DELAY

POP ACC
RET
;_______________________________________


DELAY:

PUSH ACC
MOV 0Ah,#01
DLY1: MOV 0Bh,#23 DJNZ 0Bh,$
DJNZ 0Ah,DLY1
POP ACC
RET

;_______________________________________

END

List of 7 messages in thread
TopicAuthorDate
8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      
RE: 8052 subroutines            01/01/70 00:00      

Back to Subject List