PIC16f874 project

(instructions, reset, WDT, specifications...) PIC12F6xx, PIC16Fxxx, PIC16F6x, PIC16F7x

PIC16f874 project

Postby umogi_lvr » Thu Dec 01, 2022 4:04 pm

Dear Members! At university we were given the PIC16f874(-20/P), microcontroller shown in the picture, connected to an lcd display, and we were given the task to draw a logo on it. We've only learned similar things, but nothing like this, so we're having a lot of trouble getting the project done. We are using MPLab 6.0 and a program called pickit 2, into which we copy (or would copy, if we had it) the hex code from MPlab. So far, after much digging, we are trying the configuration bits, but no luck. Can anyone help? Suggest articles or anything. Also, if there is something I have not described, please let me know.
Attachments
3.jpg
3.jpg (248.49 KiB) Viewed 266 times
2.jpg
2.jpg (249.3 KiB) Viewed 266 times
1.jpg
1.jpg (249.14 KiB) Viewed 266 times
umogi_lvr
 
Posts: 8
Joined: Thu Dec 01, 2022 3:51 pm

Re: PIC16f874 project

Postby AussieSusan » Fri Dec 02, 2022 2:45 am

Can you show us the code you have?
What has worked for you?
Can you program the MCU at all? If so can you do something like toggling a GPIO pin (the 'flash a LED' type task that shows you can get a very basic piece of code to work)
That LCD display looks like it is a graphics one - correct? If so do you have the data sheet for it so that you know how to initialise it and drive it correctly (they are sometimes not easy to get started)?
Looking at the solder joints to the display board, some seem to be 'dry'.
Susan
AussieSusan
Verified identity
 
Posts: 170
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: PIC16f874 project

Postby umogi_lvr » Fri Dec 02, 2022 11:06 am

Thank you for your reply! After failing to configure the bits to run something, we are trying to start from the configuration of another microcontroller, I attach its code. I have not been able to find the type of the display nor the datasheet, but if I can get a pixel to show up that would be good enough.
Attachments
main.c
(767 Bytes) Downloaded 9 times
lcd.h
(496 Bytes) Downloaded 10 times
lcd.c
(1.87 KiB) Downloaded 11 times
fd1.c
(3.21 KiB) Downloaded 12 times
fd1.h
(232 Bytes) Downloaded 10 times
umogi_lvr
 
Posts: 8
Joined: Thu Dec 01, 2022 3:51 pm

Re: PIC16f874 project

Postby umogi_lvr » Fri Dec 02, 2022 12:29 pm

I found the display: "20-20056-3 Lcd models display"
umogi_lvr
 
Posts: 8
Joined: Thu Dec 01, 2022 3:51 pm

Re: PIC16f874 project

Postby umogi_lvr » Fri Dec 02, 2022 12:34 pm

with this: EDT EW13B10GLY
umogi_lvr
 
Posts: 8
Joined: Thu Dec 01, 2022 3:51 pm

Re: PIC16f874 project

Postby AussieSusan » Mon Dec 05, 2022 3:20 am

Are you able to show us the datasheet for the display? The ones that Ii can find on the web show the hardware interface but not the protocols for initialisation etc. that you have in your 'lcd.c' file - these are critical at getting most displays to work.
By the look of the code in 'lcd_init()' you are using the HD44780 protocol but that is for a character displays (often 2 or 4 rows by 16 to 20 character) and not a graphics display which I what I think you have. Are you sure that is correct (which is why I was asking for the initialisation protocol datasheet etc.)
You are using the HS oscillator and have set the _XTAL_FREQ preprocessor name, but are you really using a 4MHz crystal?
Personally I would not create separate files for the config and main includes - simply put the includes required in each C file and also put the config settings at the start of the main C file.
Further, you are right to use the "xc.h" file but I suspect the others are a waste of time - add them in later in the development cycle if needed. Don't include the 'p18cxxx.h' file - the "xc.h" does that for you better than doing it yourself.
Susan
AussieSusan
Verified identity
 
Posts: 170
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: PIC16f874 project

Postby ric » Mon Dec 05, 2022 5:25 am

n.b. the PIC16f874 is a 14-bit core, so I have moved this topic from the 16 bit core forum to the 14 bit core forum.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 643
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: PIC16f874 project

Postby umogi_lvr » Mon Dec 05, 2022 12:31 pm

Thank you Susan for your help! There is a lot of redundancy in the code because I tried to use code from another project. The display is not as small as the code says. I have found the datasheet for the display.

The file is too big, so here's the link: https://datasheetspdf.com/pdf/550801/Em ... /EW13B10/1
umogi_lvr
 
Posts: 8
Joined: Thu Dec 01, 2022 3:51 pm

Re: PIC16f874 project

Postby AussieSusan » Tue Dec 06, 2022 2:57 am

That was the only data sheet that I could find as well and it is totally useless for this purpose. It does not tell you anything about the signals you need to send to the display to initialise it or to write to it.
Copying files from different project scan make things harder for you than necessary. Just start from scratch and build things up slowly.
If the code does not match the display then your chances of getting it to work are negligible.
If the university gave you the display then ask them for the full data sheet that includes the communication protocols (not just the timing diagrams in the data sheet you linked)
Susan
AussieSusan
Verified identity
 
Posts: 170
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: PIC16f874 project

Postby ric » Tue Dec 06, 2022 6:42 am

Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 643
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Next

Return to 14-Bit Core

Who is online

Users browsing this forum: No registered users and 0 guests

cron