Pic16F887에서이 LCD 예제를 이해하려고합니다. http://www.mikroe.com/chapters/view/17/chapter-4-examples/#c4v12LCD 라이브러리 - MPLAB X
하지만 컴파일러는 나에게 오류를 보여주는 유지 :
lcdpic16.c:32: warning: function declared implicit int
lcdpic16.c:33: warning: function declared implicit int
lcdpic16.c:33: error: undefined identifier "_LCD_CURSOR_OFF"
lcdpic16.c:34: error: undefined identifier "_LCD_CLEAR"
lcdpic16.c:36: warning: illegal conversion between pointer types
pointer to const unsigned char -> pointer to unsigned char
lcdpic16.c:37: warning: function declared implicit int
lcdpic16.c:38: warning: illegal conversion between pointer types
pointer to const unsigned char -> pointer to unsigned char
lcdpic16.c:43: warning: function declared implicit int
lcdpic16.c:45: warning: illegal conversion between pointer types
pointer to const unsigned char -> pointer to unsigned char
lcdpic16.c:48: warning: function declared implicit int
lcdpic16.c:54: warning: function declared implicit int
lcdpic16.c:55: warning: function declared implicit int
(908) exit status = 1
make: *** [build/default/production/lcdpic16.p1] Error 1
BUILD FAILED (exit value 2, total time: 22s)
소스 코드 (lcdp16.c를)
/*Header******************************************************/
#include <pic16f887.h>
// LCD module connections
#define LCD_RS RB4
#define LCD_RS RB4
#define LCD_EN RB5
#define LCD_D4 RB0
#define LCD_D5 RB1
#define LCD_D6 RB2
#define LCD_D7 RB3
#define LCD_RS_Direction TRISB4
#define LCD_EN_Direction TRISB5
#define LCD_D4_Direction TRISB0
#define LCD_D5_Direction TRISB1
#define LCD_D6_Direction TRISB2
#define LCD_D7_Direction TRISB3
// End LCD module connections
unsigned char ch; //
unsigned int adc_rd; // Declare variables
char *text; //
long tlong; //
void main() {
INTCON = 0; // All interrupts disabled
ANSEL = 0x04; // Pin RA2 is configured as an analog input
TRISA = 0x04;
ANSELH = 0; // Rest of pins are configured as digital
Lcd_Init(); // LCD display initialization
Lcd_Cmd(_LCD_CURSOR_OFF); // LCD command (cursor off)
Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD)
text = "mikroElektronika"; // Define the first message
Lcd_Out(1,1,text); // Write the first message in the first line
text = "LCD example"; // Define the second message
Lcd_Out(2,1,text); // Define the first message
ADCON1 = 0x82; // A/D voltage reference is VCC
TRISA = 0xFF; // All port A pins are configured as inputs
Delay_ms(2000);
text = "voltage:"; // Define the third message
while (1) {
adc_rd = ADC_Read(2); // A/D conversion. Pin RA2 is an input.
Lcd_Out(2,1,text); // Write result in the second line
tlong = (long)adc_rd * 5000; // Convert the result in millivolts
tlong = tlong/1023; // 0..1023 -> 0-5000mV
ch = tlong/1000; // Extract volts (thousands of millivolts)
// from result
Lcd_Chr(2,9,48+ch); // Write result in ASCII format
Lcd_Chr_CP('.');
ch = (tlong/100) % 10; // Extract hundreds of millivolts
Lcd_Chr_CP(48+ch); // Write result in ASCII format
ch = (tlong/10) % 10; // Extract tens of millivolts
Lcd_Chr_CP(48+ch); // Write result in ASCII format
ch = tlong % 10; // Extract digits for millivolts
Lcd_Chr_CP(48+ch); // Write result in ASCII format
Lcd_Chr_CP('V');
Delay_ms(1);
}
}
사람이 무슨 일이 일어나고 있는지 나에게 설명 할 수 있습니까? 컴파일러가 Lcd_Init()
같은 메서드를 인식 할 수 있도록 사용자 지정 LCD 라이브러리를 만들어야합니까? (Windows 7/XC8/MPLAB X)
. 'pic16f887.h'는 SFR과 같은 컨트롤러 고유의 정의만을 포함합니다.자습서에 대한 링크가 작동하지 않습니다 (페이지를 찾을 수 없음). 더 구체적 일 수는 없습니다. –
네, sth가 없어서 찾을 수 없습니다.> _ <특정 종류의 라이브러리 일 수 있습니다.> _ < 여기 있습니다 링크 : http://www.mikroe.com/chapters/view/17/chapter-4-examples/#c4v12 – user1428734
"이 예제를 올바르게 작동 시키려면 라이브러리 관리자에서 다음 라이브러리를 체크해야합니다 컴파일하기 전에 :'ADC''LCD' " –