Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases
PIC Serial Backpack I - Make your own Serial LCD
Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo, Fast351, hydrolisk1792
-
- Posts: 19
- Joined: March 16th, 2006, 11:27 am
- Contact:
it seems, that problem is in PIC, cos there doesn?t appear anythink except black blocks. I didn?t programm it myself, coz I don?t have programmer
I gave it to my friend to programm it and I also gave him that guide I had downloaded from your site, so it seems to be ok. I?ll check the wiring and see what happen 


-
- Posts: 19
- Joined: March 16th, 2006, 11:27 am
- Contact:
ok, I checked it, but it seems to be wired well, so problem is in PIC 
I will have to give it to my friend to reprogramm it, but it will take some time. Is it possible to see, that programming failes? He told me, that he had programmed it according that manual and at the end, there appeared that programming was OK, but it wasn?t
or, maybe that PIC is dead? Is it possible to check it somehow, that it is/isn?t dead? Thx

I will have to give it to my friend to reprogramm it, but it will take some time. Is it possible to see, that programming failes? He told me, that he had programmed it according that manual and at the end, there appeared that programming was OK, but it wasn?t

or, maybe that PIC is dead? Is it possible to check it somehow, that it is/isn?t dead? Thx
-
- Forum Supporter
- Posts: 734
- Joined: October 15th, 2005, 10:39 am
- Location: Romania
- Contact:
When he programs it he can verify the data written, most programming software has this option.
If it isn't dead than maybe he made some mistake selecting the fuses (checkboxes that set some PIC parameters while being programmed) especially internal oscillator should be selected on.
In the worst case the lcd isn't HD44780 compatible, have you tried it before connected to LPT?
Edit:
@_X7JAY7X_ I am playing right now with this setup, works like a charm! Few minor gliches: in winamp spectrum analyzer the first row characters in the upper part show a line in the transition from a full block to empty block and when LCDSmatie starts for a fraction of time appears a "Yen" symbol at first row first column. Still testing. Great work! I have been testing with HD44780 and KS0065 2x24, 2x16 and 1x16.
The backlight toggles on when smartie starts, you can turn it off but never turn on again, only by restarting smartie it turns on again. This is the same with Backlight 0/1/flash commands. Adjusting the brightness turns backlight on again. Any ideas?
BTW any news on the 877 code?
If it isn't dead than maybe he made some mistake selecting the fuses (checkboxes that set some PIC parameters while being programmed) especially internal oscillator should be selected on.
In the worst case the lcd isn't HD44780 compatible, have you tried it before connected to LPT?
Edit:
@_X7JAY7X_ I am playing right now with this setup, works like a charm! Few minor gliches: in winamp spectrum analyzer the first row characters in the upper part show a line in the transition from a full block to empty block and when LCDSmatie starts for a fraction of time appears a "Yen" symbol at first row first column. Still testing. Great work! I have been testing with HD44780 and KS0065 2x24, 2x16 and 1x16.
The backlight toggles on when smartie starts, you can turn it off but never turn on again, only by restarting smartie it turns on again. This is the same with Backlight 0/1/flash commands. Adjusting the brightness turns backlight on again. Any ideas?
BTW any news on the 877 code?

Last edited by caesar on April 1st, 2006, 9:11 pm, edited 1 time in total.
-
- Posts: 19
- Joined: March 16th, 2006, 11:27 am
- Contact:
-
- Hardware Genie - Plugin Author
- Posts: 374
- Joined: February 16th, 2005, 10:24 pm
- Location: Michigan
Few minor gliches: in winamp spectrum analyzer the first row characters in the upper part show a line in the transition from a full block to empty block and when LCDSmatie starts for a fraction of time appears a "Yen" symbol at first row first column. Still testing. Great work! I have been testing with HD44780 and KS0065 2x24, 2x16 and 1x16.
The backlight toggles on when smartie starts, you can turn it off but never turn on again, only by restarting smartie it turns on again. This is the same with Backlight 0/1/flash commands.
Can you please maybe get a picture of the spectrum analyzer when it transitions to give me a better idea of what it is doing?
The "yen" symbol is most likely a misinterpreted command from Smartie. It only appears for a second at most when smartie first starts.
The backlight toggle is a known problem with that firmware. I havent tracked the problem down to exactly what is causing it yet. I believe that smartie is using different backlight commands for when smartie starts and when you use the toggle command. The next and most likely last release of the 16F628 code (version 2.X) will fix a few minor bugs and hopefully include a couple GPO's and maybe a button.
J
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
My implementation of the MO commands (very similar to X7JAY7X) does the same thing when Smartie starts - a couple of random characters are briefly displayed before the proper Smartie screen appears. I'm not sure if it's the same characters every time. I might have a look with an RS232 grabber/logger to check what Smartie sends as it starts up.
I have the backlight control on my version working properly, as far as I can tell. ON/OFF, Flash and brightness (no software contrast control) works properly in Smartie.
This is how my implementation does it: In my code, I preset the backlight PWM to 50% in the initialisation, but don't enable the PWM. MO command 66 turns the backlight ON at the current PWM setting (ie 50% unless it has been changed by Smartie). MO command 70 turns PWM off but doesn't change the duty cycle. MO commands 152 and 153 set the backlight PWM duty cycle AND enable the PWM output. I don't actually save the PWM value to EEPROM though (MO modules do this for the set-and-remember commands like 152). I don't have any provision for software contrast control (just a variable resistor in the circuit), so the contrast commands are simply ignored.
Matt.
I have the backlight control on my version working properly, as far as I can tell. ON/OFF, Flash and brightness (no software contrast control) works properly in Smartie.
This is how my implementation does it: In my code, I preset the backlight PWM to 50% in the initialisation, but don't enable the PWM. MO command 66 turns the backlight ON at the current PWM setting (ie 50% unless it has been changed by Smartie). MO command 70 turns PWM off but doesn't change the duty cycle. MO commands 152 and 153 set the backlight PWM duty cycle AND enable the PWM output. I don't actually save the PWM value to EEPROM though (MO modules do this for the set-and-remember commands like 152). I don't have any provision for software contrast control (just a variable resistor in the circuit), so the contrast commands are simply ignored.
Matt.
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I got the command list from the Matrix Orbital datasheets for the MOS series. These are economy modules similar to the "backpacks" we're describing here - backlit alphanumeric LCD of 2x16 to 4x20 (mine doesn't support 4x40, I think Jay's does now), with serial input and optionally a few general purpose logic outputs (GPOs).
I based my backpack on the datasheet for the MOS-AL162A series (2x16 chars), although I now have it on a 4x20 display. Download it from the Matrix Orbital website.
My firmware implements only the basic commands necessary for controlling cursor position, writing characters, setting custom characters, initialising the display and controlling the backlight. Other commands are ignored (like setting up costom bargraphs, contrast control, auto line-wrap etc). I guess Jay's command set is similar.
From my source code:
Matrix Orbital Commands Supported:
66 - Backlight ON (at previously set level, or 50% at startup)
70 - Backlight OFF
71 - Set cursor pos (col, row)
72 - Send cursor home
74 - Underline cursor on
75 - Underline cursor off (any cursor off)
76 - Move cursor left 1 space (doesn't properly wrap between lines)
77 - Move cursor right 1 space (doesn't properly wrap between lines)
78 - Define custom char (addr, 8 bytes pattern)
83 - Block cursor on
84 - Block cursor off (any cursor off)
88 - Clear display
152 - Set backlight brightness (0-255) (NB doesn't store setting)
153 - Set backlight brightness (0-255 where 0=off, 255=max)
Other commands ignored
This set of commands is about all you need for LCDSmartie, unless you want to do fancy stuff like big characters.
Matt.
I based my backpack on the datasheet for the MOS-AL162A series (2x16 chars), although I now have it on a 4x20 display. Download it from the Matrix Orbital website.
My firmware implements only the basic commands necessary for controlling cursor position, writing characters, setting custom characters, initialising the display and controlling the backlight. Other commands are ignored (like setting up costom bargraphs, contrast control, auto line-wrap etc). I guess Jay's command set is similar.
From my source code:
Matrix Orbital Commands Supported:
66 - Backlight ON (at previously set level, or 50% at startup)
70 - Backlight OFF
71 - Set cursor pos (col, row)
72 - Send cursor home
74 - Underline cursor on
75 - Underline cursor off (any cursor off)
76 - Move cursor left 1 space (doesn't properly wrap between lines)
77 - Move cursor right 1 space (doesn't properly wrap between lines)
78 - Define custom char (addr, 8 bytes pattern)
83 - Block cursor on
84 - Block cursor off (any cursor off)
88 - Clear display
152 - Set backlight brightness (0-255) (NB doesn't store setting)
153 - Set backlight brightness (0-255 where 0=off, 255=max)
Other commands ignored
This set of commands is about all you need for LCDSmartie, unless you want to do fancy stuff like big characters.
Matt.
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I did some testing to find out what Smartie sends when it starts up. Here's the list (command numbers in decimal):
then display appropriate screen.
I didn't know about commands 65 and 96, since I'd only looked at the datasheet for a module with no keypad support... so I added them to the list of ignored commands that have no parameter, and that stopped the stray characters appearing on the LCD when Smartie started up.
My firmware was trying to read and discard a parameter byte for those commands, which or course messed up the next couple of commands. That might be something to check in your code, Jay.
Matt.
Code: Select all
*turn off each GPO (8x command 86)
*turn off block cursor (84)
*clear display (88)
*underline cursor off (75)
*auto scroll off (82)
*autowrap off (68)
*auto transmit keypresses on (65)
*auto repeat keypress mode off (96)
*backlight on forever (66,0)
*contrast to {whatever you set in the MO control dialog} (80,x)
*backlight brightness to {whatever you set in the MO control dialog} (152,x)
*set custom char 1 to degrees symbol (78)
*set custom chars 2-4 to bargraph symbols (3x 78)
*set custom chars 3-8 to blank (4x 78)
I didn't know about commands 65 and 96, since I'd only looked at the datasheet for a module with no keypad support... so I added them to the list of ignored commands that have no parameter, and that stopped the stray characters appearing on the LCD when Smartie started up.
My firmware was trying to read and discard a parameter byte for those commands, which or course messed up the next couple of commands. That might be something to check in your code, Jay.
Matt.
-
- Hardware Genie - Plugin Author
- Posts: 374
- Joined: February 16th, 2005, 10:24 pm
- Location: Michigan
It is probably the contrast command. Even if you have no code in there you should still have a case for if the commands. Just so the byte is read in where it should be read in. I will have to look at mine again and see if I did that.
Also for the backlight. I remember what I did. I think I just used the backlight brightness and backlight off command. That is why mine only turns on at startup. I will fix it this week and send out a new firmware. My backlight doesnt save it either, I can make it do it but smartie sends a backlight command every time you start the LCD. I didnt think its necessary unless you dont use the LCD with smartie.
I also plan on adding 2 GPOs for right now for the 628a version.
J
Also for the backlight. I remember what I did. I think I just used the backlight brightness and backlight off command. That is why mine only turns on at startup. I will fix it this week and send out a new firmware. My backlight doesnt save it either, I can make it do it but smartie sends a backlight command every time you start the LCD. I didnt think its necessary unless you dont use the LCD with smartie.
I also plan on adding 2 GPOs for right now for the 628a version.
J
-
- Posts: 19
- Joined: March 16th, 2006, 11:27 am
- Contact:
-
- Forum Supporter
- Posts: 734
- Joined: October 15th, 2005, 10:39 am
- Location: Romania
- Contact:
-
- Hardware Genie - Plugin Author
- Posts: 374
- Joined: February 16th, 2005, 10:24 pm
- Location: Michigan
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I'd rather have buttons than GPOs, so you can switch between screens or themes, control winamp, etc. My display isn't mounted in the PC, so I probably would never use GPOs for fans or the like. A warning buzzer/beeper might be an idea though.
I'm planning to add 3 or 4 buttons to my implementation sometime (already have one that turns on the backlight). I could squeeze in 3 buttons and a single GPO, using all the I/O on the 628.
I also want to add a software FIFO buffer to the RS232 receive, since at the moment I'm relying on the PIC UART to do that, but it can only buffer 2 or 3 characters. It's quite possible (even at 9600baud, and particularly at 19200) that overflows will occur, though I haven't had a problem yet. I suspect Smartie spaces out the commands a bit to avoid such overflows.
It would take a bit longer to write to the LCD in 4-bit mode, but it's probably not much slower than 8-bit, since the LCD takes a while to process each character (typically around 40us), and longer for some commands (1.5ms), and it only takes a handful of microseconds to put two nibbles on the data bus.
I'm using 4-bit mode on mine. At the moment, my firmware simply waits in a loop for a bit more than the expected time required, since one LCD I'm using doesn't seem to properly do the "busy" flag (posible ESD damage?). The other LCD does it fine. That frees up the R/W line for GPO or whatever.
Matt.
I'm planning to add 3 or 4 buttons to my implementation sometime (already have one that turns on the backlight). I could squeeze in 3 buttons and a single GPO, using all the I/O on the 628.
I also want to add a software FIFO buffer to the RS232 receive, since at the moment I'm relying on the PIC UART to do that, but it can only buffer 2 or 3 characters. It's quite possible (even at 9600baud, and particularly at 19200) that overflows will occur, though I haven't had a problem yet. I suspect Smartie spaces out the commands a bit to avoid such overflows.
It would take a bit longer to write to the LCD in 4-bit mode, but it's probably not much slower than 8-bit, since the LCD takes a while to process each character (typically around 40us), and longer for some commands (1.5ms), and it only takes a handful of microseconds to put two nibbles on the data bus.
I'm using 4-bit mode on mine. At the moment, my firmware simply waits in a loop for a bit more than the expected time required, since one LCD I'm using doesn't seem to properly do the "busy" flag (posible ESD damage?). The other LCD does it fine. That frees up the R/W line for GPO or whatever.
Matt.
-
- Plugin Author
- Posts: 71
- Joined: November 22nd, 2005, 7:12 pm
- Location: Curitiba, Paran?, Brazil
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
Using the PIC at 20MHz means you need an external oscillator (crystal plus capacitors), which puts the cost/complexity up slightly. One drawback is that the crystal oscillator uses up two precious pins that are used for I/O in the internal osc mode.
By adding a few components (and some software complexity), you could multiplex several buttons with the LCD data lines. See Bob Blick's LCDterm for a really adventurous LCD terminal based on a humble 16F84 - 20 buttons, 4x20 LCD and 5 LEDs with serious multiplexing. This could be adapted for the 16F628. This is where I got the idea for my version from, before discovering LCDSmartie and that Jay had already done it...
I think the internal 4MHz oscillator is probably fast enough - the LCD is comparatively slow (the HD44780 is usually clocked at 270kHz!). For example, the minimum width for the E (enable) pulse is 250-500ns depending on LCD. Then you have to wait for the LCD to process the command or character (40us or 1.5ms). One PIC instruction cycle is 1000ns at 4MHz. Of course, it wouldn't hurt to run the PIC faster.
If you use a software FIFO buffer (interrupt-driven) on the RS232 receive, you're unlikely to lose any data, even at higher baud rates.
Matt.
By adding a few components (and some software complexity), you could multiplex several buttons with the LCD data lines. See Bob Blick's LCDterm for a really adventurous LCD terminal based on a humble 16F84 - 20 buttons, 4x20 LCD and 5 LEDs with serious multiplexing. This could be adapted for the 16F628. This is where I got the idea for my version from, before discovering LCDSmartie and that Jay had already done it...
I think the internal 4MHz oscillator is probably fast enough - the LCD is comparatively slow (the HD44780 is usually clocked at 270kHz!). For example, the minimum width for the E (enable) pulse is 250-500ns depending on LCD. Then you have to wait for the LCD to process the command or character (40us or 1.5ms). One PIC instruction cycle is 1000ns at 4MHz. Of course, it wouldn't hurt to run the PIC faster.
If you use a software FIFO buffer (interrupt-driven) on the RS232 receive, you're unlikely to lose any data, even at higher baud rates.
Matt.
-
- Posts: 30
- Joined: March 21st, 2006, 6:43 pm
- Location: Oxford, UK
Can't you just use a PIC with more pins? Using the 18F2550 (28 pin), I have
PORTA: RA0=buzzer, RA1=unused, RA2-RA5=GPOs
PORTB dedicated to LCD (D0-D3,RS,RW,EN,backlight)
PORTC: RC0-RC2=buttons, RC3=unusable, RC4+RC5=USB, RC6-RC7=unused
I plan to use RC7 for a serial in from an IR remote, but otherwise there are two spare pins. If you get rid of the GPOs and use a PIC that lets you use RC3, that's 7 free pins, allowing for 12 buttons with simple multiplexing -- more than enough to be honest... and if you use an internal OSC, that's another two pins free, allowing 20 buttons or 12 buttons + 2 GPOs.
Don't worry about the low clock speed Matt: A 3.6MHz AVR can do 20x4 with eight buttons and 19200baud no problem.
ch424
PORTA: RA0=buzzer, RA1=unused, RA2-RA5=GPOs
PORTB dedicated to LCD (D0-D3,RS,RW,EN,backlight)
PORTC: RC0-RC2=buttons, RC3=unusable, RC4+RC5=USB, RC6-RC7=unused
I plan to use RC7 for a serial in from an IR remote, but otherwise there are two spare pins. If you get rid of the GPOs and use a PIC that lets you use RC3, that's 7 free pins, allowing for 12 buttons with simple multiplexing -- more than enough to be honest... and if you use an internal OSC, that's another two pins free, allowing 20 buttons or 12 buttons + 2 GPOs.
Don't worry about the low clock speed Matt: A 3.6MHz AVR can do 20x4 with eight buttons and 19200baud no problem.
ch424
-
- Hardware Genie - Plugin Author
- Posts: 374
- Joined: February 16th, 2005, 10:24 pm
- Location: Michigan
-
- Plugin Author
- Posts: 71
- Joined: November 22nd, 2005, 7:12 pm
- Location: Curitiba, Paran?, Brazil
-
- Posts: 30
- Joined: March 21st, 2006, 6:43 pm
- Location: Oxford, UK
J, looking at your schematic, you could put all the LCD stuff onto porta, leaving 7 pins free once RB1 has been used.
7=3+4 therefore you can have 3x4=12 buttons with normal multiplexing...
Or have two GPOs, leaving 5 pins free for eight buttons, like this:

And just three external components save for the buttons.
Obviously that'd still work with your current pin assignment too.
ch424
7=3+4 therefore you can have 3x4=12 buttons with normal multiplexing...
Or have two GPOs, leaving 5 pins free for eight buttons, like this:

And just three external components save for the buttons.
Obviously that'd still work with your current pin assignment too.
ch424
-
- Hardware Genie - Plugin Author
- Posts: 374
- Joined: February 16th, 2005, 10:24 pm
- Location: Michigan