Newbies' guide to parallel HD44780 LCDs and Winstar OLEDs / AXE133 as a project board

Greyling

New Member
Take advantage of the greater speed

  • Faster - the parallel interface is faster than any serial display and this is particularly true for an LCD at 2400 baud. Most serial LCDs (including the AXE033) consist of a parallel LCD and microcontroller to convert the serial data to parallel so from that you can see that it is impossible for a serial LCD to be as fast as a parallel LCD. An example of how you can exploit this extra speed is to have a 'firmware update' screen where about twice a second the PICAXE writes the string 'Updating...' to the screen; issues the disconnect command; issues the reconnect command; writes the string 'Ready' or similar to the screen, and when no attempt is being made to program the PICAXE the screen will just say 'Ready' but as soon as the download is started it will change to 'Updating'.
First - the firmware update screen mentioned above. This cannot be done on an OLED because the response time of an OLED is instant so the display will flash no matter how fast you do this, but an LCD has slower response time so it is possible to quickly flash a different message without the user seeing it. This is not possible with the serial interface but is possible on the parallel interface. Because PICAXE uses an interpreter it is slow so the PICAXE should ideally be set to run at its highest speed and there is also no time for the relatively slow lookup command so we'll need to go back to the very first example that displays stuff. It is only needed for the part that's in a loop and anything else can still use the lookup command.

This example will display 'Firmware Update' on the top line using a lookup (because it will only be sent to the LCD once - before the loop) then the 'Ready' message will be displayed on the bottom line. Regularly, 'Updating...' is sent to the LCD, the reconnect command is executed then the disconnect command is executed then 'Ready' is sent to the LCD again. Because this happens fast, the LCD appears to say 'Ready' continuously then displays 'Updating...' as soon as you attempt to program the PICAXE. Since the PICAXE is now operating at 32MHz and the calculated values for the Enable pulses in the initialization sequence are only adequate for 16Mhz, the values must be doubled or it won't work. Here is the complete code:
Code:
#picaxe 18m2
#no_data
symbol lcddata = pinsB
symbol rs = C.7
symbol enable = C.6

start:
	setfreq m32
	dirsB = 255								'Set pinsB as outputs
	low rs								'instruction mode
	output enable							'set enable pin as output
	
	lcddata = %00111011 : pulsout enable,32		'Function Set: 8-bit, 2 lines, font 11
	lcddata = %00000001 : pulsout enable,1216		'Clear display
	lcddata = %00001100 : pulsout enable,1216		'Display on/off control: Display on, cursor off, blink off
	lcddata = %00000110 : pulsout enable,32		'Entry mode set: Increment, cursor shift
main:
	low rs
	lcddata = 128 : pulsout enable,1
	high rs
	for b4 = 0 to 15
		lookup b4,("Firmware Update "),lcddata
		pulsout enable,1
	next
	do
		low rs
		lcddata = 194 : pulsout enable,1
		high rs
		lcddata = "U" : pulsout enable,1
		lcddata = "p" : pulsout enable,1
		lcddata = "d" : pulsout enable,1
		lcddata = "a" : pulsout enable,1
		lcddata = "t" : pulsout enable,1
		lcddata = "i" : pulsout enable,1
		lcddata = "n" : pulsout enable,1
		lcddata = "g" : pulsout enable,1
		lcddata = "." : pulsout enable,1
		pulsout enable,1
		pulsout enable,1
		reconnect
		disconnect
		low rs
		lcddata = 194 : pulsout enable,1
		high rs
		lcddata = 32 : pulsout enable,1
		pulsout enable,1
		pulsout enable,1
		lcddata = "R" : pulsout enable,1
		lcddata = "e" : pulsout enable,1
		lcddata = "a" : pulsout enable,1
		lcddata = "d" : pulsout enable,1
		lcddata = "y" : pulsout enable,1
		lcddata = 32 : pulsout enable,1
		pulsout enable,1
		pulsout enable,1
		pause 1000
	loop
The above code is, of course, an example, which can be integrated in to the rest of a project. In a project, if possible, it should be modified to use the timer (instead of the pause) so that if the user decides not to program the PICAXE exiting the firmware update screen will happen promptly instead of feeling 'sluggish' which is what can happen when pauses are used.
[HR][/HR]The more interesting application for the extra speed that using a parallel interface uses is a bargraph display! A good bargraph display needs to be responsive and a serial LCD just cannot do this very well so if using a serial display it will only update the bargraph display a handful of times a second and the bargraph will 'jump' if the potentiometer it is controlled by (etc.) is adjusted quickly. Using a parallel LCD will make the bargraph very responsive so I only recommend using a bargraph with a parallel display, but serial display examples are still available if you really must use one.

See: LCD/OLED analogue bargraph
 
Top