LK-204-25 can not receive command and text
Posted: Fri Apr 06, 2007 1:34 pm
Hi all,
I try to use DSP tms320c2812 to control LK-204-25 LCD and keypad, connecting wiht SCI. I have composed a little program, and debuged it. But the result is worst. I hope the program can first finish clear screen, and then send 80 text to show on LCD. But there is nothing change on the LCD screen. I use TI XDS510USB emulator, and windmill development board "bf3Net F2812 Networking Kit".
In order to show clear, I supply the following description:
1. On the development board and LK-204-25, the SCI connector is DB-9 female connector, so I use a cable that has tow male DB-9 male connectors, and I have swap the RX and TX line in the cable.
2. the LED lights on the development board always light during the program running.
3. the volotage is about 1 V between RX and TX, no matter the program is running or not.
4. the baud rate was set to 19200.
5. When I use uproject.exe to connect LCD, it is normal.
Please the experts give me some advices.
Thanks.
Garrison
the program as following :
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
// Prototype statements for functions found within this file.
void scia_init(void);
void scia_xmit(int a);
// Global variables
Uint16 sdataA[80]; // Send data for SCI-A
Uint16 rdataA[8]; // Received data for SCI-A
Uint16 sdata_pointA; // Used for setting Cursor Position
Uint16 ClearScreen[2]={0x00FE, 0x0058};
Uint16 SendChar; // character being sent by SCIA
void main(void)
{
Uint16 i;
Uint32 j;
// Uint32 k;
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio();
// Setup only the GP I/O only for SCI-A and SCI-B functionality
EALLOW;
GpioMuxRegs.GPFMUX.bit.SCITXDA_GPIOF4 = 1;
GpioMuxRegs.GPFMUX.bit.SCIRXDA_GPIOF5 = 1;
EDIS;
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
scia_init(); // Init SCI-A
// Step 5.
// Init send data. After each transmission this data
// will be updated for the next transmission
// clear screen.
SendChar = ClearScreen[0];
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay
SendChar = ClearScreen[1];
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
//set original datas for sdataA.
for(i = 0; i<80; i++)
{
sdataA = (sdataA[i-1]+1)&0x00FF;
}
//send text to the LCD LK-204-25,
for(;;)
{
for(i = 0; i<80; i++)
{
if (SciaRegs.SCICTL2.bit.TXRDY==1)
{
SendChar = sdataA;
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
}
for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay
}
}
}
void scia_init()
{
// Reset FIFO's
SciaRegs.SCIFFTX.all=0x8000;
SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
SciaRegs.SCICTL2.all =0x0000;
SciaRegs.SCIHBAUD = 0x0003;
SciaRegs.SCILBAUD = 0x00CF;
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
}
// Transmit a character from the SCI-A'
void scia_xmit(int a)
{
SciaRegs.SCITXBUF=a;
}
//===========================================================================
// No more.
//===========================================================================
I try to use DSP tms320c2812 to control LK-204-25 LCD and keypad, connecting wiht SCI. I have composed a little program, and debuged it. But the result is worst. I hope the program can first finish clear screen, and then send 80 text to show on LCD. But there is nothing change on the LCD screen. I use TI XDS510USB emulator, and windmill development board "bf3Net F2812 Networking Kit".
In order to show clear, I supply the following description:
1. On the development board and LK-204-25, the SCI connector is DB-9 female connector, so I use a cable that has tow male DB-9 male connectors, and I have swap the RX and TX line in the cable.
2. the LED lights on the development board always light during the program running.
3. the volotage is about 1 V between RX and TX, no matter the program is running or not.
4. the baud rate was set to 19200.
5. When I use uproject.exe to connect LCD, it is normal.
Please the experts give me some advices.
Thanks.
Garrison
the program as following :
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
// Prototype statements for functions found within this file.
void scia_init(void);
void scia_xmit(int a);
// Global variables
Uint16 sdataA[80]; // Send data for SCI-A
Uint16 rdataA[8]; // Received data for SCI-A
Uint16 sdata_pointA; // Used for setting Cursor Position
Uint16 ClearScreen[2]={0x00FE, 0x0058};
Uint16 SendChar; // character being sent by SCIA
void main(void)
{
Uint16 i;
Uint32 j;
// Uint32 k;
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Initalize GPIO:
// This example function is found in the DSP281x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
// InitGpio();
// Setup only the GP I/O only for SCI-A and SCI-B functionality
EALLOW;
GpioMuxRegs.GPFMUX.bit.SCITXDA_GPIOF4 = 1;
GpioMuxRegs.GPFMUX.bit.SCIRXDA_GPIOF5 = 1;
EDIS;
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP281x_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP281x_DefaultIsr.c.
// This function is found in DSP281x_PieVect.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals:
// This function is found in DSP281x_InitPeripherals.c
// InitPeripherals(); // Not required for this example
scia_init(); // Init SCI-A
// Step 5.
// Init send data. After each transmission this data
// will be updated for the next transmission
// clear screen.
SendChar = ClearScreen[0];
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay
SendChar = ClearScreen[1];
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
//set original datas for sdataA.
for(i = 0; i<80; i++)
{
sdataA = (sdataA[i-1]+1)&0x00FF;
}
//send text to the LCD LK-204-25,
for(;;)
{
for(i = 0; i<80; i++)
{
if (SciaRegs.SCICTL2.bit.TXRDY==1)
{
SendChar = sdataA;
scia_xmit(SendChar);
while (SciaRegs.SCICTL2.bit.TXRDY==1)
{
scia_xmit(SendChar);
}
}
for(j = 1; j<= 0x0FFFFFF; j++)
{
asm(" NOP");
} // delay
}
}
}
void scia_init()
{
// Reset FIFO's
SciaRegs.SCIFFTX.all=0x8000;
SciaRegs.SCICCR.all =0x0007; // 1 stop bit, No loopback
// No parity,8 char bits,
// async mode, idle-line protocol
SciaRegs.SCICTL1.all =0x0003; // enable TX, RX, internal SCICLK,
// Disable RX ERR, SLEEP, TXWAKE
SciaRegs.SCICTL2.all =0x0000;
SciaRegs.SCIHBAUD = 0x0003;
SciaRegs.SCILBAUD = 0x00CF;
SciaRegs.SCICTL1.all =0x0023; // Relinquish SCI from Reset
}
// Transmit a character from the SCI-A'
void scia_xmit(int a)
{
SciaRegs.SCITXBUF=a;
}
//===========================================================================
// No more.
//===========================================================================