afbecker
- 21st February 2006, 19:01
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.
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.