USB and LCD
USB and LCD
Hi,
I want to send a text sent to the LCD via USB from the USB HID example.
The problem is that I can not send a command to the LCD, but if I turn off routines HID_enable, and lets me communicate with the USB
What can I do?
I have the EasyPic5
Bye
I want to send a text sent to the LCD via USB from the USB HID example.
The problem is that I can not send a command to the LCD, but if I turn off routines HID_enable, and lets me communicate with the USB
What can I do?
I have the EasyPic5
Bye
The code is this:
void main() {
unsigned char i, ch;
df = 0;
Delay_ms(1000); Delay_ms(1000);
Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Initializar LCD al PORTB
LCD_Cmd(LCD_CLEAR);
LCD_Cmd(LCD_CURSOR_OFF);
LCD_Out(1,1,"adios");
Delay_ms(1000); Delay_ms(1000);
Init_Main();
HID_Enable(&userRD_buffer, &userWR_buffer);
Delay_ms(1000); Delay_ms(1000);
while (1) {
k = HID_Read();
i = 0;
while (i < k) {
ch = userRD_buffer;
//ch= 'o';
userWR_buffer[0] = ch;
while (!HID_Write(&userWR_buffer, 1)) ;
i++;
}
}
HID_Disable();
}//~!
The functions of LCD not work
void main() {
unsigned char i, ch;
df = 0;
Delay_ms(1000); Delay_ms(1000);
Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Initializar LCD al PORTB
LCD_Cmd(LCD_CLEAR);
LCD_Cmd(LCD_CURSOR_OFF);
LCD_Out(1,1,"adios");
Delay_ms(1000); Delay_ms(1000);
Init_Main();
HID_Enable(&userRD_buffer, &userWR_buffer);
Delay_ms(1000); Delay_ms(1000);
while (1) {
k = HID_Read();
i = 0;
while (i < k) {
ch = userRD_buffer;
//ch= 'o';
userWR_buffer[0] = ch;
while (!HID_Write(&userWR_buffer, 1)) ;
i++;
}
}
HID_Disable();
}//~!
The functions of LCD not work
Hehe, no hay problema.
Uno amigo mio, teve lo mismo problema.
Quando fez la mudança de puerta, no problema se hay sanado.
Tiente acer la mudança para la purta D. Esta purta no tiene otras funciones se non escrebit e acer la letura de estado.
Esto es conocido como PORTUNHOL; una mistura de portugues con lo español.
Uno amigo mio, teve lo mismo problema.
Quando fez la mudança de puerta, no problema se hay sanado.
Tiente acer la mudança para la purta D. Esta purta no tiene otras funciones se non escrebit e acer la letura de estado.
Esto es conocido como PORTUNHOL; una mistura de portugues con lo español.
-
- Posts: 173
- Joined: 09 Apr 2008 12:56
continuous function without....
My configuration projecti is:
PIC 18F4550
MicroC 8.2
Clock: 48 MHz
Flags Project Checked:
PLLDIV_2_1L
CPUDIV_OSC1_PLL2_1L
USBDIV_2_1L
FOSC_HSPLL_HS_1H
FCMEM_OFF_1H
IESO_OFF_1H
POWRT_ON_2L
BOR_ON_2L
BOV_43_2L
VREGEN_ON_2L
WDT_OFF_2H
WDTPS_256_2H
HCLRE_ON_3H
LPT1OSC_OFF_3H
PBADEN_OFF_3H
CEP2MX_ON_3H
STVREN_ON_AL
LVP_OFF_AL
ICPRT_OFF_AL
XINST_OFF_AL
DEBUF_OFF_AL
My configuration projecti is:
PIC 18F4550
MicroC 8.2
Clock: 48 MHz
Flags Project Checked:
PLLDIV_2_1L
CPUDIV_OSC1_PLL2_1L
USBDIV_2_1L
FOSC_HSPLL_HS_1H
FCMEM_OFF_1H
IESO_OFF_1H
POWRT_ON_2L
BOR_ON_2L
BOV_43_2L
VREGEN_ON_2L
WDT_OFF_2H
WDTPS_256_2H
HCLRE_ON_3H
LPT1OSC_OFF_3H
PBADEN_OFF_3H
CEP2MX_ON_3H
STVREN_ON_AL
LVP_OFF_AL
ICPRT_OFF_AL
XINST_OFF_AL
DEBUF_OFF_AL
-
- Posts: 29
- Joined: 23 Feb 2009 22:58
Hi there,
I have the same problem as lolix69, with the same technical project configuration.
But ...
I thought of something, the clock-speed, so I changed the following :
- check flag _FOSC_HS_1H
- uncheck flag _FOSC_HSPLL_1H
This causes the clockspeed to change from 48 MHz to 8 MHz because the PLL will be switched off.
And now everything works fine (although the USB runs on low speed now).
So this is what I think is happening ....
I have found a description about a LCD in 'LCD16x2_TRIMODS1538.pdf'
This LCD works with a controller, called KS0070B from Samsung, this seems to be the most used controller for LCD's.
I guess the MikroElektronica-LCD has the same controller, or a similar one.
On page 11 of this description I find the following info:
Busy Flag (BF)
When BF = "1", it indicates that the internal operation is being processed. So during this time the next instruction
cannot be accepted. BF can be read, when RS = "0" and R/W = "1"
(Read Instruction Operation), through DB7 port.
Before executing the next instruction, be sure that BF is not "1".
So this means that there is a minimum time needed to do the writing of the bits to the LCD-port, this minimum time is not
determinend by a specific time, but by a bit-check (when RS = "0" and R/W = "1" DB7 must be "1"). And I cannot find this bit
-check in the assembly routines made by MikroElektronica.
Is this helpfull ?
When I am correct then MikroElektronica should rewrite there LCD-routines a bit ...
I have the same problem as lolix69, with the same technical project configuration.
But ...
I thought of something, the clock-speed, so I changed the following :
- check flag _FOSC_HS_1H
- uncheck flag _FOSC_HSPLL_1H
This causes the clockspeed to change from 48 MHz to 8 MHz because the PLL will be switched off.
And now everything works fine (although the USB runs on low speed now).
So this is what I think is happening ....
I have found a description about a LCD in 'LCD16x2_TRIMODS1538.pdf'
This LCD works with a controller, called KS0070B from Samsung, this seems to be the most used controller for LCD's.
I guess the MikroElektronica-LCD has the same controller, or a similar one.
On page 11 of this description I find the following info:
Busy Flag (BF)
When BF = "1", it indicates that the internal operation is being processed. So during this time the next instruction
cannot be accepted. BF can be read, when RS = "0" and R/W = "1"
(Read Instruction Operation), through DB7 port.
Before executing the next instruction, be sure that BF is not "1".
So this means that there is a minimum time needed to do the writing of the bits to the LCD-port, this minimum time is not
determinend by a specific time, but by a bit-check (when RS = "0" and R/W = "1" DB7 must be "1"). And I cannot find this bit
-check in the assembly routines made by MikroElektronica.
Is this helpfull ?
When I am correct then MikroElektronica should rewrite there LCD-routines a bit ...