EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 384

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 368 -
void Uart4Isr() interrupt 18
{
if (S4CON & 0x02)
{
S4CON &= ~0x02;
busy = 0;
}
if (S4CON & 0x01)
{
S4CON &= ~0x01;
buffer[wptr++] = S4BUF;
wptr &= 0x0f;
}
}
void Uart4Init()
{
S4CON = 0x50;
T4L = BRT;
T4H = BRT >> 8;
T4T3M = 0xa0;
wptr = 0x00;
rptr = 0x00;
busy = 0;
}
void Uart4Send(char dat)
{
while (busy);
busy = 1;
S4BUF = dat;
}
void Uart4SendStr(char *p)
{
while (*p)
{
Uart4SEND(*p++);
}
}
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
Uart4Init();

Table of Contents

Related product manuals