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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/20/05 03:10
Read: times


 
#87994 - Not Sure
Responding to: ???'s previous message
Full Program ASM is not my strong point. I am not sure what is wrong. It is only suppose to be initilized once.
But I would put all the intterupts up fron with RETI to be safe.

Did you have this?
;................................................
;NEW CODE WITHOUT CHKSUM
;2/19/05
;ADCU812 AND AD8802 12 CH DAC.
;................................................

$MOD812
		LOOPCOUNT	DATA	44H             ;COUNT LOOPS
		LED		EQU	P3.4		;IS LED
		FLAG	BIT	00H			; define Flag variable


CSEG					; Defines the following as a segment of code

ORG     0000H				; Load Code at '00H'

JMP	MAIN   ; main not mainloop

;======================================================================

ORG 0003h
	      	  
	      	                                                                        ; FOR TEST ONLY
		  INC	R2             		; Increment DAC VALUE
              		  RETI				; Return from Interrupt
;====================================================================

; trap all the other ints here



MAIN:

 ; configure the UART ADuC812

	 	MOV     SCON,#52h  ; configure UART for 9600baud..
		MOV     TMOD,#20h  ; ..assuming 11.0592MHz crystal
    		MOV     TH1,#-3
    		SETB    TR1       	; ok this works
        	    	SETB	IT0			; INT0 edge triggered
		SETB	EA			; enable inturrupts
		SETB	EX0			; enable INT0
                                               				 ; OK CAN INTR.
	        	CLR	FLAG			; Clear Bit defined as FLAG
                               

MAINLOOP:
;... THIS THE RIGHT PLACE FOR THIS.....................

        		JNB     RI,$        	; Recive serial data
       		MOV     R0,SBUF     ; Store data in R0 AS ADDR
       		CLR     RI

        		JNB     RI,$        	; Recive serial data
       	 	MOV     R1,SBUF     ; Store data in R1 AS VALUE
       		CLR     RI
;.........................................................

;Do Check SUM
		  ; AJMP MAINLOOP  ; Start over if bad

;CSUM GOOD
; move address and data into R0,R1
   		ACALL LD_8802
; repeat for all DACs

               			 JMP	MAINLOOP
LD_8802:

		ORL	P2,#11110000B 	;SET CLK,CS,SHDN HIGH
		CLR	P2.5		;SET CHIP SELECT LOW
		MOV	LOOPCOUNT,#4	;ADDRESS IS 4 BITS
		MOV	A,R0	        ;GET DAC ADDRESS
		RR	A		;ROTATE THE DAC
		RR	A		;ADDRESS TO MOST
		RR	A		;SIGNIFCANT BIT (MSB)
		RR	A
		ACALL	SEND_SERIAL	;SEND THE ADDRESS
		MOV	LOOPCOUNT,#8	;DO 8 BIT OF DATA
		MOV	A,R1
		ACALL	SEND_SERIAL	;SEND THE DATA
		SETB	P2.5		;SET CS HIGH
             		RET			;DONE


SEND_SERIAL:	RLC	A	;MOVE NEXT BIT TO CARRY
                		CPL	LED	;BLINK LED
              	                  MOV	P2.7,C	;MOVE DATA TO SDI
                		CLR 	P2.6	;PULSE THE
              	                  SETB	P2.6	;CLK INPUT
               		DJNZ	LOOPCOUNT,SEND_SERIAL    ;LOOP IF NOT DONE
               		RET				   ;DONE
                		END
; still need to fix the /pre here should be < / p r e >





List of 12 messages in thread
TopicAuthorDate
ADcu812 question fixed (: now can......            01/01/70 00:00      
   OK            01/01/70 00:00      
      thank you neil..but?            01/01/70 00:00      
         Checksum            01/01/70 00:00      
         Your Origional code            01/01/70 00:00      
   Try as i might......now it does not work            01/01/70 00:00      
      OK            01/01/70 00:00      
         answer to neil            01/01/70 00:00      
            OK            01/01/70 00:00      
   What do you know it's working but one...            01/01/70 00:00      
      Not Sure            01/01/70 00:00      
         THANK YOU NEIL            01/01/70 00:00      

Back to Subject List