Hi
I am doing a project which involves USB and GLCD. Basically both work separately but when i integrate the USB to the GLCD code the GLCD stops working. I tracked the prob to the USB interrupt. If i comment out as shown below GLCD works. But USB doesnt work!
void interrupt()
{
//HID_InterruptProc();
//return;
}
Can the USB and GLCD work together?I have included USBdsc.c,VARs.h and Definit.h to the GLCD code and initialize USB HID via :
HID_Enable(&userRD_buffer, &userWR_buffer);
Please advice someone
USB with GLCD problem
Hi,
What exactly did you have in mind to do? USB HID library uses interrupts to send and receive data, so if your GLCD is interrupted due to this, there are likely to be some errors. You must carefully organize your program, and maybe turn off interrupts INTCON.GIE = 0; and PIE2.USBIE = 0; during GLCD routines, and turn them on again after completion. Can you paste a piece of code for me to take a look at what were your intentions in the project?
Best regards,
Aleksandar
What exactly did you have in mind to do? USB HID library uses interrupts to send and receive data, so if your GLCD is interrupted due to this, there are likely to be some errors. You must carefully organize your program, and maybe turn off interrupts INTCON.GIE = 0; and PIE2.USBIE = 0; during GLCD routines, and turn them on again after completion. Can you paste a piece of code for me to take a look at what were your intentions in the project?
Best regards,
Aleksandar
Web Department Manager
Hi,
I can only provide you with project files via our support ticket system, so if you are interested in this, please open the support ticket at: http://www.mikroe.com/en/support/ and refer to this post, and I will attach you some demonstration project.
Best regards,
Aleksandar
I can only provide you with project files via our support ticket system, so if you are interested in this, please open the support ticket at: http://www.mikroe.com/en/support/ and refer to this post, and I will attach you some demonstration project.
Best regards,
Aleksandar
Web Department Manager
Re: USB with GLCD problem
I had the same problem and I spent an entire day trying to figure out what the problem. I was trying to use the USB library along with the PS2 one and USB stopped working at the very moment I defined the PS2 variables:
By using the Statistics tool I figured out that my USB writebuff variable size was 56 bytes long instead of 64. When I went to the code I found that my buffer´s definition was wrong. I had written
Instead of the right definition
I haven’t figure out why, but everything started to run nicely after the correction. I know this is a blunder but a very difficult one to trace. Anyway, I hope this can help another fellow of the tortured souls.
Code: Select all
sbit PS2_Data at RA4_bit;
sbit PS2_Clock at RA5_bit;
sbit PS2_Data_Direction at TRISA4_bit;
sbit PS2_Clock_Direction at TRISA5_bit;
Code: Select all
typedef union _INTPUT_CONTROLS_TYPEDEF {
struct {
BYTE control_code;
BYTE pad;
BYTE scan_code[6];
} kbd_members;
BYTE val[56];
} INPUT_CONTROLS;
INPUT_CONTROLS keyboard_report absolute 0x540;
Code: Select all
typedef union _INTPUT_CONTROLS_TYPEDEF {
struct {
BYTE control_code;
BYTE pad;
BYTE scan_code[6];
} kbd_members;
BYTE val[64];
} INPUT_CONTROLS;
INPUT_CONTROLS keyboard_report absolute 0x540;