??? 06/09/06 10:37 Read: times |
#118089 - Reading tips and routine Responding to: ???'s previous message |
Dear Russell Bull
Can you give me some tip how do i check the data is writing to cs5460a and reading from The following the routine for read and write to cs5460a void write_to_register(char command,char low,char mid,char high) { transfer_byte(command); transfer_byte(high); transfer_byte(mid); transfer_byte(low); } void read_register(char command) { transfer_byte(command); high_byte = receive_byte(); /*Receive Bytes*/ mid_byte = receive_byte(); low_byte = receive_byte(); } NAME TRANSFER_BYTE ?PR?_transfer_byte?TRANSFER_BYTE SEGMENT CODE PUBLIC _transfer_byte RSEG ?PR?_transfer_byte?TRANSFER_BYTE _transfer_byte: USING 0 MOV A, R7 ; Move byte to be transmitted to ACC MOV R1,#08 ; Set count to 8 to transmit byte CLR P1.1 ; Clear SCLK( old data P1.3) loop: ; Send Byte RLC A ; Rotate Accumulator, send MSB 1st MOV P1.2,C ; Transmit MSB first through C bit SETB P1.1 ; Set SCLK (old data P1.3) CLR P1.1 ; Clear SCLK DJNZ R1,loop ; Decrement byte, repeat loop if not zero SETB P1.2 ; Reset SDI to one when not transmitting( old data P1.3) RET ; Exit subroutine END ; END OF _transfer_byte NAME RECEIVE_BYTE ?PR?_receive_byte?RECEIVE_BYTE SEGMENT CODE PUBLIC _receive_byte RSEG ?PR?_receive_byte?RECEIVE_BYTE _receive_byte: USING 0 MOV R1,#08 ; Set count to 8 to receive byte SETB P1.1 ; Set SDI when not in use LOOP: ; Receive the byte MOV C,P3.5 ; Move bit to carry ( old data P1.2) RLC A ; Rotate A in preparation for next bit SETB P1.1 ; Set SCLK ( old data P1.3) CLR P1.1 ; Clear SCLK DJNZ R1,LOOP ; Decrement byte, repeat loop if not zero MOV R7,A ; Byte to be returned is placed in R7 RET ; Exit subroutine ; END OF _receive_byte END I have initializated the serial port using sync1(0xff) and sync0(oxfe) but still i am not able to read can tell me what could be the problem. Thanks |
Topic | Author | Date |
Reading Problem CS5460A | 01/01/70 00:00 | |
What have you done to check? | 01/01/70 00:00 | |
Reading tips and routine | 01/01/70 00:00 | |
First | 01/01/70 00:00 | |
What about the chip select? | 01/01/70 00:00 | |
Chip select | 01/01/70 00:00 | |
keil | 01/01/70 00:00 | |
here we go again | 01/01/70 00:00 | |
Have C code to read CS5460A | 01/01/70 00:00 | |
Posting Code | 01/01/70 00:00 | |
Where are the rules? | 01/01/70 00:00 | |
posting source code![]() | 01/01/70 00:00 |