Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

library xlcd.h and adc.h in MPLAB - MCC18

Status
Not open for further replies.

alone76816

New Member
Hi everyone !

my shematic as below:
**broken link removed**


1. I want to rebuild xlcd.h as below :

DATA_PORT --> PORTD
E_PIN --> RE2
RS_PIN --> RE1
RW --> RE0

So, I don't know how i do ? Hope everybody help me !

2. In funtion below:

OpenADC( ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_12_TAD, ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD, 15)

I configure for PIC 18F4520. I don't understand ADC_RIGHT_JUST, ADC_VREFPLUS_VDD, and number 15 . What's it mean ? explain for me, please !

Help me, please !!! Thank you very much !!!
 
Last edited:
Well for using the XLCD.h you need to go through MC C18 libraries guide, here is an example of using the external LCD function using the 18F1320. Recalculate the delays for the FOSC you are using then change the routines for the 18F4520. Ruin the Proteus simulation.

As for the ADC part, first look up the ADC app note by MC and then the C18 Libraries guide.
Then if you want i can also upload the ADC demo.
 

Attachments

  • software lcd..zip
    5.4 KB · Views: 1,227
  • 18f1320lcd..zip
    15.4 KB · Views: 797
  • adc..pdf
    89.7 KB · Views: 1,020
Last edited:
Thank Wond3rboy !!! Thank for your help ! I read MC C18 libraries, and i understood its. But I want to rebuild xlcd.h, i don't know do that.

The old file xlcd.h as below:

#define DATA_PORT PORTB
#define TRIS_DATA_PORT TRISB

#define RW_PIN LATAbits.LATA2 /* PORT for RW */
#define TRIS_RW TRISAbits.TRISA2 /* TRIS for RW */

#define RS_PIN LATAbits.LATA1 /* PORT for RS */
#define TRIS_RS TRISAbits.TRISA1 /* TRIS for RS */

#define E_PIN LATAbits.LATA6 /* PORT for E */
#define TRIS_E TRISAbits.TRISA6 /* TRIS for E */


I want to change its as below :

#define DATA_PORT PORTD
#define TRIS_DATA_PORT TRISD

#define RW_PIN LATEbits.LATE0 /* PORT for RW */
#define TRIS_RW TRISEbits.TRISE0 /* TRIS for RW */

#define RS_PIN LATEbits.LATE1 /* PORT for RS */
#define TRIS_RS TRISEbits.TRISE1 /* TRIS for RS */

#define E_PIN LATEbits.LATE2 /* PORT for E */
#define TRIS_E TRISEbits.TRISE2 /* TRIS for E */


How do i change that define ?
Because my shematic is diference PORT.

Help me, please !!!
 
Last edited:
Just change the pin assignments in MCC18\h\xlcd.h. Its indicated in C18 Libraries guide.


Remember to change the delays.
 
Here is the xlcd.h file, just copy it in the MCC18\h folder, according tot he configuration of the crystal calculate the delays as required according to the C18 Libraries Guide and you are done. Usually what goes wrong is the delay part so be careful while doing it.
 

Attachments

  • xlcd..h
    4.1 KB · Views: 1,192
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top