char uart_rd;
int b;
void main() {
ANSEL = 0;
ANSELH = 0;
C1ON_bit = 0;
C2ON_bit = 0;
TRISC = 0;
PORTC = 0x00;
UART1_Init(9600);
Delay_ms(10);
UART1_Write_Text("Start");
UART1_Write(10);
UART1_Write(13);
while (1) {
if (UART1_Data_Ready()) {
uart_rd = UART1_Read();
UART1_Write(uart_rd);
**WordtoInt(uart_rd, b)**- this line code is my error
if(b <= 20)
{
PORTC = 0x01;
}
if(b > 20)&&(b <= 40)
{
PORTC = 0x03;
}
if(b > 40)&&(b <= 60)
{
PORTC = 0x07;
}
if(b > 60)&&(b <= 80)
{
PORTC = 0x0F;
}
if(b > 80)&&(b <= 100)
{
PORTC = 0x1F;
}
}
}
}
這是我的任務。當我構建它時,它顯示我一個錯誤。microc中的任務錯誤圖片
我從0 to 100
讀取數字,指示電池電量和取決於電量,port C
的0 to 5
引腳將發光。
有人可以幫助我,如何找到將字轉換爲int的函數?
什麼是錯誤信息? –