??? 02/18/05 16:17 Read: times |
#87890 - Try as i might......now it does not work Responding to: ???'s previous message |
first thanks every one who is helping...now with the code i got from neil, and looking at the sdi pin on the scope i only get one data xfer. the pgm is not looping until i reset then only one xfer. why. the code is saying to jump to main but i don't think it is. not to mention i still don't know how to write the check check sum code. ron.
<pre> ;................................................ ;NEW CODE FROM NEIL WITH CHKSUM ;2/19/05 ;................................................ $MOD812 LOOPCOUNT DATA 44H ;COUNT LOOPS LED EQU P3.4 ;IS LED ; 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 MAINLOOP: ;... THIS THE RIGHT PLACE FOR THIS?..................... JNB RI,$ ; Recive serial data MOV R0,SBUF ; Store data in IN MEMORY JNB RI,$ ; Recive serial data MOV R1,SBUF ; Store data in IN MEMORY ;......................................................... ;Do Check SUM.....IF CHKSUM IS #FFH...??? ; R0 = #FFH <????? ; AJMP MAINLOOP ; Start over if bad ;CSUM GOOD ; move address and data into R0,R1 ACALL LD_8802; ; repeat for all DACs AJMP MAINLOOP ; Start over 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 <pre/> |
Topic | Author | Date |
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 |