| ??? 01/09/06 21:15 Modified: 01/09/06 21:26 Read: times |
#106924 - max186 clarification |
In this post (http://www.8052.com/forum/read.phtml?id=35103) Charles describes the interconnect between an 8051 and a max186.
I see the /CS - 1/0 connection (I believe it's 1/0 not I/O, correct me if I'm wrong). My understanding is that this is just 'any' line that can be set/cleared. MOSI and MISO are pretty easy (also just 'plain' old pins) What I don't get though is where I get SCK(SK*) from on the MCU. I still don't exactly understand how I can get SCLK to be a 'clock'. I have seen a little more detail about this circuit described as follows: P1.0 < Dout - data from 186 to 8051 P1.1 > Din - data from 8051 to 186 P1.2 > SCLK - 'strobe' from 8051 to 186 P1.3 > CS - pull low to start 186 xfer With the following .asm to move the data out and then in:
mov r1,#01
call readadc
....
readadc:
clr p1.3 ; take CS low to wake up the MAX186
mov a,r1 ; prepare a control byte
rl a ; channel select bits need to end up
rl a ; in a.6 through a.4
rl a
rl a
orl a,#10001110b ; complete the control byte
mov r0,#8 ; initialize bit counter
nbit1: rlc a ; send the control byte, MSB first
mov p1.1,c
setb p1.2 ; pulse SCLK between bits
clr p1.2
djnz r0,nbit1 ; repeat for all eight control bits
This will probably too be a stupid question, but how do the 186 and the 8051 speak at the same rate? When I send the first byte out the P1.1, how do the two pieces sync? |
| Topic | Author | Date |
| max186 clarification | 01/01/70 00:00 | |
| Clock | 01/01/70 00:00 | |
| meaning | 01/01/70 00:00 | |
| no almost there | 01/01/70 00:00 | |
| I'm using | 01/01/70 00:00 | |
| and the reason you asked is? | 01/01/70 00:00 | |
| two reasons | 01/01/70 00:00 | |
| aha | 01/01/70 00:00 | |
| possibly. can you handle the overhead o | 01/01/70 00:00 | |
| bb SPI | 01/01/70 00:00 | |
| what is "BB SPI" | 01/01/70 00:00 | |
| (B)it (B)anged SPI | 01/01/70 00:00 | |
| MAX186 | 01/01/70 00:00 | |
| thanks | 01/01/70 00:00 | |
Something to check | 01/01/70 00:00 | |
| setb clrb | 01/01/70 00:00 | |
| muchos gracias (much thanks) | 01/01/70 00:00 |



