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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/17/05 14:56
Modified:
  02/17/05 14:59

Read: times


 
#87787 - AD8802 DAC AND ADUC812 CODE QUESTION
Hi all. I need help on the following code. This was taken off the data sheet for the ad8802 12 ch. dac. I want to send the data from a pc to control the 12 ch. I have the hardware wired.
to the 812 parallel port2. the timing looks ok. I don't know where to read the serial port and write the byte to memory.the way it is now i can force the address but can't seem to change the value. The 88802 needs 12 bits. 4 for the address and 8 for the value. can any one help. thanks ron.
______________________________________________________________
;....DAC.ASM...COMPILER ISMETALINK 8051 CROSS ASSEMBLER
$MOD812


PORT2 DATA 0AH ;SFR REGISTER FOR PORT2
DAC_VALUE DATA 40H ;DAC VALUE
DAC_ADDR DATA 42H ;DAC ADDRESS (0-7)
LOOPCOUNT DATA 44H ;COUNT LOOPS
LED EQU P3.4 ;IS LED


JMP LD_8802
;............................................................
CSEG
ORG 0003h ; (INT0 ISR)
;...........................................................



ORG 100H ;ARBITRAY START

LD_8802:
; 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


;...IS THIS THE RIGHT PLACE FOR THIS?.....................
JNB RI,$ ; Recive serial data
MOV 40H,SBUF ; Store data in IN MEMORY

JNB RI,$ ; Recive serial data
MOV 42H,SBUF ; Store data in IN MEMORY
;.........................................................

ORL P2,#11110000B ;SET CLK,CS,SHDN HIGH
CLR P2.5 ;SET CHIP SELECT LOW
MOV LOOPCOUNT,#4 ;ADDRESS IS 4 BITS
MOV A,DAC_ADDR ;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,DAC_VALUE
ACALL SEND_SERIAL ;SEND THE DATA
SETB P2.5 ;SET CS HIGH


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



List of 5 messages in thread
TopicAuthorDate
AD8802 DAC AND ADUC812 CODE QUESTION            01/01/70 00:00      
   pre            01/01/70 00:00      
      I don't understand your responce            01/01/70 00:00      
         Understanding Steve's response            01/01/70 00:00      
      Yes, But            01/01/70 00:00      

Back to Subject List