[an error occurred while processing this directive]
|
#define SCICCRA *((volatile unsigned short *)0x7050)
#define SCICTL1A *((volatile unsigned short *)0x7051)
#define SCIHBAUDA *((volatile unsigned short *)0x7052)
#define SCILBAUDA *((volatile unsigned short *)0x7053)
#define SCICTL2A *((volatile unsigned short *)0x7054)
#define SCIRXSTA *((volatile unsigned short *)0x7055)
#define SCIRXEMUA *((volatile unsigned short *)0x7056)
#define SCIRXBUFA *((volatile unsigned short *)0x7057)
#define SCITXBUFA *((volatile unsigned short *)0x7059)
#define SCIFFTXA *((volatile unsigned short *)0x705A)
#define SCIFFRXA *((volatile unsigned short *)0x705B)
#define SCIFFCTA *((volatile unsigned short *)0x705C)
#define SCIPRIA *((volatile unsigned short *)0x705F)
/*==================================================================*/
void my_uart_init()
{
#ifdef SCI_A
GPFMUX=0x0030;
GPFDIR=0x0030;
SCICTL1A= 0x2b; // reset uarts
SCICTL1A= 0x1b;
SCICCRA= 0x8f;
SCICTL2A= 0x00;
LOSPCP= 0x07; /* LSPCLK = SYSCLKOUT / 14 == 10.714286MHz */
SCIHBAUDA= 0x00;
SCILBAUDA= 0x8a; /* BRR= (LSPCLK/(Baud * 8)) -1; == 0x8a */
#else
GPGMUX=0x00;
SCICCRB= 0x80;
SCICTL1B= 0x2b; // reset uarts
SCICTL1B= 0x0b;
SCICTL2B= 0x00;
LOSPCP= 0x07; /* LSPCLK = SYSCLKOUT / 14 == 10.714286MHz */
SCIHBAUDB= 0x00;
SCILBAUDB= 0x8a; /* BRR= (LSPCLK/(Baud * 8)) -1; == 0x8a */
#endif
return;
}/*==================================================================================================*/
void my_putch(char c)
{
#ifdef SCI_A
while(!(SCICTL2A & TXEMPTY)) continue; /* set when register is empty */
SCITXBUFA = c;
#else
while(!(SCICTL2B & TXEMPTY)) continue; /* set when register is empty */
SCITXBUFB = c;
#endif
return;
}
#include
#include "uart.h"
#include "f2812.h"
void main()
{ WDCR |= DISABLE_WD;
asm(" eallow ; Enable accesses to PIE control registers");
my_uart_init();
while(1)/* write a string to stdout */
{my_putch(0x55);
}}
E-mail: info@telesys.ru