LCDOUT Implementation


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20

    Default LCDOUT Implementation

    First I'll explain my hardware setup. I have a 16F628A as the front end to a LCD module with a typical HD44780 controller. I'm running a 4Mhz crystal using XT configuration. !MCLR is defined as input, power-up is enabled, WDT & LVP is disabled along with the rest.

    I built this circuit originally to run an assembler program on a 16F84 that I programmed with it. After I tweaked it, the program worked really well. Recently I accidentally destroyed the PIC with the original program. Long and short of it is I can't get the assembler code to work any longer so I've been trying to implement PICBasic "LCDOUT" in such a way as to input serial on a single line to the 16F628A / LCD construct. This way the host PIC only needs to dedicate one line to the display function.

    To state the obvious, I have thoroughly gone over the various aspects of inverted signal, baud rate and the whole serial specification business. I have settled on operating at 9600, N, 8, 1 in two line mode since the module is capable of it. I also understand the control and data codes to sent to the HD44780.

    In my latest (unsuccessful) attempt, I have build my 16F628A program around the following concept. I use "DEBUGIN" to read the serial line, in this case PORTA.0 (Yes, comparators are set off). I assign the port read to a byte sized variable named DataA. I have then paused 1000us before using "LCDOUT" to write DataA directly to the LCD, the LCD defines having previously been set. This idea relies on the character being read and passed along to the LCD without a character buffer. As I mentioned, it doesn't work. There may be a timing problem here and I understand the LCD controller is probably the slowest component in the mix but I would still think that at 9600 baud there still should be a fair amount of time for each character to be picked up and passed along.

    If anyone has tried this and can offer suggestions or flaws in my reasoning, please offer a comment.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    afbecker, are you using 8 lines or 4 lines connected to the lcd display? It seems from your posting you are trying to build a serial "backpack" controller for your lcd display. I have done this before and it works quite well. I did however use 8 line connection to the lcd display as the data can be transmitted in 1 strobe rather than 2. Just remember that some of the commands for the lcd display require at least 5 Ms. to execute ie (clear lcd, and some of the cursor positioning commands.

    Dave Purola,
    N8NTA

  3. #3
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default LCD implementation

    Dave,

    Yes, I am using all 8 lines and they are all hardwired from PortB.0 through .7 to the respective pads on the LCD module.

    If you have a copy of the essential portion of the code, I could probably work out the details. If that isn't available perhaps a conceptual explanation along with mention of any quirks or pitfalls one might encounter.

    Thanks,
    Allan

  4. #4


    Did you find this post helpful? Yes | No

    Default LCDOUT Implementation

    Can you grab one character at a time coming into the PIC, stick them together in an array one at a time (up to the length of the LCD display line), and then spit it all out at once with LCDOUT when you receive a <13> or something?

    This worked well for me... at 2400 baud, mind you... As long as your text arrives with enough time between the <13> and the next line of stuff to send it all out to the LCD, it should work.

    ------------------Picster---------------

  5. #5
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default More on LCD

    I had thought conceptually about this approach and like yourself, could have probably got a string buffer to work.

    Ultimately I took what I think was the easiest course of action and that used in most of the posts I found here. Instead of using DEBUGIN I used HSERIN on the input side and the LCDOUT on the output side at 2400 baud with a and 4 pin data bus to the module. The code illustrated in several posts just envolved a character for character transfer with the PIC just cycling through read, biding the time between characters. At 2400 this seemed to work fine.

    This solution meant changing my circuit board so that the hardware RX pin was used for input. On the 16F628A this meant I could not use all 8 PortB pins for output to the module. I disconnected the wires from B0-B3 to the module and just used B4-B7. The whole board was designed for an assembler code by one Tom Coonan which is available on the WEB. I just couldn't get it ported over to the 16F628A and have it work right. After 3 weeks of messing with it I opted to use the PIC Basic solution.

    In any case, I have the "Backpack" working again and at 2400 I have tested it with another PIC as the sender and aslo Hyperterminal on a PC. It works fine now!

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