//中断
@far @interrupt void UART1_Recv_IRQHandler (void)
{
unsigned char ch;
if(UART1_SR&(1<<5))//接收到的字符
{
ch = UART1_DR; // 读入接收到的字符
}
}
//extern @far @interrupt void TIM5_UPD_OVF_IRQHandler (void);
//extern @far @interrupt void TIM6_UPD_OVF_IRQHandler (void);
struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext}, /* reset */
{0x82, NonHandledInterrupt}, /* trap */
{0x82, NonHandledInterrupt}, /* irq0 */
{0x82, NonHandledInterrupt}, /* irq1 */
{0x82, NonHandledInterrupt}, /* irq2 */
{0x82, NonHandledInterrupt}, /* irq3 */
{0x82, NonHandledInterrupt}, /* irq4 */
{0x82, NonHandledInterrupt}, /* irq5 */
{0x82, NonHandledInterrupt}, /* irq6 */
{0x82, NonHandledInterrupt}, /* irq7 */
{0x82, NonHandledInterrupt}, /* irq8 */
{0x82, NonHandledInterrupt}, /* irq9 */
{0x82, NonHandledInterrupt}, /* irq10 */
{0x82, NonHandledInterrupt}, /* irq11 */
{0x82, NonHandledInterrupt}, /* irq12 */
{0x82, NonHandledInterrupt}, /* irq13 */
{0x82, NonHandledInterrupt}, /* irq14 */
{0x82, NonHandledInterrupt}, /* irq15 */
{0x82, NonHandledInterrupt}, /* irq16 */
{0x82, NonHandledInterrupt}, /* irq17 */
{0x82, UART1_Recv_IRQHandler}, /* irq18 */
{0x82, NonHandledInterrupt}, /* irq19 */
{0x82, NonHandledInterrupt}, /* irq20 */
{0x82, NonHandledInterrupt}, /* irq21 */
{0x82, NonHandledInterrupt}, /* irq22 */
{0x82, NonHandledInterrupt},/* irq23 */
{0x82, NonHandledInterrupt}, /* irq24 */
{0x82, NonHandledInterrupt}, /* irq25 */
{0x82, NonHandledInterrupt}, /* irq26 */
{0x82, NonHandledInterrupt}, /* irq27 */
{0x82, NonHandledInterrupt}, /* irq28 */
{0x82, NonHandledInterrupt}, /* irq29 */
};
//主程序
while (1)
{
 
B5_OUT = 1; //4.2V电压截止
PA1_OUT = 1; //3.3V电压使能
PD3_OUT = 0; // LED1
PD2_OUT = 1; //LED2
DelayMS(100); //
PD2_OUT = 0; //LED2
PD3_OUT = 1; //LED1
DelayMS(100);
P_485 = 1;
for(i = 0;i<64;i++)
{
UART1_DR = Buffer[64];
while((UART1_SR&0x40)==0);
}
printf("\r\n\r\n");//
}