GLCD ST7920 in PIC18F47K42

New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2018/09/18 12:01:43
  • Location: 0
  • Status: offline
2018/09/19 07:04:53 (permalink)

GLCD ST7920 in PIC18F47K42

I´ve been working with a 128x64 display using the driver ST7920, I tried my code for first time in a PIC18F47K40 using the MicroC V7.2 IDE and the code worked very good, but when I tried to update to a PIC18F47K42 using the MPLAB X IDE v4.2 with XC8 v1.45, the code doesn't works, I've made the required changes in the code to work in Mplab and it compiles with no problems, but the execution has stoped in the funtion of glcd_check_busy() and I don't know why. 
I'd like someone can help me to understand what i'm doing wrong, or if the pic that i'm using have problems to change the pin between input and output and in case of have it, how can I procede to make the code works?
I'd like to attach the complete code but it has 1.6MB and the platform has a limit of 500 KB.
Even though i attach the code ST7920.c and the main.c that includes the most importan part of the code.
this is the code of ST7920.h 
#include <xc.h>

#define _XTAL_FREQ 64000000

#define INFO_BF PORTDbits.RD7

#define RS LATCbits.LATC3
#define RW LATCbits.LATC2
#define E LATCbits.LATC1
#define RST LATCbits.LATC0


#define TRUE 1
#define FALSE 0
#define ON 1
#define OFF 0
#define XVAL 16 //16
#define YVAL 32 //32
#define GLCD_WIDTH 128

#define BIT_CLEAR(d,b) (d &= ~(1 << b))
#define BIT_SET(d,b) (d |= (1 << b))
#define BIT_TEST(d,b) (d & (1 << b))

void logotipo();
unsigned char glcd_readByte (unsigned char address);
void glcd_check_busy();
void glcd_instruction(unsigned char x);
void glcd_data(unsigned char x);
void glcd_fillScreen (char color);
void glcd_update();
void glcd_init_graph();
void glcd_init_basic();
void glcd_pixel(char x, char y, char color);
//void glcd_plot_image(int width,int height,int x,int y,int inverse);
//void Exibe_image(char pos_x, char pos_y, char largura, char altura, char inverse, char Transparente, const char *Imagem);
void Logo(const char *ptr);
unsigned int abs_2(int a);
void glcd_line(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, char color);
void glcd_rect(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, char fill, char color);
void glcd_bar(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char width, char color);
void glcd_circle(unsigned char x, unsigned char y, unsigned char radius, char fill, char color);
void glcd_text57(unsigned char x, unsigned char y, char* textptr, unsigned char size, char color);
void glcd_text57_const(unsigned char x, unsigned char y, const char* textptr, unsigned char size, char color);


1 Reply Related Threads

    Super Member
    • Total Posts : 1347
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: offline
    Re: GLCD ST7920 in PIC18F47K42 2018/09/19 09:26:35 (permalink)
    Jump to:
    © 2018 APG vNext Commercial Version 4.5