代码展示
#include "hal_defs.h"
#include "hal_cc8051.h"
#include "hal_int.h"
#include "hal_mcu.h"
#include "hal_board.h"
#include "hal_led.h"
#include "hal_rf.h"
#include "basic_rf.h"
#include "hal_uart.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#define LED1 P1_0
#define LED2 P1_1
#define SW1 P1_2
void delay(int t)
{
while(t--);
}
void init()
{
P1SEL &=~0x1F;
P1DIR |=0x1B;
P1 &=~0x1B;
}
int x,y;
void hx()
{
if(y>=0&&y<500)
{
x++;
LED1=1;
delay(x);
LED1=0;
delay(x);
y++;
}
if(y>=500)
{
x--;
LED1=1;
delay(x);
LED1=0;
delay(x);
y++;
}
if(y==1000)
{
x=0;
y=0;
}
}
unsigned char word[20];
void LED()
{
if(halUartRead(word,sizeof(word)))
{
halMcuWaitMs(100);
if(word[8]=="ZA 00 ZB")
{
LED1=0;
LED2=0;
}
if(word[8]=="ZA 01 ZB")
{
LED1=1;
LED2=0;
}
if(word[8]=="ZA 02 ZB")
{
LED1=0;
LED2=1;
}
if(word[8]=="ZA 03 ZB")
{
hx();
}
if(word[8]=="ZA 04 ZB")
{
LED1=0;
while(1)
{
LED2=1;
halMcuWaitMs(500);
LED2=0;
halMcuWaitMs(500);
}
}
memset(word,0,sizeof(word));
}
}
/********************MAIN************************/
void main(void)
{
halBoardInit();
init();
halUartInit(115200);
while(1)
{
LED();
}
}
代码报错:
报错所应用的库: