View previous topic :: View next topic |
Author |
Message |
ko308
Joined: 06 Sep 2003 Posts: 2 Location: New York NY
|
SPI communication with MAX6952 |
Posted: Fri Mar 21, 2003 2:23 pm |
|
|
i'm having a hard time establishing SPI communication between 16F877 and MAX6952 (LED matrix display driver). i'm trying to turn on the display by sending "display test" command (0x0701). but nothing is happening.
the datasheet says,
1. take CLK low
2. take CS low
3. clock 16 bits of data into DIN, D15 first to D0 last, observing the setup and hold times.
4. take CS high. (while CLK is stil high after clocking in the last data bit.)
5. take CLK low.
my code looks like this:
#include <16F877.H>
#fuses HS, NOWDT,NOPROTECT,NOLVP
#use delay (clock = 20000000)
#define CLK PIN_C3
#define CS PIN_B6
#define MOSI PIN_C5
#define MISO PIN_C4
sendData(long value){
int i;
output_low(CLK);
delay_us(1);
output_low(CS);
delay_us(1);
for(i=0;i<16;i++){
output_low(CLK);
delay_us(1);
output_bit(MOSI, shift_left(&value,2,0));
delay_us(1);
output_high(CLK);
delay_us(1);
}
output_high(CS);
delay_us(1);
output_low(CLK);
delay_us(1);
output_high(CLK);
}
init(){
output_high(CS);
output_high(CLK);
output_low(MOSI);
output_low(MISO);
}
main(){
init();
while(true){
sendData(0x0701);
delay_ms(1000);
}
}
does anybody know how to get it to work?
thanks,
kentaro
___________________________
This message was ported from CCS's old forum
Original Post ID: 12932 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: SPI communication with MAX6952 |
Posted: Fri Mar 21, 2003 5:48 pm |
|
|
:=i'm having a hard time establishing SPI communication between 16F877 and MAX6952 (LED matrix display driver). i'm trying to turn on the display by sending "display test" command (0x0701). but nothing is happening.
----------------------------------------------------------
Your code looks like it should work. I would check these
things:
1. Do you have the proper Rset and Cset components installed ?
2. During test mode, all the LEDs are turned on. That's 120
LEDs. Does your power supply have enough current to
support this load ? Also, turning on all these LEDs will
cause a current surge. Is your power supply capable of
handling a current surge, or will it shut down ?
(I've worked with LED arrays and some small form-factor
switching power supplies, even though they claim 125
watts output, cannot handle a current surge.)
I realize your current usage may only be a few hundred ma,
but can your power supply handle it ?
3. If all of the above looks OK, then I would check the
connections. Check it against the data sheet, too.
Make sure the correct pins have power and ground.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12939 |
|
|
ko308
Joined: 06 Sep 2003 Posts: 2 Location: New York NY
|
Re: SPI communication with MAX6952 |
Posted: Fri Mar 21, 2003 11:02 pm |
|
|
thank you PCM programmer.
:=1. Do you have the proper Rset and Cset components installed ?
pardon my ignorance but what is Rset and Cset components? are they something i need to install on my pc? i'm on windows 98 and ccs compiler version is 3.0.0.9.
thanks,
kentaro
___________________________
This message was ported from CCS's old forum
Original Post ID: 12947 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: SPI communication with MAX6952 |
Posted: Fri Mar 21, 2003 11:39 pm |
|
|
<font face="Courier New" size=-1>:=thank you PCM programmer.
:=
:=:=1. Do you have the proper Rset and Cset components installed ?
:=
:=pardon my ignorance but what is Rset and Cset components? are they something i need to install on my pc? i'm on windows 98 and ccs compiler version is 3.0.0.9.
--------------------------------------------------------
I don't think the compiler has version numbers in that format.
Here is the format that they are in:
<a href="http://www.ccsinfo.com/cgi-bin/update.cgi?software=VERSIONS" TARGET="_blank"> <a href="http://www.ccsinfo.com/cgi-bin/update.cgi?software=VERSIONS" TARGET="_blank">http://www.ccsinfo.com/cgi-bin/update.cgi?software=VERSIONS</a></a>
With regard to Cset and Rset, look at the Typical Application
Circuit on page 1 of the MAX6952 data sheet, here:
<a href="http://pdfserv.maxim-ic.com/arpdf/MAX6952.pdf" TARGET="_blank">http://pdfserv.maxim-ic.com/arpdf/MAX6952.pdf</a>
---</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12948 |
|
|
|