• AVR Freaks

Helpful ReplyHot!Curiousity Board HPC PIC16F18875 LCD display library

Page: 12 > Showing page 1 of 2
Author
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
2020/03/31 01:20:41 (permalink)
0

Curiousity Board HPC PIC16F18875 LCD display library

Hey!
 
Do you guys know if there is a LCD library to control a display (preferably with i2c). Its about a 16x2 display, but i cannot find any valuable information around this.
So i need some help.
 
I am using XC8 and MPLAB
Thanks you in advance!
post edited by Killerpiraat - 2020/04/06 02:41:58
#1
katela
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 04:35:45 (permalink)
+1 (1)
There are many threads in the forum about I2C with and PCF8574. Try searching the forum.

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#2
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 04:38:27 (permalink)
-2 (2)
On second thought, i do not want to use I2C. 
#3
katela
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 04:43:13 (permalink)
+1 (1)
Did you try searching the forum? When it comes to lcd, there are plenty of threads discussing this topic. Pick one then if u have problems post in tge forum for more discussions

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#4
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 06:04:32 (permalink)
+1 (1)
Sorry, yes i did try search the forum. In most searches i end up on this page;
https://www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
It seems straight forward, makes sense. I added the lcd.c and lcd.h libraries in my project which i have downloaden on the page i just mentioned.
 
When i try to print anything on the lcd it gives me jibberish. 
 
 

Attached Image(s)

#5
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 06:12:29 (permalink)
0
 I also changed the PORTDbits to PORTBbits, because i am using RB0 - RB7. On the curiosity HPC board pin RB4 is used for the switch integrated on the board, so i am not using that one. RB0 - RB3 are for the data transmission towards the lcd.
Also i have changed the TRISD to TRISB. (not seen in images) 
For some reason i cannot edit my post before this one anymore?
#6
katela
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 07:10:15 (permalink)
+1 (1)
Killerpiraat
Sorry, yes i did try search the forum. In most searches i end up on this page;
https://www.studentcompanion.co.za/interfacing-lcd-display-with-pic-microcontroller-xc8/
It seems straight forward, makes sense. I added the lcd.c and lcd.h libraries in my project which i have downloaden on the page i just mentioned.
 
When i try to print anything on the lcd it gives me jibberish.  


You are writing to your lcd in a while(1) loop, that code will run continuously and you are clearing it before even the delay (and the delay is too short). You can't see anything after you have just cleared the screen.
Can you put a simple code in the main loop, not in the while (1) loop, and don't clear it or clear it only after some few seconds and see if it won't display?

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#7
du00000001
Just Some Member
  • Total Posts : 3665
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 07:11:35 (permalink)
+1 (1)
Further change to "LAT" in place of "PORT" !
There's currently another thread running - looks like the same "lib" and maybe the same issue.
post edited by du00000001 - 2020/03/31 12:13:44

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#8
du00000001
Just Some Member
  • Total Posts : 3665
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 12:16:12 (permalink)
+1 (1)
@ killerpiraat
 
See this thread:  https://www.microchip.com/forums/m1133914-p2.aspx
Looks very much like your code (though modified for a 4x40 LCD). But the code you downloaded has a major issue. Remedy: see above.

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#9
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 12:31:24 (permalink)
0

You are writing to your lcd in a while(1) loop, that code will run continuously and you are clearing it before even the delay (and the delay is too short). You can't see anything after you have just cleared the screen.
Can you put a simple code in the main loop, not in the while (1) loop, and don't clear it or clear it only after some few seconds and see if it won't display?




A delay of 200 ms is too short? 
I agreed the LCDclear wasnt handy, i removed that already, but thanks for your comment. 
I deleted the while(1), but i am still facing the same problem. I get all kind of characters on the display. On random places. 
#10
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 12:33:51 (permalink)
0
du00000001
@ killerpiraat
 
See this thread:  https://www.microchip.com/forums/m1133914-p2.aspx
Looks very much like your code (though modified for a 4x40 LCD). But the code you downloaded has a major issue. Remedy: see above.




Thank you. I will look into it.
#11
katela
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/03/31 12:44:58 (permalink)
+2 (2)
Hope you did not remove the while(1) loop altogether

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#12
Tim Cruise
Senior Member
  • Total Posts : 146
  • Reward points : 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/05 22:35:49 (permalink)
0
There is a library for miniLCD Click Board made by mikroelectronika.
 
Turn on MCC and search the left-sided peripheral window for it.
 
However, the newest v1.1 mikroe MCC library seems buggy.  Load the older v1.0 instead if you meet difficulty.
#13
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 02:06:55 (permalink)
0
Well, its still not working. When i change PORTB to LATB it wont compile.
Is there anyone with a simple hello world project that i can use? 
Perhaps someone that already used this lcd.h en lcd.c libraries
 
Ive added the files in the original post (on top). I got the feeling i am going backwards instead of forwards.
post edited by Killerpiraat - 2020/04/06 02:12:44
#14
katela
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2013/06/11 05:25:18
  • Location: South Africa
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 02:25:19 (permalink)
+1 (1)
Do you mind posting the complete project not just individual files. You can package your project. Also post your full error log message.

Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
#15
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 02:42:28 (permalink)
0
Most certainly. The zipped file is in the original post now.
#16
du00000001
Just Some Member
  • Total Posts : 3665
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 04:38:14 (permalink) ☄ Helpfulby Killerpiraat 2020/04/06 06:26:56
+2 (2)
Oh yeah !
If you had changed PORTBbits.RBx to LATBbots.LATBx (instead of changing to LATBbots.RBx), it would have compiled (although with wome warnings).
 
BTW: Why do you sport inconsistent definitions of _XTAL_FREQ ?

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#17
Killerpiraat
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2020/03/09 07:40:17
  • Location: 0
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 06:39:49 (permalink)
0
du00000001
Oh yeah !
If you had changed PORTBbits.RBx to LATBbots.LATBx (instead of changing to LATBbots.RBx), it would have compiled (although with wome warnings).
 
BTW: Why do you sport inconsistent definitions of _XTAL_FREQ ?


Aaah so thats what i forgot. Thank you.
Well the XTAL_FREQ is from the demo code from Microchip. I havent changed that, because im not sure what that is.
 
Okay it works a little bit better. But the weirdest thing is happening. If i upload the code, it gives me still jibberish all over the LCD. BUT, pressing reset gives me more jibberish. BUT, when i swap the 4 data lines (im in 4 bit mode) around (so 1 to 4, 2 to 3, 3 to 2, 4 to 1), it still gives me jibberish. BUT now when i change them back to the original positions and press reset, it shows my code good! and on the right place. What could be causing this?
post edited by Killerpiraat - 2020/04/07 00:46:20
#18
du00000001
Just Some Member
  • Total Posts : 3665
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 11:25:19 (permalink)
+2 (2)
Garbage on display? I assume you're operating the display interface faster than it should be operated (that is: delays too short).
_XTAL_FREQ translates to "clock frequency" (XTAL short for "crystal").
IIRC it's not actually the clock frequency but the IPS (instructiins per second) your PIC is configures to run at.

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#19
ric
Super Member
  • Total Posts : 26942
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Curiousity Board HPC PIC16F18875 LCD display library 2020/04/06 23:32:46 (permalink)
+1 (1)
du00000001
IIRC it's not actually the clock frequency but the IPS (instructiins per second) your PIC is configures to run at.

??
In XC8, _XTAL_FREQ is the clock frequency, which is four times the instruction rate.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2020 APG vNext Commercial Version 4.5