LCDOUT & interrupts


Closed Thread
Results 1 to 5 of 5
  1. #1
    lab310's Avatar
    lab310 Guest

    Default LCDOUT & interrupts

    How much time does typical LCDOUT (for example LCDOUT $fe,1,"HELLO WORLD !!!" ) takes ? I always get problem when using interrupts and LCDOUT. Is there a simple way to overcome this ?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The LCDOUT is pretty fast. It really depends on the DEFINES for the LCD.

    Each character takes 10-15 us to set up, then the program will wait an amount of time determined by the "DEFINE LCD_DATAUS" statement. It defaults to 50uS if no DEFINE is supplied.

    Commands like Clear screen, or home cursor take longer. And are controlled by "DEFINE LCD_COMMANDUS" which defaults to 2000uS.

    However, LCD data is clocked out synchronously. This means that it will not be affected by interrupts. At least not by interrupt routines that behave properly.

    What kind of interrupts are you using. ON INTERRUPT, or ASM interrupts?

    Can you post the code?

    Darrel

  3. #3
    lab310's Avatar
    lab310 Guest


    Did you find this post helpful? Yes | No

    Default

    All my interrupt routines are ASM, ON INTERRUPT won't do as I need a REAL interrupts , not "I'll do it if I can" type. I'm sure that they are properly writen, they work fine if I don't utilise LCD. My interrupts are pretty fast, always in range of 200-1000 us and execute in couple of us. Problems manifests as displaying garbage on LCD, missing lines or some strange thing as shifting entire lcd to left or freezing it completly. Few time it even managed to reset PIC (had to increase WDT prescaler by far to get read of this).

    I didn't know that commands take such long time (2000us). Is this a time to PIC to issue or LCD to process command? If second, I could manage to to overcome this. If first, it is the problem since my interrupt vould cut this command several times during execution.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Are you remembering to SAVE all your registers and pointers BEFORE executing your Interrupt? Are you RESTORING everything back to the way it was BEFORE you leave your interrupt? quote: "My interrupts are pretty fast... and execute in couple of us." Somehow from your statement I don't think you're doing all the required housekeeping.

    PICBasic's LCD Routine is in the middle of transferring half a byte (or command) to the LCD when your interrupt pops-up, tears it away from what it's doing, and then returns it an indeterminate time later supposedly to carry on from where it left off. Will the LCD routine still find all the registers EXACTLY the way it EXPECTS to have them? Have you interfered with a critical timing operation? Have you double-checked with the Hitachi Controller manual to see you're not comitting any sins?

    Sometimes there are CRITICAL operations that must be completed BEFORE you go and do something else. Go study and understand the LCD code before you blindly go interrupting it. There are rules for interrupts.

  5. #5
    Join Date
    Feb 2003
    Location
    Delaware
    Posts
    30


    Did you find this post helpful? Yes | No

    Default

    I know that this isn't going to be very helpful but I use ASM interrupts with an LCD alot and I don't have any problems. I would check you're context saving as Melanie suggested. Also try writting short code pieces to try and test/isolate the problem. If you post some code we could probably help more.

    Regards,

    Joe

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 07:31
  3. Help GPS read with serin
    By leinske in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th September 2007, 02:33
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts