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 19:20
Read: times


 
#87828 - ADcu812 question fixed (: now can......
Ok, thankyou for the lesson in pre post html....now can any one answer the question. in the (pre-post) code below which was taken from the AD8802 data sheet, where do I need to put the recive sbuf statement and am I writing it correctly to memory? I have it wired to the 812 port2 pin and see data on the scope, but unable to change the dac's value. the dac needs to see 12 bits. 4 for address and 8 for value. I think the pc pgm will send it as two 8 bit words but I may be wrong about that to.
the chips are ADcu812 and AD8802
the code in PRE html... thank you. ron.
<pre>
;....DAC.ASM...COMPILER IS METALINK 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

<pre>

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