View previous topic :: View next topic |
Author |
Message |
JaKo Guest
|
Problems with the dsPICDEM-Board |
Posted: Fri Feb 29, 2008 5:38 am |
|
|
Hey guys
I bought the dsPICDEM-Board and now I program the SPI with Code: | #use spi(FORCE_HW, BITS=16, STREAM=SPI_STREAM) | because I need the SPI for the LCD-Display. And the problem is that i get a clock but my data won´t get send. And I also programmed the LED. If i use Code: | #use spi(FORCE_HW, BITS=16, STREAM=SPI_STREAM) | the stop lighting, and if i use , the LEDs lights but there is no clock and data for the SPI.
Can somebody help me please?
JaKO |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
JaKo Guest
|
dsPICDEM BOard |
Posted: Tue Mar 04, 2008 6:36 am |
|
|
dsPICDEM2 DM300018
JaKo |
|
|
JaKo Guest
|
Source code |
Posted: Tue Mar 04, 2008 7:01 am |
|
|
That´s my source code:
Quote: | #include<30F4011.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, UART1)
#use spi(FORCE_HW, BITS=16, STREAM=SPI_STREAM)
#define LCDLINE1CMD 0x80;
void main()
{
while(1)
{
unsigned char DisplayData[] = "Das dsPICDEM2 ";
int8 x;
// char c;
// c="A";
delay_ms(250);
output_high(PIN_B0);
output_low(PIN_B1);
delay_ms(250);
output_high(PIN_B1);
output_low(PIN_B0);
SETUP_SPI(SPI_MASTER|SPI_H_TO_L|SPI_CLK_DIV_64);
SPI_WRITE(DisplayData);
x=SPI_READ(0);
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 04, 2008 12:35 pm |
|
|
Here's the page for that board.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023561
The User's Guide explains how to write a driver for the LCD controller
in this section. But, they don't tell you what SPI mode is required.
Here is the section in the manual that tells how to program the LCD.
Quote: | B.3 LCD SOFTWARE SPECIFICATION |
The page above also has a download called "Software Files". It contains
sample C source code for the LCD driver. The filename is SPI_for_LCD.c.
It contains these functions:
Quote: | SPI_Init(void)
WriteSPI_to_LCD(void) |
It mostly consists of low-level code that writes directly to dsPIC registers.
You could translate it to CCS.
I don't have the PCD compiler, and I don't have time to translate these
routines for you now. I can't really help much more. |
|
|
|