| Author |
Message |
microlab
Joined: 04 Mar 2006 Posts: 106 Helped: 3
|
28 Jan 2008 8:36 problem in interfacing cc2500 to at 89c2051 |
|
|
|
|
Hello,
I am using the following :
processor: at89c2051
crystal : 11.0592 mhz
rf ic :cc2500
pull up resistor : 4.k
I am unable to write and read from the configurable registers, can anyone give a clue ?
Thanks
ml
si equ p1.7
scl equ p1.6
so equ p1.5
cs equ p1.4
led equ p3.5
org 0000h
mov p1,#0ffh
clr led
clr scl
clr cs
jb so,$
setb led
mov a,#10h
clr c
mov r0,#8
sendx: rlc a
cpl scl ;1
mov si,c
cpl scl ;0
djnz r0,sendx
nop
mov r1,#8
recx: cpl scl ;1
mov c,so
rlc a
cpl scl ;0
djnz r1, recx
setb scl
nop
setb cs
mov r3,a
again: clr led
acall delay
setb led
djnz r3,again
sjmp $
|
|
| Back to top |
|
 |
Google AdSense

|
28 Jan 2008 8:36 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
ctownsend
Joined: 27 Nov 2004 Posts: 301 Helped: 21 Location: Canada
|
28 Jan 2008 16:55 Re: problem in interfacing cc2500 to at 89c2051 |
|
|
|
|
Maybe you should post a schematic?
You should use code tags when posting code.
It is really difficult to read your code otherwise.
Try this SPI code:
| Code: |
;SPI_Transfer SPI_MODE1
;transmits and receives a byte simultaneously in acc
SPI_Transfer:
MOV R7, #08H ; Load R7 to count bits
SPI_Loop:
SETB SCK ; Clock High
RLC A ; Rotate MSB into Carry Bit
MOV MOSI, C ; Move bit out to MOSI
CLR SCK ; Clock Low
MOV C, MISO ; Move MISO into Carry Bit
DJNZ R7, SPI_Loop ; Loop for another bit until done
RLC A ; Rotate Carry Bit into A
RET ; Return from routine
|
|
|
| Back to top |
|
 |
FvM
Joined: 22 Jan 2008 Posts: 5177 Helped: 769 Location: Bochum, Germany
|
28 Jan 2008 19:39 Re: problem in interfacing cc2500 to at 89c2051 |
|
|
|
|
Hello,
apart from what's being said. You don't tell, what you are trying to achieve in the code snippet, which would actually increase the chance of getting effective help. You could e. g. tell: I want to read register $10 trough SPI. First cycle sends the address, second reads the register content.
By chance I recently did some CC1050 programming. I see, that you set the RW bit (B7) to 0 which means "write" also with CC2500, I think. Thus you shouldn't expect to read any data from the register.
Regards,
Frank
|
|
| Back to top |
|
 |