Oh yes of course didnt think about it. But Now i have the next Problem. When i send for example an 0x01 Hex Number to the SPI Port in a while(1) loop i can see the Bit on the Oscilloscope.
But if i try to send 0xFF i while(1) loop so there is nothing. Its Maybe Because the Data collides??. Then I tried to Send some Data to my LCD to turn it on. the lcd expects 16 bits. And when I send the following: so i dont see 00000110 and 00000001 on the Oscilloscope its seems to be wrong sometimes it matches but the most time its wrong.
void display_on (void)
{
FGPIOE_PCOR= (1UL<<1) // Pin LOW for Write Command to SPI
spi_send(0x06); // Command for LCD Register
FGPIOE_PSOR= (1UL<<1) // Pin HIGH for Write Command to SPI
spi_send(0x01); // Data LCD
}
But, when i do SOFTWARE SPI the Display works and the bits are right on the Oscilloskope too
void Write_command(unsigned char Data)
{
unsigned char i;
CS_OFF; // Chip Select LOW
DC_OFF; // Pin LOW for Write Command to SPI
for (i=0; i<8; i++)
{
SCLK_OFF; // SCLK LOW
FGPIOC_PDOR=(Data&0x80)>>7; // MSB FIRST
Data = Data << 1;
SCLK_ON; / SCLK HIGH
}
DC_ON; // Pin LOW for Write Command to SPI
CS_ON; // Chip Select HIGH
}
void Write_data(unsigned char Data)
{
unsigned char i;
CS_OFF; // Chip Select LOW
DC_ON; // Pin HIGH for Write Command to SPI
for (i=0; i<8; i++)
{
SCLK_OFF; // SCLK LOW
FGPIOC_PDOR=(Data&0x80)>>7; // MSB FIRST
Data = Data << 1;
SCLK_ON; / SCLK HIGH
}
DC_ON; // PinHIGH for Write Command to SPI
CS_ON; // Chip Select HIGH
}
if i write to display now it works and i see the right Bits on the oscilloscope
int main(void)
{
Write_command(0x06) // Command to LCD
Write_data(0x01); // Data LCD ON
}