If you found this video useful, please give it a thumbs up 👍 and subscribe to the channel. Also, let me know what topics you want me to cover in future videos by commenting below. By simply liking the video or a short comment like Thanks, helps this video in RUclips algorithm to be found by others. It helps us a lot.
+Terry Child Indeed. From XC8 v1.35, the PIC18F Peripheral Libraries are no longer included which includes the LCD library. You can either install them as a separate download file (in XC8 Compiler downloads page on microchip website, they are now called Legacy Peripheral Libraries) or you can write your own LCD library.
Travail bien fait. Thank you so much student companion. i'm a student from Tshwane university of technology and I learn good stuffs from your videos. grand merci!
Wow. Fantastic tutorial. Well explained. I needed a refresher as it's been years since I last used an one of these. This hit all of the marks! Thank you, and great work.
Thank you for your feedback. Please watch this video too to learn how to use the new library as the Peripheral Libraries used in this tutorial the time we recoreded it some few years ago is being phased out in favor of MPLAB Code Configurator: ruclips.net/video/4WaB_Lj8FnY/видео.html
Sir, May i know please what are DelayFor18TCY, DelayPORXLCD and DelayXLCD? Where we used these delay in program? We didn't call these function in Main Program. In our circuit RS and E we connected to RB5 and RB6. But we didn't mention anything about where we are Applying High to these PIN. If we are choosing different PIN where should have to change in our Program.
+Shuhaib K.A. Hi, The delays DelayFor18TCY, DelayPORXLCD and DelayXLCD are used by the OpenXLCD() and other LCD functions. You don't call them in your main program, but they are used by the OpenXLCD() to initialize the LCD according to its datasheet. Some delays are required when switching ON the lcd and when some other commands are performed. We didn't specify where you connect the pins RS and E because we used the default connections which is defined in the xlcd.h file. By default the RS and E should be connected to pins RB5 and RB4. If you need to change the default connections, you'll have to modify this xlcd.h file. Watch our tutorial 17 to learn how to connect your LCD to any PORT or to different pins: ruclips.net/video/RkDN2GW_SxU/видео.html There is also a simpler LCD library you can use, it does not have all those delays and it has only 2 files, you can learn more from our website: www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
Is there any need of extra circuit means pull up resistor or any other component when this circuit is implemented on PCB.Because my circuit work well on Bread board but it gives default value when implemented on PCB.
+Aqeel Ahmed HI. If it works well on breadboard then it should work very well on PCB. There must be something else you are not doing well or omitting on PCB
very nice tutorial but i have an error on putrsXLCD i am using xc8 compiler version 2.10 and mplabx v5.6 , can you help me . Have any change in header file.
Thanks for the Video.. How much you can write on XC8 Demo Version? im afraid to beggin in this compiler C of Microchip because if my skills improve in time i wont have money to purchase the professional version, so do you think is better to program in CCS or Mikrotik instead a pay program compiler like XC8?
tiwar87 , there is no code limit on the XC8 demo version, you can write a code as big as you want, the only difference is the optimization of the generated code, with free version, there is no optimization so the generated HEX file might be a little bigger than if you used a professional version. Depending on other compilers, it's up to you. You can try them and decide yourself, but you must remember that the XC8 is the manufacture compiler with a wide range of application libraries.
they might be many reasons. if this delay is only noticeable when you start your simulation and everything goes smoothly thereafter, it might be that your PC is slow as Proteus requires some resources from your PC. If you download the code into the actual PIC, you won't see that delay we believe.
I always come back here to revive my passion for PICs microcontroller, your videos are a fantastic legacy for us. I'm using PIC16F/627/628/648/877 and none of them is working with your code, my question is, is there a library for LCD for PIC16F similar to what you're using? Merci pour votre reponse.
Hello. Thanks for the tutorial. I would like to ask you were is the lcd library in MPLAB X v3.45. I´m using XC8 but i can´t find the lcd library. Do I need to download it?.
+Student Companion SA you can download it on our website. But if you are talking about this tutorial 5, it's PIC18F peripherals libraries. From xc8 compiler version 1.35 and later you have to download it separately. Watch tutorial 22 to see where to download it and activate it
My program compiles successfully, but I get " function DelayXLCD is never called". Do you know exactly where this function is called in the program. I do not see it in the openxlcd source file.
Hi. If you remove it I am sure it won't compile again. DelayXLCD is used in xlcd.h header file. Almost at the bottom of the file, you'll see: extern void DelayXLCD(void); If you navigate to declaration/definition of OpenXLCD, it will take you to xlcd.h header file.
Hi, so how do I know which Port to use to connect the PIC to the LCD? Is there a code that I can write to configure that specific port to work with the LCD. And why does the LCD need delays in order for it to work?
Thapelo Masilo Hi, The default LCD connection is on PORTB using the LCD library, so you don't have to define PORTB. This library is called xlcd.h it define the connections of the LCD. If you want to connect your LCD on a different PORT other than PORTB, then you should modify it accordingly. You can access this xlcd.h file in your XC8 compiler installation folder in this directory: ...Microchip/xc8/v1.34/include/plib Note: v1.34 is your XC8 version. The xlcd.h library needs those delays.
Thapelo Masilo As we have said it earlier, the LCD Library (xlcd.h) needs those delays to control the LCD. If you don't include them, your code won't work. If you want, you can address the LCD directly without using the LCD Library or you can write your own library but, you'll have to understand the internal working of the LCD.
StudentCompanionSA Thank you. It worked. I only had to enable the LCD by sending a 1 to the Enable pin. So the main function looks like this void main (void) { LATBbits.LATB4 =1;//I included this command to enable the LCD init_XLCD(); putrsXLCD ("StudentCompanion"); SetDDRamAddr (0x40); putrsXLCD ("LCD Display"); while (1) { } }
Thank you very much for your tutorial. It's really useful. But I don't understand why the frequency is 8Mhz so the instruction cycle time is 1.5us. Can you help me understand that.
Hi Bi Na with a clock of 8MHz, the instruction time will be 0.5μs not 1.5μs. In PIC microcontrollers, an instruction cycle takes four clock periods, the microcontroller actually operates at a clock rate, which is a quarter of the actual oscillator frequency. For example, in a PIC microcontroller operating at 4-MHz clock, the instruction cycle time is only 1 μs (frequency of 1 MHz). For 8MHz, the time will be 0.5μs
StudentCompanionSA Thank you very much, I fully understand of that but in the DelayFor18TCY, which you want to delay 18 cycle but I just see 14 Nop(). I don't understand of that.
Bi Na You can use the normal delay function or use the nop() function to generate the delay as we explained in the video. if you follow well the video you will understand.
sir, thanks for this step by step explanation. i performed same code but my compiler gives an error on Delay1KTCYx(30); command it gives error newmain.c:31: warning: (361) function declared implicit int i could not understand the reason of this error
I'm having a heck of a time implementing I2C with a 16F1508. I've tried so many different things with no luck. I considered moving to PIC18 family but plib is not installed on my system. I have no plib folder in include and there is no documentation for it in the docs folder. I don't suppose you'd consider doing an I2C tutorial for the PIC16 family would you?
hi. if you are considering PIC18 it ia very easy to implement especially if you using the library. They have to be a library help document unless you are looking on a wrong installation folder. check our tutorial 6 (ADC) or 14 (rs232) to learn how to using the library help document. we have an I2C tutorial on our website. check for it on www.studentcompanion.co.za
+KubuntuYou The library help file is called: MPLAB_XC8_Peripheral_Libraries and is located in the docs folder in XC8 installation folder. It is not in lib folder. Check out this tutorial, we clearly show you where to find it and how to use this document: ruclips.net/video/8dDOp2pPm6c/видео.html
+StudentCompanionSA www.dropbox.com/s/pkmovudkxcmh0wr/docs.png?dl=0 This is a screenshot of my docs folder. There are only 3 PDFs in there and nothing about Peripheral Libraries. Were they supposed to be installed when I installed XC8 or do I need to install XC18 or something else to get them? I appreciate the help.
+StudentCompanionSA I found the legacy peripheral libraries installer for download from microchip. They seem to be working now but i won't be sure until i have a chip to test with.
Thanks Siva Dass for watching our videos. We are busy recording and soon you'll definitely watch those videos. If you haven't subscribed to this YouTuve Channel, please do so to be notified of new Videos as they are uploaded. Thanks for your suggestions. At the moment you can still find more tutorials at our website like these: Interfacing GSM Modem: www.studentcompanion.co.za/post/Interfacing-GSM-Modem-with-PIC-Microcontroller-XC8 Ethernet Communication with PIC Microcontroller: www.studentcompanion.co.za/post/Ethernet-Communication-with-PIC-Microcontroller Web-base control and monitoring: www.studentcompanion.co.za/post/Web-Based-Control-and-Monitoring-with-PIC-Microcontroller-MikroC and many more!
You must install MPLAB Code Configurator first before you can use it. Watch this video first to learn how to install it: ruclips.net/video/JxSSVtTj_fA/видео.html
I cannot get this working I am using the pic16f690 and using the following connections I am programing with the pickit3 I have meade the following changes #define _XTAL_FREQ 8000000#define RS RC0 #define EN RC1 #define D4 RC2 #define D5 RC3 #define D6 RC4 #define D7 RC5 // BEGIN CONFIG#pragma config FOSC = INTRCCLK // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // MCLR Pin Function Select bit (MCLR pin function is MCLR) #pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled) #pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled) #pragma config BOREN = ON // Brown-out Reset Selection bits (BOR enabled) #pragma config IESO = ON // Internal External Switchover bit (Internal External Switchover mode is enabled) #pragma config FCMEN = ON I am so lost with this it just will not work
+Jaguar paw hi. You can't use this library with PIC16F series. This library works only with PIC18F series. Use the library we used in tutorial 22: ruclips.net/video/4WaB_Lj8FnY/видео.html
It's probably about the XC8 compiler not MPLAB X IDE. What's the PIC and the XC8 version you are using? Newer versions of XC8 don't include the PIC18F peripherals libraries anymore, depending on your version, you might have to install it manually first or use an older supported compiler because from XC8 v2.00 and above it's no longer supported at all. Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
You can't use the PIC18F peripherals libraries with XC8 v2.20. Either install an older version before v2.0 then install the Peripherals Libraries now called legacy peripherals libraries or install the oldest supported version XC v1.34 it will work without installing anything else. Or use v2.20 and a different library like the one shown in the video we shared with you.
Sir the videos are excellent, but I don't know anything about Proteus for simulation. You are using Proteus 8 professional for simulation and i can only download Proteus 8 demo
OK. I tried to compile the code in this class. Downloaded the library lcd and lcd, I used the include, put the two files in the project, but the only thing I can to build is the message: LCD h:46: error: (141) can't open include file ' mcc_generated_files/mcc. h ": No such file or directory make [2]: *** [build/default/production/lcd. p1] Error 1 What remains to be done? Thank you very much for your attention.
+Joao Carlos Agostini hi. Are you talking about this tutorial: ruclips.net/video/JxSSVtTj_fA/видео.html ? This is the tutorial and the process to follow if you are using MCC. On this video, MCC and thise two library files lcd.c and lcd.h were not used but PIC18F peripherals libraries.
Thanks for replying. t's a long story. I was watching this class, when I noticed that there was a #include "lcd h" in your code. I stopped the video, I walked into your site, I saw the library, downloaded it and installed it. I saw the video of the 22 class for a moment only. I saw this video and I finished that copy your code. I tried to compile and gave problem. Downloaded the Peripheral-libraries ... and tried to install it, but he did not find the Interface because the compiler it's not installed on C:\, but on another hd in H:\, but even directing it to the H: he does not recognize the Interface. So, just be able to "run" this program if I have Peripheral installed?
+Joao Carlos Agostini yes if you install the peripherals libraries you can run this program. Before the peripherals libraries used yo be included into XC8 compiler but from version 1.35 and later you'll have yo download them separately and they are now called Legacy libraries. They won't be updated anymore and might not support new PIC because Microchip wants people to use ghe new MCC.
OK. Thanks a lot. I will try to use MCC. I don't wish to change the settings on my PC because of this program ...Peripherals. You are doing a great job.
Here is a video showing how to program a PIC, it doesn't matter which PIC model you are using, the procedure will be the same. The difference will depend on the type of programmer used: ruclips.net/video/mg6WkaN-u8w/видео.html
Sir, I typed the code but there is error as putrsXLCD,Delay1KTCYx,etc functions are not declared I also install the peripheral libraries But I didn't found option in X IDE v5.35 to add this Libraries And also the port pin declaration used for Proteus simulation is not there Then how this code work on Proteus
Hi. Which PIC are you using? What is the version of your XC8 compiler? Please note from XC8 v2.0 the peripheral libraries are no longer supported, even if you install them they won't work. Either download an older XC8 compiler or use MCC. Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
Sir, actually I have previously used Mikroc. When I used lcd_init function I didn't needed to create a function for lcd_init. Here I need to create a function for init_XLCD. That means I can use any name instead of init_XLCD. Then actually what "pic 18 peripheral library" is doing?
You are right but this is not like mikroc. The advantages of mikroC it's easy to use with plenty hardware and software libraries. The disadvantages of mikroC is that their libraries are sealed, you can't modify it, you can't extend it and sometimes it restrict your options unlike MPLAB XC8. You can accomplish more once you understand it
Nurzul Healme Hi, The default LCD connection is on PORTB using the LCD library, so you don't have to define PORTB. This library is called xlcd.h it define the connections of the LCD. If you want to connect your LCD on a different PORT other than PORTB, then you should modify it accordingly. You can access this xlcd.h file in your XC8 compiler installation folder in this directory: ...Microchip/xc8/v1.34/include/plib Note: v1.34 is your XC8 version
Unfortunately you can't use the PIC18F peripherals libraries that was used in this video with new versions of XC8 compiler from v2.x.x. You will have to use an older version for it to work or use a different library. Watch this video we explained you can overcome that problem: ruclips.net/video/4WaB_Lj8FnY/видео.html
i didnot understand the concept of "LCD.h" header file do we download this file or it comes with the compiler and al we need to do is specify it ? by wrting #include
It used to come with the compiler with the PIC18F peripheral libraries. A set of libraries for PIC18F series peripherals like SPI, ADC, I2C etc. Now this library has been discontinued in favour of MPLAB Code Configurator.
if our compiler version is new and we download the peripheral library, then do we have to use MPLAB Code Configurator or will it work with normal mplab ide? cause i watched video 22, downloaded and installed the peripheral libraries, added the lcd_libraries and all and even the red underlines all disappeared but it still gives error 2 when i build it. is it because i'm not using MPLAB Code Configurator?
What are those 2 errors? Can you post your project in the forum? We will build your project and see if we can recreate those errors. Forum: www.studentcompanion.co.za/forums/
+Rolando Aguilera hi. Thanks for watching our videos. The lcd.h file is a library file. It has the declarations and functions to access and control the lcd instead of you writing your own functions.
Awesome you have constant feedback with the viewers! Thank you so much! I'm trying to understand the 14 Nop + a return statement(2 cycles) = 16cycles, but the function requires 18 cycles delays. Iam missing something I know...
Nevermind my last comment, I aleady found my fool mistake. Also I realized to didn't use the LCD.h header file, since you use the XC8 compiler defined functions, right?
+Rolando Aguilera when a return function is used, a BRA statement branches to the end of the function where a RETURN 0 is executed from the function , this adding 2 more cycles
hi please, i tried to initialize the LCD as 4 bit mode by using ( OpenXLCD( FOUR_BIT & LINES_5X7 ); ) but i got error at building by the way i am using pic18f877A thanks in advanc
Hi Did you include the #include to include the LCD library? what kind of error message you are getting? It's easier to figure out if we can know the kind of errors you are getting.
Hossam Hassan Hi, I don't understand your question, can you elaborate more? What account? If you want to write to us, please send your mail to: info@studentcompanion.co.za or send us a message on facebook.com/StudentCompanion
please another question... you said if RS is given logic 1, D0-D7 becomes data, and if given logic 0 they become commands and also the E pin must be given 1 to work on LCD. but in the above code didn't specify if RS and E was given 1 or 0 . my question is what gives this RS logic 1 in your code and also the enable (E) pin as well.. because i thought they were going to be specified, please explain.
+Temitayo Abel that's why you are using lcd libraries. If you open those library files lcd.h and lcd.c you'll see how the commands are executed. All those functions like to initialize lcd or send characters the pins RS, E and data pins are manipulated in the background. You can also control the lcd yourself without a library just the same way you are controlling an LED or you can write your own library then you'll use those pins.
+Temitayo Abel depends on what you want to do. It's a bit complex. You need to read your datasheets very well first. I'll suggest you learn the basics first then think of libraries later.
Hello, I am learning how to use the lcd display but when I compile your program I ve got errors do you think I need to domnload a librairy to make it work? Thank you for your tutorials!
@@StudentCompanion I use the program I downloaded on your website, the PIC is 18f2620, my compiler version is 2.10. I can compile some programs but I think Something is missing because for example I don t the pdf with peripheral librairies. Thank you for your help!
It won't work with xc8 v2. You will need to install the peripheral libraries. It's now called legacy peripheral libraries. But you will have to install an earlier version of XC8. V1.45 or earlier. From xc8 v2.0 the peripheral libraries are mo longer supported.
I downloaded the 1.45 and the 1.34 version of xc8, I installed the peripheral librairies in both files. I linked it in the properties. I still doesn t work. I don t know what else I can do. I created a new project with a pic 18f4550, I defined the 1.45 version and I copied your code.
If you are using v1.34 or earlier, the libraries are included in the compiler. You can use them as explained in this tutorial. But from v1.35, they are no longer included. You must download them separately from microchip website at the same place you downloaded your XC8 compiler. They are now called Legacy peripherals libraries and you must install them into your XC8 compiler. If you don't want to install them, there are other lcd libraries that you can use. Please watch this video it explain how to download the PIC18F peripheral libraries and install them and also how to use another lcd library which is easy to use especially if you're gonna use MCC: ruclips.net/video/4WaB_Lj8FnY/видео.html
why does it highlight those codes , cause it does same with mine and doesn't allow the code to be compiled it shows error all the time, please any explanation to that or probably a solution?
+Temitayo Abel The problem is because you are using XC8 version 1.41. From version 0.45 XC8 compiler does not include the PIC18F peripherals libraries which contains the lcd library. You need to download this library separately and install it into your compiler. They are now called Legacy libraries. Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
If am I using the peripheral libraries for pic18f I need to put the archives 'delay.h' and 'xlcd.h' on headers files? And always I change the 'ROM Ranges' on 'memory model' in the 'xc8 linker' on the program for 010-7FF, Orders by teacher, but If i put the '010-7ff' appears a error : "Delay... Is never called' why this happens? Thank u for ur attention
Student Companion "main.c: 121: warning: (520) function" _DelayXLCD "is never called : 0: error: (500) undefined symbols: __mediumconst (dist / default / production \ test.X.production.obj) __smallconst (dist / default / production \ teste.X.production.obj) make [2]: *** [dist / default / production / teste.X.production.hex] Error 1 make [1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 (908) exit status = 1 nbproject / Makefile-default.mk: 131: recipe for target 'dist / default / production / teste.X.production.hex' failed make [2]: Leaving directory 'C: /Users/SARAH/Desktop//PROJECTS/teste.X' nbproject / Makefile-default.mk: 90: recipe for target '.build-conf' failed make [1]: Leaving directory 'C: /Users/SARAH/PROJECTS/teste.X' nbproject / Makefile-impl.mk: 39: recipe for target '.build-impl' failed BUILD FAILED (exit value 2, total time: 2s) " This message appears, but only when I put "010-7ff" in "properties-> xc8 linker -> memory model-> ROM RANGES" if I do not put such a parameter (010-7ff "compiles normally. put such thing so as not to erase the bootloader. and a question, if I am linking the "peripheral libraries" do I need to put the "xlcd.h" and "delays.h" files in the "header files"?
I am not sure about the "010-7ff". If you link the peripheral libraries, there is no need to include "xlcd.h" and "delay.h". The code will still compile without errors. But if you use an lcd on a different PORT beside the default PORTB, you'll have to recompile the lcd library files.
Now my program is working like a dream using peripheral libraries, now please tell me how to check against which pins of microcontroller which pin of LCD to connect.
The default connection of the lcd is on PORTB. To learn more of individual pins or to connect your lcd to a different PORT, please watch this video: ruclips.net/video/RkDN2GW_SxU/видео.html
I have tried my best to find the error but I couldn't find it but became worst, this time around it can't display any thing again but the display is ON
The lcd.h file is the configuration bits header file. It's not the lcd library file. We could have named it any name it wouldn't make a difference. Please watch our tutorial 1 to understand about configuration bits: ruclips.net/video/mUofSucHx_E/видео.html
I watched the video now 5 times but cannot see what my misstake is. I have got the following problem: When compiling an error occurs.... it says: DelayFor18TCY and DelayXLCD are never called it also says conversion to a shorter data type and refers to the OpenXLCD line Thank you in advance
Hi. It's now called Legacy peripherals libraries you can download it from microchip website at the same location you downloaded the XC8 compiler. And install it into your compiler. Please watch this video to learn more how to download it and link it and also how to use another simpler lcd library: ruclips.net/video/4WaB_Lj8FnY/видео.html
hello, thank you for your disponibility... i am wondering if u can help me with an another problem.. i did what u said to me ..then i changed some names of the function to my main C code to make compatible the functions in both the source code and the library.. now i have a problem in : #include "mcc_generated_files/mcc.h" when I am trying to build the problem is : lcd.h:46: error: (141) can't open include file "mcc_generated_files/mcc.h": No such file or directory I will be glad if u can give me some aadvice to solve it. thank u so much for your precious time :)
and configuration I set the same in mikro c and it works in mikro c, but I wanna try it in mplab bcoz I don't have full version of mikro c. Sir could u please help?
Which libraries? If you are talking about PIC18F peripheral libraries used in this video, they are no longer installed by default with your XC8 compiler in recent versions. Actually since v1.35. They are now callef Legacy peripherals libraries. You must download them separately from microchip website at the same place you downloaded your XC8 compiler. Install these libraries into your XC8 compiler installation folder.
As Microchip is phasing out The peripheral libraries and no longer included in new versions of compilers, it's not advisable to use them with new designs. If you are designing using a new PIC model, try to ise MPLAB Code Configurator. It's easy to use and it generate library codes for your peripherals. Watch this video to learn more: ruclips.net/video/JxSSVtTj_fA/видео.html
if we were going to write a function with 14 Nop()s then what's the meaning of DelayFor18TCY? i mean we wrote a function, we can name it anything we want can't we? shouldn't that delay code make our life easier?
I guess you can but the problem this DelayFor18TCY is used by many other other functions. So renaming it will affect other functions that will need it.
In programming you are not obliged to stick to what is given to you. These are library functions are there to guide you. You can rewrite them or write your own tk fit your purpose.
+Jayesh kumar p r if there is black squares than the problem is the contrast of the lcd. Turn the potentiometer connected to the lcd in both direction until it display some characters
Which component you are looking for? Yoi are talking about contrast input, this won't have any effect in simulation but only in hardware because it adjust the contrast of the characters displayed on the lcd. The contrast is to adjust the blackness of the characters, increase it or decrease it to be light
You can download it from the same place as XC8 compilers. From this link under compiler Downlod Tab, scroll down and you will see PIC18F legacy peripherals libraries: www.microchip.com/mplab/compilers
Hi Student Companion. I am writing a code for LCD with PIC18F4550. I was successful with 8 bit interface using internal oscillator. However I am not receiving anything on my LCD if I am using 4 bit interface with external oscillator. I think it is highly likely that I am not able to define external oscillator in my code. Could it be possible for you to share code snippet for using external oscillator? My compiler is XC8
//****MAIN FUNCTION**** void main(void) { //OSCCON = 0x72; //Configuring OSCON Register to use internal Oscillator. float current = 1, voltage = 3.13 ; char buf[30]; sprintf (buf, "PV: %0.2fV %0.2fA", voltage, current); // text[] = "3.13"; DelayPORXLCD(); //15 ms delay after VDD>4.5V LCD_init(); //Initialise LCD DelayXLCD(); //5ms delay SetDDRamAddr(0x80); putrsXLCD(buf); SetDDRamAddr(0x01); // To clear LCD display (without this in ISIS 2nd line command doesn't work) SetDDRamAddr(0xC0); //Shift cursor to beginning of 2nd line sprintf (buf, "H %f", current); putrsXLCD(buf); while (1); return; } //*****xLCD.h***** #define LCD_PORT PORTD //LCD_PORT defines the port to which the LCD data lines are connected #define TRIS_LCD_PORT TRISD /* CTRL_PORT defines the port where the control lines are connected. * These are just samples, change to match your application. */ #define RW_PIN LATCbits.LATC1 /* PORT for RW */ #define TRIS_RW TRISCbits.TRISC1 /* TRIS for RW */ #define RS_PIN LATCbits.LATC0 /* PORT for RS */ #define TRIS_RS TRISCbits.TRISC0 /* TRIS for RS */ #define E_PIN LATCbits.LATC2 /* PORT for D */ #define TRIS_E TRISCbits.TRISC2 /* TRIS for E */
Hello I am getting an error while compiling the code :0:: error: (499) undefined symbol: _BusyXLCD(dist/default/production\ADC_Test_-1_22-9-18.X.production.o) I have checked in the library to verify that im not doing a syntax error please help me with it
The new compiler XC8 v2 doesn't support the peripheral libraries anymore. Either use MPLAB Code Configurator as explained in this video: ruclips.net/video/4WaB_Lj8FnY/видео.html or download an earlier version of XC8 v1xx and link in the peripheral libraries.
Microchip is basically discontinuing the peripheral libraries. It's never advisable to start a new project with an old discontinued tool. You'll face problems in the future. It's still there just to support old existing projects.
dude u told me code configurator doesnot work with not old model but in ur site u say pic16f and pic18f are programmable with code configurator i am so confused
Confuse by what? PIC16 and PIC18 has got nothing to do with old or new, there are new device models of PIC16F, PIC18F even PIC10F and PIC1F in these series. The MCC release note has a list of all supported devices
+Enrique Benalcázar if you don't find any library files you may download and install the legacy PIC18 peripheral libraries. they have removed them in version 1.35. they want people to use the code configurator.
+Enrique Benalcázar on this link: www.microchip.com/pagehandler/en-us/devtools/mplabxc/home.html Under Download, click on PIC18F Legacy Peripheral Libraries v1.0 - Windows if you are using a Windows computer.
Hi sir, i found the error: main.c:115: warning: (520) function "_DelayFor18TCY" is never called main.c:124: warning: (520) function "_DelayPORXLCD" is never called main.c:138: warning: (520) function "_DelayXLCD" is never called, how can I resolve?
You must download it separately and install it into your compiler if you are Using a new XC8 compil2. The peripheral libraries are no longer included in XC8 compiler installation since version 1.34.
when I click on MCC , shows me a warning message, "the projects device is not supported by the currently loaded libraries. all library versions are avaliable for download on the MCC website", so i tried compiled, and so I tried to compile anyway, and it did not appear as an error, just a warning that only the DelayXLCD function had not been called. so I recorded on the PIC 18F4550, and the characters are blank, I sent the message "hello world" and it showed me 00_oo
Watch these 2 videos: 1. LCD connected to any PORT: ruclips.net/video/RkDN2GW_SxU/видео.html 2. ADC and LCD with MCC: ruclips.net/video/4WaB_Lj8FnY/видео.html
why are there so many red underlines? i wrote the same codes (except of course the header file, i included my own header file) but it gives 2 errors :(
Hi. We can't really guess what could be wrong without more information. Which PIC are you using? What version of XC8 compiler you are using? What are those 2 errors saying?
well the red underlines are exactly in the same places as in the video. and when i build it, at the end it says in red lines: "make[2]: *** [build/default/production/my_mplab_project.p1] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 BUİLD FAILED (exit value 2, total time: 2s)" i've followed the tutorial from the beginning and done exactly the same, PIC18F2220 and all. the compiler version is v4.15 why are the codes in the video underlined red at all? they work with you :/
Well. Red underline are not necessarily errors. There might be many reasons for that but what i have observed if you did not specify explicitly the libraries used, it will underline those codes. Like for example we did not include xlcd.h and adc.h in this video. But when you build the code it will get all the required libraries that's why it won't generate errors. In your case it does not find those libraries that's why I think it generating errors. The reason because you are using a newer XC8 compiler. PIC18F peripheral libraries are no longer included in new versions of XC8 compilers from version 1.35. You must now download them separately and install them into your compiler and they are now called Legacy peripherals libraries.
V4.15 is not the compiler version, this is MPLAB X IDE version. This is just the editor not the compiler. The compiler works in the background. That's the version that I need.
Microchip wants people to use MPLAB Code Configurator now for new designs because they are no longer supporting the peripheral libraries. Watch this video to learn how to download the peripheral libraries and link them into your compiler. And also how to use MPLAB Code Configurator for ADC and LCD: ruclips.net/video/4WaB_Lj8FnY/видео.html
@@abubakarabbas9384 can you copy the full build log and paste it here so I can see the full error message. What isbthe PIC you are using? What is the version of your XC8 compiler?
@@StudentCompanion sir i am using mplab xide and xc8 sir the issue is when the f1 is pressed and search the lcd function then where writethat use these function to include the header file but in your code i cannot see any header file. this is my problem i cantot find any xlcd header file
+Aay zee Yuo can use the same code but because the PIC is different, you must set correctly the configuration bits according to this PIC. Watch our tutorial 1 to learn how to set configuration bits correctly.
+Student Companion SA If you are using XC8 compiler from version 1.35 to up, the project might complain about the peripheral library which is no longer included in XC8 compiler, you'll have to download it separately and install it into your compiler. watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html or you can learn more from this page: www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
No. We don't provide tutorial support in private messages on WhatsApp. Ask all your questions here. Another person can benefit from your question by just reading them as see the proposed solution instead on discussing in private.
Hi Can I please get some help from you in understanding a few things from this project? I mean can we have a little chat please? I need to ask a few things from you
+Gray Fox for you to understand the lcd library you'll need to understand the datasheet first as nothing will make sense to you. The datasheet explain how the module work and how to send instructions
If you found this video useful, please give it a thumbs up 👍 and subscribe to the channel. Also, let me know what topics you want me to cover in future videos by commenting below.
By simply liking the video or a short comment like Thanks, helps this video in RUclips algorithm to be found by others. It helps us a lot.
Thank You for the Tutorials, they have been great. This one will take some time to debug if you are using XC8 1.35, but that is good experience.
+Terry Child Indeed. From XC8 v1.35, the PIC18F Peripheral Libraries are no longer included which includes the LCD library. You can either install them as a separate download file (in XC8 Compiler downloads page on microchip website, they are now called Legacy Peripheral Libraries) or you can write your own LCD library.
Travail bien fait. Thank you so much student companion. i'm a student from Tshwane university of technology and I learn good stuffs from your videos. grand merci!
Thank you very much for watching our videos and for your feedback. Merci pareillement.
Wow. Fantastic tutorial. Well explained. I needed a refresher as it's been years since I last used an one of these. This hit all of the marks! Thank you, and great work.
Thank you for your feedback.
Please watch this video too to learn how to use the new library as the Peripheral Libraries used in this tutorial the time we recoreded it some few years ago is being phased out in favor of MPLAB Code Configurator: ruclips.net/video/4WaB_Lj8FnY/видео.html
@@StudentCompanion wow thanks for the tip. That should save me some time figuring that out. Appreciate you taking the time to give me the heads up!
You are welcome!
Sir, May i know please what are DelayFor18TCY, DelayPORXLCD and DelayXLCD? Where we used these delay in program? We didn't call these function in Main Program.
In our circuit RS and E we connected to RB5 and RB6. But we didn't mention anything about where we are Applying High to these PIN. If we are choosing different PIN where should have to change in our Program.
+Shuhaib K.A. Hi, The delays DelayFor18TCY, DelayPORXLCD and DelayXLCD are used by the OpenXLCD() and other LCD functions. You don't call them in your main program, but they are used by the OpenXLCD() to initialize the LCD according to its datasheet. Some delays are required when switching ON the lcd and when some other commands are performed.
We didn't specify where you connect the pins RS and E because we used the default connections which is defined in the xlcd.h file. By default the RS and E should be connected to pins RB5 and RB4. If you need to change the default connections, you'll have to modify this xlcd.h file. Watch our tutorial 17 to learn how to connect your LCD to any PORT or to different pins: ruclips.net/video/RkDN2GW_SxU/видео.html
There is also a simpler LCD library you can use, it does not have all those delays and it has only 2 files, you can learn more from our website: www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
+StudentCompanionSA Thank you sir.
Shuhaib K.A. You are welcome!
Is there any need of extra circuit means pull up resistor or any other component when this circuit is implemented on PCB.Because my circuit work well on Bread board but it gives default value when implemented on PCB.
+Aqeel Ahmed HI. If it works well on breadboard then it should work very well on PCB. There must be something else you are not doing well or omitting on PCB
thanks for your valuble response .
so i should add lcd libraries...... .
but where the delay functions are called in main pgm ???????//
+Akhil Mohanrj Yes you will have to add the lcd libraries. If you watch the full video, you'll see the lcd delay functions.
very nice tutorial but i have an error on putrsXLCD i am using xc8 compiler version 2.10 and mplabx v5.6 , can you help me . Have any change in header file.
Thanks for the Video.. How much you can write on XC8 Demo Version? im afraid to beggin in this compiler C of Microchip because if my skills improve in time i wont have money to purchase the professional version, so do you think is better to program in CCS or Mikrotik instead a pay program compiler like XC8?
tiwar87 , there is no code limit on the XC8 demo version, you can write a code as big as you want, the only difference is the optimization of the generated code, with free version, there is no optimization so the generated HEX file might be a little bigger than if you used a professional version.
Depending on other compilers, it's up to you. You can try them and decide yourself, but you must remember that the XC8 is the manufacture compiler with a wide range of application libraries.
StudentCompanionSA Thnks for the info and advices Sir. Very useful, thnks a lot
You are welcome!
You are welcome!
Thank you for that tutorial. I am beginner in microcontroller technology but this tutorial opened my eyes further.
Thank you LEWIS ASILEVI
Thanks you. In my Software it will take 15 Sec delay to display after Run the simulation. How can i reduce this delay?
they might be many reasons. if this delay is only noticeable when you start your simulation and everything goes smoothly thereafter, it might be that your PC is slow as Proteus requires some resources from your PC. If you download the code into the actual PIC, you won't see that delay we believe.
+StudentCompanionSA thanks for your replay sir.
+Shuhaib K.A. you are welcome!
I always come back here to revive my passion for PICs microcontroller, your videos are a fantastic legacy for us. I'm using PIC16F/627/628/648/877 and none of them is working with your code, my question is, is there a library for LCD for PIC16F similar to what you're using? Merci pour votre reponse.
I have followed the tutorial but the code such as putrsXLCD are not identified... so an error make[2] error
+Solomon Kojah did you watch those 2 videos? What is the version of your compiler?
sir, you have not use delay in program.then why you make the delay functions
+NAVENDU SHEKHAR they are used by the xlcd.h library.
Hello. Thanks for the tutorial. I would like to ask you were is the lcd library in MPLAB X v3.45. I´m using XC8 but i can´t find the lcd library. Do I need to download it?.
+Rodrigo Noriega hi. Thanks for watching our videos. I you talking about the lcd library as in tutorial 22: ruclips.net/video/4WaB_Lj8FnY/видео.html
+Student Companion SA you can download it on our website. But if you are talking about this tutorial 5, it's PIC18F peripherals libraries. From xc8 compiler version 1.35 and later you have to download it separately. Watch tutorial 22 to see where to download it and activate it
My program compiles successfully, but I get " function DelayXLCD is never called". Do you know exactly where this function is called in the program. I do not see it in the openxlcd source file.
Hi. If you remove it I am sure it won't compile again. DelayXLCD is used in xlcd.h header file. Almost at the bottom of the file, you'll see: extern void DelayXLCD(void);
If you navigate to declaration/definition of OpenXLCD, it will take you to xlcd.h header file.
Hi, so how do I know which Port to use to connect the PIC to the LCD? Is there a code that I can write to configure that specific port to work with the LCD. And why does the LCD need delays in order for it to work?
Thapelo Masilo Hi, The default LCD connection is on PORTB using the LCD library, so you don't have to define PORTB. This library is called xlcd.h it define the connections of the LCD. If you want to connect your LCD on a different PORT other than PORTB, then you should modify it accordingly.
You can access this xlcd.h file in your XC8 compiler installation folder in this directory:
...Microchip/xc8/v1.34/include/plib
Note: v1.34 is your XC8 version.
The xlcd.h library needs those delays.
StudentCompanionSA OK, thanks. And about the delays? Why are they important?
Thapelo Masilo As we have said it earlier, the LCD Library (xlcd.h) needs those delays to control the LCD. If you don't include them, your code won't work.
If you want, you can address the LCD directly without using the LCD Library or you can write your own library but, you'll have to understand the internal working of the LCD.
StudentCompanionSA Thank you. It worked. I only had to enable the LCD by sending a 1 to the Enable pin. So the main function looks like this
void main (void)
{
LATBbits.LATB4 =1;//I included this command to enable the LCD
init_XLCD();
putrsXLCD ("StudentCompanion");
SetDDRamAddr (0x40);
putrsXLCD ("LCD Display");
while (1)
{
}
}
Thapelo Masilo Watch this video to learn how to connect LCD to another PORT beside PORTB:
ruclips.net/video/RkDN2GW_SxU/видео.html
Thank you very much for your tutorial. It's really useful. But I don't understand why the frequency is 8Mhz so the instruction cycle time is 1.5us. Can you help me understand that.
Hi Bi Na with a clock of 8MHz, the instruction time will be 0.5μs not 1.5μs.
In PIC microcontrollers, an instruction cycle takes four clock periods, the microcontroller actually operates at a clock rate, which is a quarter of the actual oscillator frequency. For example, in a PIC microcontroller operating at 4-MHz clock, the instruction cycle time is only 1 μs (frequency of 1 MHz).
For 8MHz, the time will be 0.5μs
StudentCompanionSA Thank you very much, I fully understand of that but in the DelayFor18TCY, which you want to delay 18 cycle but I just see 14 Nop(). I don't understand of that.
Bi Na You can use the normal delay function or use the nop() function to generate the delay as we explained in the video. if you follow well the video you will understand.
my friend.. do you have any tutorial with CAN communication??
not at the moment.
thanks for the answer :)
+Enrique Benalcázar you are welcome!
sir,
thanks for this step by step explanation.
i performed same code but my compiler gives an error on Delay1KTCYx(30); command
it gives error
newmain.c:31: warning: (361) function declared implicit int
i could not understand the reason of this error
They must be something you are missing out. Which version of the compiler you are using?
I'm having a heck of a time implementing I2C with a 16F1508. I've tried so many different things with no luck. I considered moving to PIC18 family but plib is not installed on my system. I have no plib folder in include and there is no documentation for it in the docs folder. I don't suppose you'd consider doing an I2C tutorial for the PIC16 family would you?
hi. if you are considering PIC18 it ia very easy to implement especially if you using the library. They have to be a library help document unless you are looking on a wrong installation folder. check our tutorial 6 (ADC) or 14 (rs232) to learn how to using the library help document. we have an I2C tutorial on our website. check for it on www.studentcompanion.co.za
I've looked in every folder relating to XC8 and MPLABX. There's no mention of plib anywhere. :/
+KubuntuYou The library help file is called: MPLAB_XC8_Peripheral_Libraries and is located in the docs folder in XC8 installation folder. It is not in lib folder. Check out this tutorial, we clearly show you where to find it and how to use this document: ruclips.net/video/8dDOp2pPm6c/видео.html
+StudentCompanionSA www.dropbox.com/s/pkmovudkxcmh0wr/docs.png?dl=0 This is a screenshot of my docs folder. There are only 3 PDFs in there and nothing about Peripheral Libraries. Were they supposed to be installed when I installed XC8 or do I need to install XC18 or something else to get them? I appreciate the help.
+StudentCompanionSA I found the legacy peripheral libraries installer for download from microchip. They seem to be working now but i won't be sure until i have a chip to test with.
Great tutorial please make more videos like gsm,Ethernet,RFID etc
Thanks Siva Dass for watching our videos. We are busy recording and soon you'll definitely watch those videos. If you haven't subscribed to this YouTuve Channel, please do so to be notified of new Videos as they are uploaded. Thanks for your suggestions. At the moment you can still find more tutorials at our website like these:
Interfacing GSM Modem: www.studentcompanion.co.za/post/Interfacing-GSM-Modem-with-PIC-Microcontroller-XC8
Ethernet Communication with PIC Microcontroller: www.studentcompanion.co.za/post/Ethernet-Communication-with-PIC-Microcontroller
Web-base control and monitoring: www.studentcompanion.co.za/post/Web-Based-Control-and-Monitoring-with-PIC-Microcontroller-MikroC
and many more!
StudentCompanionSA Thank u and i'm waiting for your tutorials
Great!
Sir I am not getting mplab code configurator in my pc. It is stating that some library files are missing?
You must install MPLAB Code Configurator first before you can use it. Watch this video first to learn how to install it: ruclips.net/video/JxSSVtTj_fA/видео.html
I cannot get this working I am using the pic16f690 and using the following connections
I am programing with the pickit3
I have meade the following changes
#define _XTAL_FREQ 8000000#define RS RC0
#define EN RC1
#define D4 RC2
#define D5 RC3
#define D6 RC4
#define D7 RC5
// BEGIN CONFIG#pragma config FOSC = INTRCCLK // Oscillator Selection bits (INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = ON // MCLR Pin Function Select bit (MCLR pin function is MCLR)
#pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
#pragma config BOREN = ON // Brown-out Reset Selection bits (BOR enabled)
#pragma config IESO = ON // Internal External Switchover bit (Internal External Switchover mode is enabled)
#pragma config FCMEN = ON
I am so lost with this it just will not work
+Jaguar paw hi. You can't use this library with PIC16F series. This library works only with PIC18F series. Use the library we used in tutorial 22: ruclips.net/video/4WaB_Lj8FnY/видео.html
Cannot find lcd function description under the help in mplab 5.4.was function description removed?
It's probably about the XC8 compiler not MPLAB X IDE. What's the PIC and the XC8 version you are using? Newer versions of XC8 don't include the PIC18F peripherals libraries anymore, depending on your version, you might have to install it manually first or use an older supported compiler because from XC8 v2.00 and above it's no longer supported at all.
Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
@@StudentCompanion I'm using pic18f2220 and version 2.20 of XC8
You can't use the PIC18F peripherals libraries with XC8 v2.20.
Either install an older version before v2.0 then install the Peripherals Libraries now called legacy peripherals libraries or install the oldest supported version XC v1.34 it will work without installing anything else.
Or use v2.20 and a different library like the one shown in the video we shared with you.
@@StudentCompanion alright thanks
You are welcome!
Sir the videos are excellent, but I don't know anything about Proteus for simulation. You are using Proteus 8 professional for simulation and i can only download Proteus 8 demo
+piyush singh you must buy the professional version
OK. I tried to compile the code in this class. Downloaded the library lcd and lcd, I used the include, put the two files in the project, but the only thing I can to build is the message:
LCD h:46: error: (141) can't open include file ' mcc_generated_files/mcc. h ": No such file or directory
make [2]: *** [build/default/production/lcd. p1] Error 1
What remains to be done?
Thank you very much for your attention.
+Joao Carlos Agostini hi. Are you talking about this tutorial: ruclips.net/video/JxSSVtTj_fA/видео.html ?
This is the tutorial and the process to follow if you are using MCC. On this video, MCC and thise two library files lcd.c and lcd.h were not used but PIC18F peripherals libraries.
Thanks for replying. t's a long story. I was watching this class, when I noticed that there was a #include "lcd h" in your code. I stopped the video, I walked into your site, I saw the library, downloaded it and installed it. I saw the video of the 22 class for a moment only. I saw this video and I finished that copy your code. I tried to compile and gave problem. Downloaded the Peripheral-libraries ... and tried to install it, but he did not find the Interface because the compiler it's not installed on C:\, but on another hd in H:\, but even directing it to the H: he does not recognize the Interface. So, just be able to "run" this program if I have Peripheral installed?
+Joao Carlos Agostini yes if you install the peripherals libraries you can run this program. Before the peripherals libraries used yo be included into XC8 compiler but from version 1.35 and later you'll have yo download them separately and they are now called Legacy libraries. They won't be updated anymore and might not support new PIC because Microchip wants people to use ghe new MCC.
+Joao Carlos Agostini if you haven't used MCC (Mplab code configurator) before, it's easy : ruclips.net/video/JxSSVtTj_fA/видео.html
OK. Thanks a lot. I will try to use MCC. I don't wish to change the settings on my PC because of this program ...Peripherals. You are doing a great job.
Can you make videos on how to program pic18f45k22
Here is a video showing how to program a PIC, it doesn't matter which PIC model you are using, the procedure will be the same. The difference will depend on the type of programmer used: ruclips.net/video/mg6WkaN-u8w/видео.html
Sir, I typed the code but there is error as putrsXLCD,Delay1KTCYx,etc functions are not declared
I also install the peripheral libraries
But I didn't found option in X IDE v5.35 to add this Libraries
And also the port pin declaration used for Proteus simulation is not there
Then how this code work on Proteus
Hi. Which PIC are you using? What is the version of your XC8 compiler? Please note from XC8 v2.0 the peripheral libraries are no longer supported, even if you install them they won't work. Either download an older XC8 compiler or use MCC. Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
Sir, actually I have previously used Mikroc. When I used lcd_init function I didn't needed to create a function for lcd_init. Here I need to create a function for init_XLCD. That means I can use any name instead of init_XLCD. Then actually what "pic 18 peripheral library" is doing?
Even with mikroC you have to initialize it witk Lcd_Init()
Student Companion yes, but I don't need to creat function like 'void lcd_init ()'.
You are right but this is not like mikroc. The advantages of mikroC it's easy to use with plenty hardware and software libraries. The disadvantages of mikroC is that their libraries are sealed, you can't modify it, you can't extend it and sometimes it restrict your options unlike MPLAB XC8. You can accomplish more once you understand it
Hallo Sir.. Thank for the tutorial..
Where statement to define port B ..
and how to choose other PORT..
TQ
Nurzul Healme Hi, The default LCD connection is on PORTB using the LCD library, so you don't have to define PORTB. This library is called xlcd.h it define the connections of the LCD. If you want to connect your LCD on a different PORT other than PORTB, then you should modify it accordingly.
You can access this xlcd.h file in your XC8 compiler installation folder in this directory:
...Microchip/xc8/v1.34/include/plib
Note: v1.34 is your XC8 version
Ok ..Thank for quick reply . :)
Nurzul Healme you are welcome!
Nurzul Healme Watch this video to learn how to connect LCD to another PORT beside PORTB:
ruclips.net/video/RkDN2GW_SxU/видео.html
Thank man.. :).. i try this .
Hello Sir, where can i download the Lcd libraries so that this example would work?
Hi. Which PIC are you using? What is the version of your xc8 compiler?
@@StudentCompanion PIC18F26K20 (the same in this video) xc8 compiler is v2.10
Unfortunately you can't use the PIC18F peripherals libraries that was used in this video with new versions of XC8 compiler from v2.x.x.
You will have to use an older version for it to work or use a different library.
Watch this video we explained you can overcome that problem: ruclips.net/video/4WaB_Lj8FnY/видео.html
Thank you very much.
You are Welcome!
I have xc8 1.30. I think it has peripheral libraries in it?. I checked it with the pic that ur using but still same error.
are you referring to Mplab ide version or xc8?
+Student Companion SA referring to compiler. I am using mplab idea 2.05.
+Aay zee then I guess it shouldn't be the problem with peripherals libraries. send us the screen shot of your errors so we can have a look at them
+Student Companion SA wait
Thanks for the totorials, they are awesome, geetings from mexico.
Thanks. we appreciate your feedback.
From where we have to include "LCD.h" file
I also have question like that so by the way can you include that library? Please show me 🙏
i didnot understand the concept of "LCD.h" header file do we download this file or it comes with the compiler and al we need to do is specify it ? by wrting #include
It used to come with the compiler with the PIC18F peripheral libraries. A set of libraries for PIC18F series peripherals like SPI, ADC, I2C etc. Now this library has been discontinued in favour of MPLAB Code Configurator.
Watch this video to understand more: ruclips.net/video/JxSSVtTj_fA/видео.html
And this video for LCD using new tools and library: ruclips.net/video/4WaB_Lj8FnY/видео.html
@@StudentCompanion ty so much u are the best
Thanks for your feedback.
if our compiler version is new and we download the peripheral library, then do we have to use MPLAB Code Configurator or will it work with normal mplab ide? cause i watched video 22, downloaded and installed the peripheral libraries, added the lcd_libraries and all and even the red underlines all disappeared but it still gives error 2 when i build it. is it because i'm not using MPLAB Code Configurator?
Did you link the peripheral libraries as explained in video 22?
Student Companion yep did that too :/
What are those 2 errors? Can you post your project in the forum? We will build your project and see if we can recreate those errors. Forum: www.studentcompanion.co.za/forums/
What does the LCD.h header file include? Thanks by the way, amazing tutorial!
+Rolando Aguilera hi. Thanks for watching our videos. The lcd.h file is a library file. It has the declarations and functions to access and control the lcd instead of you writing your own functions.
Awesome you have constant feedback with the viewers! Thank you so much! I'm trying to understand the 14 Nop + a return statement(2 cycles) = 16cycles, but the function requires 18 cycles delays. Iam missing something I know...
Nevermind my last comment, I aleady found my fool mistake. Also I realized to didn't use the LCD.h header file, since you use the XC8 compiler defined functions, right?
+Rolando Aguilera yes.
+Rolando Aguilera when a return function is used, a BRA statement branches to the end of the function where a RETURN 0 is executed from the function , this adding 2 more cycles
hi
please, i tried to initialize the LCD as 4 bit mode by using ( OpenXLCD( FOUR_BIT & LINES_5X7 );
)
but i got error at building
by the way i am using pic18f877A
thanks in advanc
Hi
Did you include the #include to include the LCD library? what kind of error message you are getting? It's easier to figure out if we can know the kind of errors you are getting.
please could i have your account due to i want some thing to check
thanks in advance :)
Hossam Hassan Hi, I don't understand your question, can you elaborate more? What account?
If you want to write to us, please send your mail to: info@studentcompanion.co.za or send us a message on facebook.com/StudentCompanion
thanks
for your interest
please another question... you said if RS is given logic 1, D0-D7 becomes data, and if given logic 0 they become commands and also the E pin must be given 1 to work on LCD. but in the above code didn't specify if RS and E was given 1 or 0 . my question is what gives this RS logic 1 in your code and also the enable (E) pin as well.. because i thought they were going to be specified, please explain.
+Temitayo Abel that's why you are using lcd libraries. If you open those library files lcd.h and lcd.c you'll see how the commands are executed. All those functions like to initialize lcd or send characters the pins RS, E and data pins are manipulated in the background. You can also control the lcd yourself without a library just the same way you are controlling an LED or you can write your own library then you'll use those pins.
wow! didn't know that.. thanks so much sit!
+Temitayo Abel you are welcome!
How do i set up my own library?
+Temitayo Abel depends on what you want to do. It's a bit complex. You need to read your datasheets very well first. I'll suggest you learn the basics first then think of libraries later.
does mplab need lcd libraries to recognize the code
+Solomon Kojah yes.
Hello, I am learning how to use the lcd display but when I compile your program I ve got errors do you think I need to domnload a librairy to make it work?
Thank you for your tutorials!
Possibly. Which PIC model you are using? What is the version of your XC8 compiler?
Can you post the exact errors you are getting?
@@StudentCompanion I use the program I downloaded on your website, the PIC is 18f2620, my compiler version is 2.10. I can compile some programs but I think Something is missing because for example I don t the pdf with peripheral librairies. Thank you for your help!
It won't work with xc8 v2. You will need to install the peripheral libraries. It's now called legacy peripheral libraries. But you will have to install an earlier version of XC8. V1.45 or earlier. From xc8 v2.0 the peripheral libraries are mo longer supported.
Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
I downloaded the 1.45 and the 1.34 version of xc8, I installed the peripheral librairies in both files. I linked it in the properties. I still doesn t work. I don t know what else I can do. I created a new project with a pic 18f4550, I defined the 1.45 version and I copied your code.
Sir, I am using xc8 version 1.45. How can I use lcd library?
If you are using v1.34 or earlier, the libraries are included in the compiler. You can use them as explained in this tutorial. But from v1.35, they are no longer included. You must download them separately from microchip website at the same place you downloaded your XC8 compiler. They are now called Legacy peripherals libraries and you must install them into your XC8 compiler. If you don't want to install them, there are other lcd libraries that you can use. Please watch this video it explain how to download the PIC18F peripheral libraries and install them and also how to use another lcd library which is easy to use especially if you're gonna use MCC: ruclips.net/video/4WaB_Lj8FnY/видео.html
i have an issue with the code. the same code as in the tutorials. just below init_xlcd . i can t compile ,
+Solomon Kojah what is the version of your compiler?
watch this tutorial: ruclips.net/video/JxSSVtTj_fA/видео.html
then this one: ruclips.net/video/4WaB_Lj8FnY/видео.html
mplab x 3.40 xc8 v1.38
let me watch the second one then get to you.
regards
+Solomon Kojah sure.
why does it highlight those codes , cause it does same with mine and doesn't allow the code to be compiled it shows error all the time, please any explanation to that or probably a solution?
+Temitayo Abel which codes you are referring to? What error messages you are getting when you build your project?
your above code... and these are the errors it shows....
"C:\Program Files (x86)\Microchip\xc8\v1.41\bin\xc8.exe" --pass1 --chip=18F2220 -Q -G --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/lcd.p1 lcd.c
lcd.c:23: warning: (361) function declared implicit int
lcd.c:24: warning: (361) function declared implicit int
lcd.c:25: warning: (361) function declared implicit int
lcd.c:34: warning: (361) function declared implicit int
lcd.c:34: error: (192) undefined identifier "FOUR_BIT"
lcd.c:34: error: (192) undefined identifier "LINES_5X7"
lcd.c:35: warning: (361) function declared implicit int
lcd.c:36: warning: (361) function declared implicit int
lcd.c:49: warning: (361) function declared implicit int
lcd.c:53: warning: (361) function declared implicit int
(908) exit status = 1
nbproject/Makefile-default.mk:100: recipe for target 'build/default/production/lcd.p1' failed
make[2]: Leaving directory 'C:/Users/Lekan/MPLABXProjects/lcd.X'
make[2]: *** [build/default/production/lcd.p1] Error 1
make[1]: *** [.build-conf] Error 2
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/Lekan/MPLABXProjects/lcd.X'
make: *** [.build-impl] Error 2
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 8s)
+Temitayo Abel The problem is because you are using XC8 version 1.41. From version 0.45 XC8 compiler does not include the PIC18F peripherals libraries which contains the lcd library. You need to download this library separately and install it into your compiler. They are now called Legacy libraries. Watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
If am I using the peripheral libraries for pic18f I need to put the archives 'delay.h' and 'xlcd.h' on headers files? And always I change the 'ROM Ranges' on 'memory model' in the 'xc8 linker' on the program for 010-7FF, Orders by teacher, but If i put the '010-7ff' appears a error : "Delay... Is never called' why this happens? Thank u for ur attention
Hi. Are you getting errors or warnings?
Student Companion "main.c: 121: warning: (520) function" _DelayXLCD "is never called
: 0: error: (500) undefined symbols:
__mediumconst (dist / default / production \ test.X.production.obj) __smallconst (dist / default / production \ teste.X.production.obj)
make [2]: *** [dist / default / production / teste.X.production.hex] Error 1
make [1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
(908) exit status = 1
nbproject / Makefile-default.mk: 131: recipe for target 'dist / default / production / teste.X.production.hex' failed
make [2]: Leaving directory 'C: /Users/SARAH/Desktop//PROJECTS/teste.X'
nbproject / Makefile-default.mk: 90: recipe for target '.build-conf' failed
make [1]: Leaving directory 'C: /Users/SARAH/PROJECTS/teste.X'
nbproject / Makefile-impl.mk: 39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 2s) "
This message appears, but only when I put "010-7ff" in "properties-> xc8 linker -> memory model-> ROM RANGES" if I do not put such a parameter (010-7ff "compiles normally. put such thing so as not to erase the bootloader.
and a question, if I am linking the "peripheral libraries" do I need to put the "xlcd.h" and "delays.h" files in the "header files"?
I am not sure about the "010-7ff". If you link the peripheral libraries, there is no need to include "xlcd.h" and "delay.h". The code will still compile without errors.
But if you use an lcd on a different PORT beside the default PORTB, you'll have to recompile the lcd library files.
Student Companion thanks
You are welcome!
Great Vid. Thank you
thank you
Now my program is working like a dream using peripheral libraries, now please tell me how to check against which pins of microcontroller which pin of LCD to connect.
Good to hear that it's working now. Can you clarify your question?
Its actually how I would know that which pins of Micro-controller are in use.
The default connection of the lcd is on PORTB. To learn more of individual pins or to connect your lcd to a different PORT, please watch this video: ruclips.net/video/RkDN2GW_SxU/видео.html
Thanks!!! you are a legend :p
You are welcome!
Thank for the video, mine is working but the first character in the first row of tell lcd refused to display
Can you post your code? Are you testing in simulation or hardware?
Am simulating.
Here's the code
#include
#include
#include
#include "xlcd.h"
//#include "delays.h"
#define _XTAL_FREQ 8000000
/*
*
*/
int main(void) {
void init_XLCD(void); //initialize LCD
void DelayFor18TCY(void); //Delay for 18 instruction cycle
void DelayPORXLCD(void); //Delay for 15ms
void DelayXLCD(void); //Delay for 5ms
init_XLCD();
while(BusyXLCD());
SetDDRamAddr(0x00);
putrsXLCD("Welcome");
SetDDRamAddr(0x40);
putrsXLCD("LCD Display");
//WriteCmdXLCD(0x0C);
while(1){
}
}
void init_XLCD(void){
OpenXLCD( FOUR_BIT & LINES_5X7 );
while(BusyXLCD());
WriteCmdXLCD(0x06);
WriteCmdXLCD(0x0F);
}
void DelayFor18TCY(void){
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
Nop(); Nop();
return;
}
void DelayPORXLCD(void){
Delay1KTCYx(30);
}
void DelayXLCD(void){
Delay1KTCYx(10);
}
I have tried my best to find the error but I couldn't find it but became worst, this time around it can't display any thing again but the display is ON
@@miracleobiano1825 Hi, Try to change this function code:
void DelayFor18TCY(void){
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
Nop(); Nop();
return;
}
with:
void DelayFor18TCY(void){
Delay10TCYx920);
}
It's working now, thank you sir.
But my question is why was the previous one not working?
Sir, you've used XLCD.h libraries but you've included lcd.h, I didn't get the point.
The lcd.h file is the configuration bits header file. It's not the lcd library file. We could have named it any name it wouldn't make a difference. Please watch our tutorial 1 to understand about configuration bits: ruclips.net/video/mUofSucHx_E/видео.html
Ok, I thought so. Then how you used those library without including xlcd.h?
If you have installed the PIC18F peripheral libraries, there is no need to explicitly include the xlcd.h .
very good
Great tutorial! Thanks. Keep it.
I watched the video now 5 times but cannot see what my misstake is.
I have got the following problem:
When compiling an error occurs.... it says: DelayFor18TCY and DelayXLCD are never called
it also says conversion to a shorter data type and refers to the OpenXLCD line
Thank you in advance
+Leto ausm Ghetto what PIC Microcontroller are you using? What version of your XC8 compiler are you using?
I already found my misstake
I missspelled DelayFor18TCY
P.S.: Your videos are very helpful for learning to programm thank you
Thank you. We are also pleased that you have resolved it.
how to assign pin pins of MC to LCD
watch our tutorial 17. you'll learn how to do it.
hello, how i can find the lcd library used in this video? thank u so much in advance
Hi. It's now called Legacy peripherals libraries you can download it from microchip website at the same location you downloaded the XC8 compiler. And install it into your compiler. Please watch this video to learn more how to download it and link it and also how to use another simpler lcd library: ruclips.net/video/4WaB_Lj8FnY/видео.html
hello, thank you for your disponibility... i am wondering if u can help me with an another problem.. i did what u said to me ..then i changed some names of the function to my main C code to make compatible the functions in both the source code and the library.. now i have a problem in : #include "mcc_generated_files/mcc.h"
when I am trying to build the problem is : lcd.h:46: error: (141) can't open include file "mcc_generated_files/mcc.h": No such file or directory
I will be glad if u can give me some aadvice to solve it. thank u so much for your precious time :)
Why will you want to rename the functions? Don't complicated things for yourself.
And remember mcc is completely different from the peripheral libraries. They use different libraries.
Student Companion mcc library is cited in the downloaded peripheral libraries from the microchip site as u reccomended 😅
and configuration I set the same in mikro c and it works in mikro c, but I wanna try it in mplab bcoz I don't have full version of mikro c.
Sir could u please help?
send us a full screen shot of your errors so we can have a look at them
+Student Companion SA
this is the code
#include
#include
#include "pic18.h"
void init_XLCD (void);
void DelayFOR18TCY (void);
void DelayPORXLCD (void);
void DelayXLCD (void);
void main(void)
{
init_XLCD();
putrsXLCD("aayzee");
SetDDRamAddr(0x40);
putrsXLCD("Electrical");
while(1)
{
}
}
void init_XLCD (void)
{
OpenXLCD(FOUR_BIT & LINES_5X7);
while(BusyXLCD());
WriteCmdXLCD(0X06);
WriteCmdXLCD(0X0C);
}
void DelayFOR18TCY (void)
{
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
return;
}
void DelayPORXLCD (void)
{
Delay1KTCYx(30);
}
void DelayXLCD (void)
{
Delay1KTCYx(10);
}
+Student Companion SA
errors are:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `C:/Users/Baghdadi/MPLABXProjects/pic.X'
make -f nbproject/Makefile-default.mk dist/default/production/pic.X.production.hex
make[2]: Entering directory `C:/Users/Baghdadi/MPLABXProjects/pic.X'
"C:\Program Files (x86)\Microchip\xc8\v1.30\bin\xc8.exe" --pass1 --chip=18F2620 -Q -G --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -obuild/default/production/pic18f.p1 pic18f.c
"C:\Program Files (x86)\Microchip\xc8\v1.30\bin\xc8.exe" --chip=18F2620 -G -mdist/default/production/pic.X.production.map --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -odist/default/production/pic.X.production.elf build/default/production/pic18f.p1
Microchip MPLAB XC8 C Compiler (Free Mode) V1.30
Copyright (C) 2014 Microchip Technology Inc.
License type: Node Configuration
:: advisory: (1233) Employing 18F2620 errata work-arounds:
:: advisory: (1234) * Corrupted fast interrupt shadow registers
:: advisory: (1234) * Data in RAM location can be corrupted if async. reset occurs during write
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: undefined symbol:
_DelayFor18TCY(dist/default/production\pic.X.production.obj)
make[2]: Leaving directory `C:/Users/Baghdadi/MPLABXProjects/pic.X'
make[1]: Leaving directory `C:/Users/Baghdadi/MPLABXProjects/pic.X'
(908) exit status = 1
make[2]: *** [dist/default/production/pic.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 5s)
did u check?
+Aay zee we checked your project but it's not clear what could be the problem. it could be configuration bits.
Isnt it necessary to add include "XLCD.h" library
Not necessary. The project will still build
Sir from where I can find libraries
Which libraries? If you are talking about PIC18F peripheral libraries used in this video, they are no longer installed by default with your XC8 compiler in recent versions. Actually since v1.35. They are now callef Legacy peripherals libraries. You must download them separately from microchip website at the same place you downloaded your XC8 compiler. Install these libraries into your XC8 compiler installation folder.
As Microchip is phasing out The peripheral libraries and no longer included in new versions of compilers, it's not advisable to use them with new designs. If you are designing using a new PIC model, try to ise MPLAB Code Configurator. It's easy to use and it generate library codes for your peripherals. Watch this video to learn more: ruclips.net/video/JxSSVtTj_fA/видео.html
You can also use other LCD libraries like the one used in this video: ruclips.net/video/4WaB_Lj8FnY/видео.html
you are the king!
Thanks for watching our videos and for your feedback.
if we were going to write a function with 14 Nop()s then what's the meaning of DelayFor18TCY? i mean we wrote a function, we can name it anything we want can't we? shouldn't that delay code make our life easier?
I guess you can but the problem this DelayFor18TCY is used by many other other functions. So renaming it will affect other functions that will need it.
In programming you are not obliged to stick to what is given to you. These are library functions are there to guide you. You can rewrite them or write your own tk fit your purpose.
hi sir, i successfully built the program, but the lcd does nt work. what need to be checked, ?
+Jayesh kumar p r what do you mean it doesn't work? Does it display anything? Does it display black squares? Is the lcd back light on?
the back light is on and there is black squares.
+Jayesh kumar p r if there is black squares than the problem is the contrast of the lcd. Turn the potentiometer connected to the lcd in both direction until it display some characters
HI SIR ,i adjusted the potentiometer ,when i adjust it it slowly disapper. it does nt shows any word. only black squares
+Jayesh kumar p r uplaod your code and a sketch of your circuit diagram in the Forum . We will have a look at it.
guys what is contrastpin code in proteus help me pls and great videos dude ty alot
Hi. Your question is not clear. Please explain what do you mean by code in proteus?
@@StudentCompanion I mean when u search for a component you look for it
Which component you are looking for? Yoi are talking about contrast input, this won't have any effect in simulation but only in hardware because it adjust the contrast of the characters displayed on the lcd. The contrast is to adjust the blackness of the characters, increase it or decrease it to be light
So far I can't understand your question
THANKS A LOT !
+rohit singh you are welcome!
I can't see any download link for legacy peripherals on the microchip website
You can download it from the same place as XC8 compilers. From this link under compiler Downlod Tab, scroll down and you will see PIC18F legacy peripherals libraries:
www.microchip.com/mplab/compilers
The beginning of this video also shows you how to download it: ruclips.net/video/4WaB_Lj8FnY/видео.html
@@StudentCompanion seen it thank you
You are welcome!
So i installed it in the xc8 folder but I'm still getting errors in the code and a failed build
from where to download heder file for lcd
Read more at: www.studentcompanion.net/en/interfacing-lcd-display-with-pic-microcontroller-xc8/
Can you explain the same thing with assembly level language sir?
Unfortunately we don't do Assembly
Hi Student Companion. I am writing a code for LCD with PIC18F4550. I was successful with 8 bit interface using internal oscillator. However I am not receiving anything on my LCD if I am using 4 bit interface with external oscillator. I think it is highly likely that I am not able to define external oscillator in my code. Could it be possible for you to share code snippet for using external oscillator? My compiler is XC8
If you require me to share the whole code I don't mind it. Basically its same as the one is your video abover
+Setsu Tsubasa how are you connecting your lcd? PORTB? Paste your configuration bits code and main code.
+Setsu Tsubasa are you using PIC18F peripherals libraries? Did you install it into your compiler installation folder?
//****MAIN FUNCTION****
void main(void)
{
//OSCCON = 0x72; //Configuring OSCON Register to use internal Oscillator.
float current = 1, voltage = 3.13 ;
char buf[30];
sprintf (buf, "PV: %0.2fV %0.2fA", voltage, current);
// text[] = "3.13";
DelayPORXLCD(); //15 ms delay after VDD>4.5V
LCD_init(); //Initialise LCD
DelayXLCD(); //5ms delay
SetDDRamAddr(0x80);
putrsXLCD(buf);
SetDDRamAddr(0x01); // To clear LCD display (without this in ISIS 2nd line command doesn't work)
SetDDRamAddr(0xC0); //Shift cursor to beginning of 2nd line
sprintf (buf, "H %f", current);
putrsXLCD(buf);
while (1);
return;
}
//*****xLCD.h*****
#define LCD_PORT PORTD //LCD_PORT defines the port to which the LCD data lines are connected
#define TRIS_LCD_PORT TRISD
/* CTRL_PORT defines the port where the control lines are connected.
* These are just samples, change to match your application.
*/
#define RW_PIN LATCbits.LATC1 /* PORT for RW */
#define TRIS_RW TRISCbits.TRISC1 /* TRIS for RW */
#define RS_PIN LATCbits.LATC0 /* PORT for RS */
#define TRIS_RS TRISCbits.TRISC0 /* TRIS for RS */
#define E_PIN LATCbits.LATC2 /* PORT for D */
#define TRIS_E TRISCbits.TRISC2 /* TRIS for E */
By PIC18F peripherals libraries you mean xlcd.h and related files then yes. I Have installed them and using them.
Hello
I am getting an error while compiling the code
:0:: error: (499) undefined symbol:
_BusyXLCD(dist/default/production\ADC_Test_-1_22-9-18.X.production.o)
I have checked in the library to verify that im not doing a syntax error
please help me with it
You didn't specify the PIC used, the compiler version etc.
@@StudentCompanion I have used pic 18f45k22
And compiler xc8 v.2.00
The new compiler XC8 v2 doesn't support the peripheral libraries anymore. Either use MPLAB Code Configurator as explained in this video: ruclips.net/video/4WaB_Lj8FnY/видео.html or download an earlier version of XC8 v1xx and link in the peripheral libraries.
@@StudentCompanion what do you recommend among the two?
Should I rebuild the project with mcc or an compile with an earlier version of xc8
Microchip is basically discontinuing the peripheral libraries. It's never advisable to start a new project with an old discontinued tool. You'll face problems in the future. It's still there just to support old existing projects.
dude u told me code configurator doesnot work with not old model but in ur site u say pic16f and pic18f are programmable with code configurator i am so confused
Confuse by what? PIC16 and PIC18 has got nothing to do with old or new, there are new device models of PIC16F, PIC18F even PIC10F and PIC1F in these series. The MCC release note has a list of all supported devices
@@StudentCompanion ty
Very useful
maybe do you have the xlcd.h ?¿? i need it
what version of XC8 you are using?
+StudentCompanionSA the newest!!! v 1.35 xc8
+Enrique Benalcázar if you don't find any library files you may download and install the legacy PIC18 peripheral libraries. they have removed them in version 1.35. they want people to use the code configurator.
+StudentCompanionSA thanks!!! do you have any link of libraries??
+Enrique Benalcázar on this link: www.microchip.com/pagehandler/en-us/devtools/mplabxc/home.html
Under Download, click on PIC18F Legacy Peripheral Libraries v1.0 - Windows if you are using a Windows computer.
Hi sir, i found the error: main.c:115: warning: (520) function "_DelayFor18TCY" is never called
main.c:124: warning: (520) function "_DelayPORXLCD" is never called
main.c:138: warning: (520) function "_DelayXLCD" is never called, how can I resolve?
Did you include and link the peripheral libraries?
I include w #include "C:\Program Files (x86)\Microchip\xc8\v1.45\include\plib\xlcd.h", what u say with link?
You must download it separately and install it into your compiler if you are
Using a new XC8 compil2. The peripheral libraries are no longer included in XC8 compiler installation since version 1.34.
Watch the beginning of this video to learn where to download the peripheral libraries and how to link them: ruclips.net/video/4WaB_Lj8FnY/видео.html
when I click on MCC , shows me a warning message, "the projects device is not supported by the currently loaded libraries. all library versions are avaliable for download on the MCC website", so i tried compiled, and
so I tried to compile anyway, and it did not appear as an error, just a warning that only the DelayXLCD function had not been called. so I recorded on the PIC 18F4550, and the characters are blank, I sent the message "hello world" and it showed me 00_oo
What if I want to interface my lcd to port c?
Watch these 2 videos:
1. LCD connected to any PORT: ruclips.net/video/RkDN2GW_SxU/видео.html
2. ADC and LCD with MCC: ruclips.net/video/4WaB_Lj8FnY/видео.html
hello uploader,
Where is the 4th part of MPLAB XC8 for beginners
Hi, sorry for that, we had to pull it out to correct some few things. We will upload more this weekend.
Thanks for watching.
Hemang Joshi Here is the 4th part:
ruclips.net/video/fXgh2oZ3Mmg/видео.html
+Hemang Joshi this is part 4: ruclips.net/video/fXgh2oZ3Mmg/видео.html
+Student companion Thanx man...
+Hemang Joshi you are welcome.
where i can download your source code ?
How to add library LDC.h in the source? Please help me
why are there so many red underlines? i wrote the same codes (except of course the header file, i included my own header file) but it gives 2 errors :(
Hi. We can't really guess what could be wrong without more information. Which PIC are you using? What version of XC8 compiler you are using? What are those 2 errors saying?
well the red underlines are exactly in the same places as in the video. and when i build it, at the end it says in red lines:
"make[2]: *** [build/default/production/my_mplab_project.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUİLD FAILED (exit value 2, total time: 2s)"
i've followed the tutorial from the beginning and done exactly the same, PIC18F2220 and all. the compiler version is v4.15
why are the codes in the video underlined red at all? they work with you :/
Well. Red underline are not necessarily errors. There might be many reasons for that but what i have observed if you did not specify explicitly the libraries used, it will underline those codes. Like for example we did not include xlcd.h and adc.h in this video. But when you build the code it will get all the required libraries that's why it won't generate errors. In your case it does not find those libraries that's why I think it generating errors. The reason because you are using a newer XC8 compiler. PIC18F peripheral libraries are no longer included in new versions of XC8 compilers from version 1.35. You must now download them separately and install them into your compiler and they are now called Legacy peripherals libraries.
V4.15 is not the compiler version, this is MPLAB X IDE version. This is just the editor not the compiler. The compiler works in the background. That's the version that I need.
Microchip wants people to use MPLAB Code Configurator now for new designs because they are no longer supporting the peripheral libraries. Watch this video to learn how to download the peripheral libraries and link them into your compiler. And also how to use MPLAB Code Configurator for ADC and LCD: ruclips.net/video/4WaB_Lj8FnY/видео.html
Sir i have many error in program every function of lcd show error
Hi. What do you mean every function shows an error? Is it a red underline? Or when you build it generate errors?
@@StudentCompanion sir every line show erroe red and when compile then show message undefine functions
@@abubakarabbas9384 can you copy the full build log and paste it here so I can see the full error message.
What isbthe PIC you are using?
What is the version of your XC8 compiler?
@@StudentCompanion sir i am using mplab xide and xc8 sir the issue is when the f1 is pressed and search the lcd function then where writethat use these function to include the header file but in your code i cannot see any header file. this is my problem i cantot find any xlcd header file
I have used 18f252 and it is not working. same code!!!
:: advisory: (1233) Employing 18F252 errata work-arounds:
:: advisory: (1234) * Address 4000h boundary
:: advisory: (1234) * Faulty table reads at -40 degrees C
:: advisory: (1234) * GOTO instruction at reset vector must be preceded by NOP
:: advisory: (1234) * Peripherals can misbehave if BSR = 15
:: advisory: (1234) * DAW instruction may improperly clear CARRY bit
:: advisory: (1234) * Specifically disable interrupt sources during tblwt instruction
:: advisory: (1234) * Writes to flash must target opposite side of 4000h boundary
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: undefined symbol:
_DelayFor18TCY(dist/default/production\LCD.X.production.obj)
make[2]: Leaving directory `C:/Users/Baghdadi/MPLABXProjects/LCD.X'
(908) exit status = 1
make[2]: *** [dist/default/production/LCD.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[1]: Leaving directory `C:/Users/Baghdadi/MPLABXProjects/LCD.X'
BUILD FAILED (exit value 2, total time: 5s)
+Aay zee Yuo can use the same code but because the PIC is different, you must set correctly the configuration bits according to this PIC. Watch our tutorial 1 to learn how to set configuration bits correctly.
+Student Companion SA If you are using XC8 compiler from version 1.35 to up, the project might complain about the peripheral library which is no longer included in XC8 compiler, you'll have to download it separately and install it into your compiler. watch this video to learn more: ruclips.net/video/4WaB_Lj8FnY/видео.html
or you can learn more from this page: www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
sir plz show the configuration file of this code and please teach me for add new liabrary like xlcd in xc8
The configuration bits is explained in the video
@@StudentCompanion sir sorry kuch sahi samaj nahi lagi us ki
@@StudentCompanion Sir can we talk on whats app
No. We don't provide tutorial support in private messages on WhatsApp. Ask all your questions here. Another person can benefit from your question by just reading them as see the proposed solution instead on discussing in private.
sir tell me
Hi
Can I please get some help from you in understanding a few things from this project?
I mean can we have a little chat please? I need to ask a few things from you
+Gray Fox Hi. You can ask any questions you like concerning this project
in lcd.c
You have right shifted the nibble, why is that?
ch = (ch >> 4)
+Gray Fox have you read the lcd datasheet?
I tried
but I'm a beginner and I didnt understand much of it.
+Gray Fox for you to understand the lcd library you'll need to understand the datasheet first as nothing will make sense to you. The datasheet explain how the module work and how to send instructions
very good
Thank you.