other LCD device?

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
FLJ
Posts: 4
Joined: Wed Feb 01, 2012 3:47 am
Has thanked: 5 times
Contact:

other LCD device?

Post by FLJ »

Hello, I just bought Flowcode 5 and I am new.

Is there only one choice of LCD device? The LCD include in Flowcode use 4 pin for data and 2 pin for R/S and En. What if I want to use another type that use a 8 bit Data ports with R/W, En and RS in Flowcode?

Thank you

User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

Re: other LCD device?

Post by 1Handypal »

Hello FLJ and welcome to the forum.
I am in the same situation and still awaiting reply from somebody proficient and kind enough to explain how 8 bit interfacing is done.
See the link : http://www.matrixmultimedia.com/mmforum ... =7&t=10034
It looks that it is not much supported...
There are some very good display options that need addressing and ideally a tutorial. I believe it is quite important part of any project to be able to use a display.
Let's see if we can get any good response with examples from knowledgeable individuals.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: other LCD device?

Post by kersing »

There is a large choice of displays with all kinds off different interfaces available on the market. I do not think Matrix will be able to provide components for every one of them. If you use one of the LCD displays with a more or less standard electrical and command interface the provided component can be used. The standard display used on e-blocks has an 8 bit data interface, however the manufacturer provides a mode where only 4 bits of the data bus are used, enabling circuit designers to save a couple of I/O pins while having to spend a little more time to send the data (two I/O operations of 4 bits, nor one of 8 bits), if you check the LCD eblock data sheet it will show the wiring and commands used for this display. Yours may be compatible...

If you want to use a different display you will have to create the circuit and code yourself. Depending on your level of expertise you could use C for this or write macros in flowcode. To start, check the data sheet provided by the manufacturer for the commands and timing diagrams. If (hypothetical display) the display requires 8 data bits and a strobe when data is available you could connect the data to port B of a pic and strobe to port A bit 0. Now if you want to transfer data to the display, write a flowchart where you use an output icon to set all bits of port B to the required value, wait a bit (delay icon) to let the date lines stabilize, set port A bit 0 to 1 (output icon), wait the minimum time specified for the strobe listed in the data sheet and set port A bit 0 to 0. Do this for every byte you want to send to the display to initialize and display your data.

The disadvantage is the simulation mode of flowcode will not have a component showing the results on a simulated display, you will have to test with real hardware.

Hope this answers (at least part of) your question.

Regards,

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: other LCD device?

Post by fotios »

FLJ wrote:Hello, I just bought Flowcode 5 and I am new.

Is there only one choice of LCD device? The LCD include in Flowcode use 4 pin for data and 2 pin for R/S and En. What if I want to use another type that use a 8 bit Data ports with R/W, En and RS in Flowcode?

Thank you
Hello FLJ
Practically speaking, a 90% of LCD displays offered on the market, are covered by FlowCode. Thru FlowCode you could select among 11 different types, up to 40 X 2 characters. And that the interface used from most LCDs is the standard of 4 data lines. Most LCDs use the HD44780 proccesor or a compatible. There are also VFD displays - like NORITAKE ITRON - that use the same interface, i.e. are compatible with HD44780. A 90% of people also (and not necessary FlowCode users) use this interface to make economy in MCU pins. The response speed (if you fear about a "blanking" of characters before their renewal) is very fast, the "blanking" is mostly an issue of bad code. Correctly developed code has no blanking issues. LCDs are some "time critical" devices, but new MCUs can drive accurately LCDs with their precision internal oscillator module of +/-1% accuracy. There is no reason of use external XTALs etc in most cases.
I have tried without problem LCDs of 2 X16 up to 4 X 20 characters using the 4 data lines mode and in all cases i used MCUs with internal oscillator modules.
Unless you have something "special" in your mind.
Regards
Fotis
Last edited by fotios on Wed Feb 01, 2012 11:04 am, edited 1 time in total.
Best Regards FOTIS ANAGNOSTOU

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: other LCD device?

Post by Steve »

Thanks for the reply, Jac. I just want to add a comment to this:
kersing wrote:The disadvantage is the simulation mode of flowcode will not have a component showing the results on a simulated display, you will have to test with real hardware.
In Flowcode V4 and V5, you can customize the C code behind the components. This generally does not affect simulation - i.e. the simulated component will work as if it is the original component.

In fact, with the LCD component it may be very easy to alter the C code of the component so it works with an 8-bit data port. Only the "RawSend" macro should be customized. Here is the original code (in V5):

Code: Select all

	MX_UINT8 pt;

	FC_CAL_Bit_Low(%a_PORT0, %a_BIT0);
	FC_CAL_Bit_Low(%a_PORT1, %a_BIT1);
	FC_CAL_Bit_Low(%a_PORT2, %a_BIT2);
	FC_CAL_Bit_Low(%a_PORT3, %a_BIT3);
	FC_CAL_Bit_Low(%a_PORT4, %a_RS);
	FC_CAL_Bit_Low(%a_PORT5, %a_E);
	pt = ((in >> 4) & 0x0f);
	if (pt & 0x01)
	    FC_CAL_Bit_High(%a_PORT0, %a_BIT0);
	if (pt & 0x02)
	    FC_CAL_Bit_High(%a_PORT1, %a_BIT1);
	if (pt & 0x04)
	    FC_CAL_Bit_High(%a_PORT2, %a_BIT2);
	if (pt & 0x08)
	    FC_CAL_Bit_High(%a_PORT3, %a_BIT3);
	if (mask)
	    FC_CAL_Bit_High(%a_PORT4, %a_RS);
	%a_DELAY;
	FC_CAL_Bit_High (%a_PORT5, %a_E);
	%a_DELAY;
	FC_CAL_Bit_Low (%a_PORT5, %a_E);
	pt = (in & 0x0f);
	%a_DELAY;
	FC_CAL_Bit_Low(%a_PORT0, %a_BIT0);
	FC_CAL_Bit_Low(%a_PORT1, %a_BIT1);
	FC_CAL_Bit_Low(%a_PORT2, %a_BIT2);
	FC_CAL_Bit_Low(%a_PORT3, %a_BIT3);
	FC_CAL_Bit_Low(%a_PORT4, %a_RS);
	FC_CAL_Bit_Low(%a_PORT5, %a_E);
	if (pt & 0x01)
	    FC_CAL_Bit_High(%a_PORT0, %a_BIT0);
	if (pt & 0x02)
	    FC_CAL_Bit_High(%a_PORT1, %a_BIT1);
	if (pt & 0x04)
	    FC_CAL_Bit_High(%a_PORT2, %a_BIT2);
	if (pt & 0x08)
	    FC_CAL_Bit_High(%a_PORT3, %a_BIT3);
	if (mask)
	    FC_CAL_Bit_High(%a_PORT4, %a_RS);
	%a_DELAY;
	FC_CAL_Bit_High (%a_PORT5, %a_E);
	%a_DELAY;
	FC_CAL_Bit_Low (%a_PORT5, %a_E);
	%a_DELAY;
And this is a very quick, untested guess at how the code should look when using an 8-bit data port:

Code: Select all

	MX_UINT8 pt;

	FC_CAL_Bit_Low(porta, 0);
	FC_CAL_Bit_Low(porta, 1);
	FC_CAL_Bit_Low(porta, 2);
	FC_CAL_Bit_Low(porta, 3);
	FC_CAL_Bit_Low(porta, 4);
	FC_CAL_Bit_Low(porta, 5);
	FC_CAL_Bit_Low(porta, 6);
	FC_CAL_Bit_Low(porta, 7);
	
	FC_CAL_Bit_Low(portb, 0);
	FC_CAL_Bit_Low(portb, 1);
	
	pt = in & 0xFF;
	
	if (pt & 0x01)
	    FC_CAL_Bit_High(porta, 0);
	if (pt & 0x02)
	    FC_CAL_Bit_High(porta, 1);
	if (pt & 0x04)
	    FC_CAL_Bit_High(porta, 2);
	if (pt & 0x08)
	    FC_CAL_Bit_High(porta, 3);
	if (pt & 0x10)
	    FC_CAL_Bit_High(porta, 4);
	if (pt & 0x20)
	    FC_CAL_Bit_High(porta, 5);
	if (pt & 0x40)
	    FC_CAL_Bit_High(porta, 6);
	if (pt & 0x80)
	    FC_CAL_Bit_High(porta, 7);

	if (mask)
	    FC_CAL_Bit_High(portb, 0);
	    
	%a_DELAY;
	FC_CAL_Bit_High (portb, 1);
	%a_DELAY;
	FC_CAL_Bit_Low (portb, 1);
	%a_DELAY;
Here the 8-bit data port is on porta, and the RS and E lines are on portb. Note this has been thrown together and is totally untested, and a similar mod will be required for the "Start" macro. But I believe it stands a fair chance of working.

FLJ
Posts: 4
Joined: Wed Feb 01, 2012 3:47 am
Has thanked: 5 times
Contact:

Re: other LCD device?

Post by FLJ »

Thank you alll. I have a better understanding.

User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

Re: other LCD device?

Post by 1Handypal »

Hello all,

@Steve: I am willing to give it real world test on hardware very soon. Will report results back later. I have some VFDs by Noritake sitting around, which have two switchable modes 4 and 8 bit.
So far I was able to run an LCD with a simple test flowchart, the only trick was to wire it properly to work in 4 bit mode. Lower nibble had to be all tied to ground for proper function and higher bits, as per datasheet, were connected as the following: D1(flowcode) - D4, D2(flowcode) - D5, D3(flowcode) - D6, D4(flowcode) - D7.

Best.

Post Reply