LCDproc development and user support list

Text archives Help


[lcdproc] Newbie questions


Chronological Thread 
  • From: jless AT gmx.net (Jaepke Lesselich)
  • Subject: [lcdproc] Newbie questions
  • Date: Mon, 25 Sep 2000 12:17:16 +0200

Thanks a lot for this stuff and the files!
It fixes the speed prob, when I advise the loop to run 1150 times.
But this causes a new problem.... the CPU load in _idle_ times is
now never below 60%, when other programs need CPU time, the
timings of the LCDd aren't stable, but this isn't the real prob - my
mashine is working as a intranet server (dhcp, smb, ftp, http, IRC,
routing ... in a gaming lan) for 2..50 clients and this high cpu load
causes very long answer times if many users want to use the
services.
Is there any other method to get the right timigs without making it
by blocking the CPU for defined durations?
thanks a lot!

jl

"Thierry AMANI"
<t_amani AT hotmail.com>
wrote on Friday 22.9.2k:
> I had the same problem but now it walks fine.
> The problem comes from the use of the function usleep() in the hd44780
> driver, precisely in function HD44780_senddata() (file
> server/drivers/hd44780.c).
> usleep(int n) is supposed to make the system wait n microseconds.
> Unfortunately during this waiting time, the system switch to another
> process,
> and switches between processes take much more time (I read somewhere 20
> milliseconds).
> So I decided not to use usleep(). Instead, I defined a macro in file
> server/drivers/hd44780.h:
> #define USLEEP_1() port_out(0x80, 0x0)
> This macro performs a writting operation on port 0x80. In most case this
> port is never used by the system.
> A writting/reading operation on a port takes exactly 1 microseconds.
> Using USLEEP_1(), the function HD44780_senddata() becomes:
>
> static void HD44780_senddata(unsigned char flags, unsigned char ch)
> {
> unsigned char h = ch >> 4;
> unsigned char l = ch & 15;
> int i;
> port_out(lp, 128 | EN | flags | h);
> for ( i=0; i<1600; i++)
> USLEEP_1();
> port_out(lp, 128 | flags | h); port_out(lp, 128 | EN | flags | l);
> for ( i=0; i<1600; i++)
> USLEEP_1();
> port_out(lp, 128 | flags | l);
> }
>
> One can notice the presence of loops. I put them to make a waiting time
> >1600 microseconds. Why 1600? I read somewhere that the hd44780 device needs
> 1640 ms to clear the display.
> So I tried different values between 2000 and 1400. The fact is that a small
> value causes the display to be refreshed more frequently, but a too small
> value causes the display not to function properly. The value 1600 walked on
> my configuration, a celeron 400Mhz on an abit BE6 motherboard, and the
> display was refreshed twice a second. I tried it on a celeron 500 Mhz with
> an intel i810 chipset, but it didn't work. I had to put 2400. The display
> was then refreshed only once a second.
> Also, you'll need to ask permission to write on port 0x80. You ask it in
> function HD44780_init() file hd44780.c.
>
> // Set up io port correctly, and open it...
> if ((ioperm(port,3,1)) == -1) {
> fprintf(stderr, "HD44780_init: failed (%s)\n", strerror(errno));
> return -1;
> }
>
> becomes
>
> // Set up io port correctly, and open it...
> if ((ioperm(port,3,1)) == -1) {
> fprintf(stderr, "HD44780_init: failed (%s)\n", strerror(errno));
> return -1;
> }
>
> // For delaying after a writing operation ...
> if ((ioperm(0x80,1,1)) == -1) {
> fprintf(stderr, "HD44780_init (delaying): failed (%s)\n",
> strerror(errno));
> return -1;
> }
>
> usleep() is also used in HD44780_init(), but it's not a problem, the
> function is called only one time.
>
> I hope what I said wasn't too confusing. I know my english is not great.
> I have joined my hd44780.c and hd44780.h files.
> Don't forget to try different values for the loops in HD44780_senddata().
>
> Bye
>
> Kra AMANI
> IT-Telecom student - ESIGETEL
> France
>
>
>




-----------------------------------------------------------
To unsubscribe from this list send a blank message to
lcdproc-unsubscribe AT lists.omnipotent.net




Archive powered by MHonArc 2.6.18.

Top of page