ddr123ab
Newbie level 2
xc888
I was trying to send something to the hyperterminal using the USART. Below is the of the sample code i try. This is the setting of the the hyperterminal: 9600bps baud rate, 0 stop bit, parity bit none and flow control none. But nothing come out in the hyperterminal. Please Help.
Please add me msn at ddp213@hotmail.com if u can help. Thanks.
#include "MAIN.H"
void MAIN_vInit(void)
{
SFR_PAGE(_su1, noSST);
CMCON = 0x10;
SFR_PAGE(_su0, noSST);
IO_vInit();
UART_vInit();
IP = 0x00;
IPH = 0x00;
IP1 = 0x00;
IPH1 = 0x00;
EA = 1;
}
void main(void)
{
MAIN_vInit();
TI = 1;
while(1)
{
}
}
void IO_vInit(void)
{
P3_DIR = 0xC0;
}
void UART_vInit(void)
{
SFR_PAGE(_pp2, noSST); // switch to page 2 without saving
P1_ALTSEL0 &= ~(ubyte)0x02; // configure alternate function
register 0
P1_ALTSEL1 |= (ubyte)0x02; // configure alternate function
register 1
SFR_PAGE(_pp0, noSST); // switch to page 0 without saving
P1_DIR |= (ubyte)0x02; // set output direction
MODPISEL &= ~(ubyte)0x01; // configure peripheral input select
register
BCON = 0x00; // reset baudrate timer/reload
register
SCON = 0x50;
BG = 0x9B; // load baudrate timer/reload register
BCON |= 0x01; // load baud rate control register
ES = 1;
}
void UART_viIsr(void) interrupt UARTINT
{
SFR_PAGE(_su0, SST0);
if (TI)
{
TI = 0;
}
if (RI)
}
RI = 0;
P3_DATA ^= 0x40; // toggle P3.6 on EK-888 after receive byte
printf ("Hello World\n"); /* Print "Hello World" */
}
SFR_PAGE(_su0, RST0);
}
I was trying to send something to the hyperterminal using the USART. Below is the of the sample code i try. This is the setting of the the hyperterminal: 9600bps baud rate, 0 stop bit, parity bit none and flow control none. But nothing come out in the hyperterminal. Please Help.
Please add me msn at ddp213@hotmail.com if u can help. Thanks.
#include "MAIN.H"
void MAIN_vInit(void)
{
SFR_PAGE(_su1, noSST);
CMCON = 0x10;
SFR_PAGE(_su0, noSST);
IO_vInit();
UART_vInit();
IP = 0x00;
IPH = 0x00;
IP1 = 0x00;
IPH1 = 0x00;
EA = 1;
}
void main(void)
{
MAIN_vInit();
TI = 1;
while(1)
{
}
}
void IO_vInit(void)
{
P3_DIR = 0xC0;
}
void UART_vInit(void)
{
SFR_PAGE(_pp2, noSST); // switch to page 2 without saving
P1_ALTSEL0 &= ~(ubyte)0x02; // configure alternate function
register 0
P1_ALTSEL1 |= (ubyte)0x02; // configure alternate function
register 1
SFR_PAGE(_pp0, noSST); // switch to page 0 without saving
P1_DIR |= (ubyte)0x02; // set output direction
MODPISEL &= ~(ubyte)0x01; // configure peripheral input select
register
BCON = 0x00; // reset baudrate timer/reload
register
SCON = 0x50;
BG = 0x9B; // load baudrate timer/reload register
BCON |= 0x01; // load baud rate control register
ES = 1;
}
void UART_viIsr(void) interrupt UARTINT
{
SFR_PAGE(_su0, SST0);
if (TI)
{
TI = 0;
}
if (RI)
}
RI = 0;
P3_DATA ^= 0x40; // toggle P3.6 on EK-888 after receive byte
printf ("Hello World\n"); /* Print "Hello World" */
}
SFR_PAGE(_su0, RST0);
}