gLCD with Formula Flowcode

For Formula Flowcode Micromouse users to discuss projects, flowcharts, and any other issues related to the Formula Flowcode Micromouse.

Moderator: Benj

Post Reply
Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

gLCD with Formula Flowcode

Post by Mark »

Hi,

I have been using an LCD e-block with FF to keep a track of sensor data.

Now I want to use the gLCD e-block. Obviously the gLCD has loads of potential for graphing movement so I am keen to use it.

FF seems to have RC0 effectively free (speaker), RC3 free and RC5 used for the USB socket.

Since RC0, RC3 and RC5 seem essential does this mean I cannot use the gLCD on FF?

I first tried using Port D, but even though he components allows this to be specified I guess it has no SPI so thta is not an option.

I have used the gLCD well with the EB006 board and RC0, RC3 and RC5 seem essential. I am prepared to hard wire FF for the gLCD but would first like some strong pointers that it will work before doing so.

Many thanks,

Mark
Go with the Flow.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: gLCD with Formula Flowcode

Post by Benj »

Hi Mark,

You can use the gLCD with the Formula Flowcode but it means switching it to software mode and this can be slow on some device. Hopefully as the Formula Flowcode is running at 48MHz (12MIPs) this will not be a problem.

Here is an updated component C file, please load this into your "Flowcode v4/Components" directory.
PIC_gLCD.c
(44.57 KiB) Downloaded 960 times
Next select the gLCD component on the panel and select custom code, edit the defines section and find this line of code.

#define MX_GFXLCD_BUS 0 //0 - Hw / 1 - Sw

change this to

#define MX_GFXLCD_BUS 1 //0 - Hw / 1 - Sw

The pins are mapped out as follows from the component connections window.

Data / SDO -> MOSI
Clock / SCK -> SCK
Reset / SDI -> MISO
Chip Select -> CS

Let me know how you get on.

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

Re: gLCD with Formula Flowcode

Post by Steve »

As an alternative, you could use the pins on J10 and J14 as these connect to the h/w SPI interface: RB0=SDI, RB1=SCK and RC7=SDO. Although you may need to disconnect the line-followers (using JP1 and JP2) as these are connected to RB0 and RB1 by default and may interfere with the SPI signalling.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode

Post by Mark »

Many Thanks.

To start with I have tried a 16F877 on an EB006, for simplicity.

On changing to #define MX_GFXLCD_BUS 1 //0 - Hw / 1 - Sw the gLCD works fine on ports C or D.

However, for the ease of others the Connections of the component need to be:

R/SDIO 4
CS 0
CL/SCK 3
Data/SDO 5

This is for jumper position B, though I also used the position C with wires:
0 - CS, where 0 is the top contact, effectively labelled 'R2'
3 - SCK
4 - SDO
5 - SDI

which is the equivalent but easier to mod later.

On the chip at 4MHz clock the display is about 1/2 speed when switching to software.

My impression is though that the Clear routine clears more memory than displayed on screen as there is a considerable delay after clearing the visible screen.

Also for information I tested the gLCD powered by a 9v PP3 battery piggy backed on the 5v supply = 14v. Hence a convenient power source for use on board the buggy.

I will try it with FF next and let you know.
Go with the Flow.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode

Post by Mark »

gLCD Works fine on FF :) Port D using e-blocks connector and 9v PP3 from 5v (battery ground) to gLCDVPWR (battery +ve).

Thanks.
Attachments
gLCD in Software.fcf
Basic test file used
(16.18 KiB) Downloaded 936 times
Go with the Flow.

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

Re: gLCD with Formula Flowcode

Post by Steve »

Thanks for letting us know, Mark.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode v 4.5

Post by Mark »

Having downloaded and installed Flowcode v4.5 and compiled and downloaded a program previously OK the gLCD fails to work.

I have checked the Code modification is still present, #define MX_GFXLCD_BUS 1 //0 - Hw / 1 - Sw

The Component now only allows CS to be defined. Defining it as 0 or for that matter 4 has no effect.
All other details as above Port D, gLCD jumper in position B etc.

Please give a solution or workaround as my project is now on hold.

Thanks.
Go with the Flow.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: gLCD with Formula Flowcode

Post by JohnCrow »

Hi Mark
Dont know if this will solve your problem but have you installed this patch for 4.5 ?

http://www.matrixmultimedia.com/mmforum ... =29&t=8700

This was posted on Friday 29th, I had problems with simulation on the gLCD ,the patch has cured them.
Not had chance to try it on actual hardware yet.

Just go the Flowcode4/Components folder and rename the PIC_gLCD.C file to something like PIC_gLCD-old.C and copy the new version to the folder.
This has to be done with flowcode closed.
1 in 10 people understand binary, the other one doesn't !

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode

Post by Mark »

Hi John,

No luck I'm afraid, but hanks, gave it a try no help I'm afraid, tried CS as 0 or 5.

this post :

http://www.matrixmultimedia.com/mmforum ... 689#p26209

suggests software driven gLCD is no longer an option with FDC 4.5 in reply to your question. I really hope not.

Input by MM please.

Regards,
Go with the Flow.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: gLCD with Formula Flowcode

Post by Benj »

Hi Mark,

Sorry about this. I think I know what happened. Basically we made it easier to work with the EB057 and EB058 modules in hardware mode by dropping the extra pin connections from the component when that display type is selected. This means that in software mode most of the pins other then the chip select are undefined.

To get around this you will need to do a bit more customization of the defines code section of the component.

The signals are connected like this.
MX_GFXLCD_SDATA - MOSI
MX_GFXLCD_SCLK - SCK
MX_GFXLCD_RS - MISO

So at the top of the defines code section change the following section of code

Code: Select all

#define MX_GFXLCD_PORT       %a            //portc   I/O port
#define MX_GFXLCD_TRIS       %b            //trisc   I/O direction register
#define MX_GFXLCD_RS         %c            //3       Reset
#define MX_GFXLCD_CS         %d            //2       Chip Select
#define MX_GFXLCD_SCLK       %e            //1       Serial Clock
#define MX_GFXLCD_SDATA      %f            //0       Serial Data
to look like this

Code: Select all

#define MX_GFXLCD_PORT       portc            //portc   I/O port
#define MX_GFXLCD_TRIS       trisc            //trisc   I/O direction register
#define MX_GFXLCD_RS         4            //3       Reset
#define MX_GFXLCD_CS        0            //2       Chip Select
#define MX_GFXLCD_SCLK      3            //1       Serial Clock
#define MX_GFXLCD_SDATA      5            //0       Serial Data
You can change the port and tris defines to another port if you wish.

And then find this line a bit lower down in the code

Code: Select all

#define MX_GFXLCD_BUS		0					//0 - Hw / 1 - Sw
and change to this

Code: Select all

#define MX_GFXLCD_BUS		1					//0 - Hw / 1 - Sw
This should again allow you to drive the display in software mode.

Let me know how you get on.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode

Post by Mark »

Ben,

Thanks, works fine, needs Port D and TriscD in the above code.

The gLCD board sits well on top of Formula Flowcode, using some 2cm, M3 spacers.

I suggest inclusing a gLCD component to Formula Flowcode, Port D with an e-blocks jumper and postion B for he e-block jumper should dispense with the need for pin selection. The display is surely ideal for education, showing data, decisions etc.

Anyway, thanks again.
Go with the Flow.

dickcheung
Posts: 10
Joined: Sun Jun 26, 2011 4:19 pm
Contact:

Re: gLCD with Formula Flowcode

Post by dickcheung »

Hi Benj,
Thanks for your great suggestions, I am currently tried to use the gLCD (EB0058) to my ECIO (28P), per your below description, I set my gLCD to:
- (a.)patch, port B, s/w mode, (b) B, port B, s/w mode, both settings are work.
- CS as bit 0.
- in flowcode, the properties set to EB0057 as no selection for EB0058

It works but I found some red/green/black vertical lines shown on the left and right side of the screen (attached) which I am not desired to obtain this, why this happened? am I set wrong in properties? I set it as EB0057 (my gLCD is EB0058-00-1. I tried to set 43v2, but no luck.

Besides, I tried to set the background but always keep unchanged (yellow) no matter I set in gLCD properties as customize or not.

Thanks for help.
Dick
Benj wrote:Hi Mark,

Sorry about this. I think I know what happened. Basically we made it easier to work with the EB057 and EB058 modules in hardware mode by dropping the extra pin connections from the component when that display type is selected. This means that in software mode most of the pins other then the chip select are undefined.

To get around this you will need to do a bit more customization of the defines code section of the component.

The signals are connected like this.
MX_GFXLCD_SDATA - MOSI
MX_GFXLCD_SCLK - SCK
MX_GFXLCD_RS - MISO

So at the top of the defines code section change the following section of code

Code: Select all

#define MX_GFXLCD_PORT       %a            //portc   I/O port
#define MX_GFXLCD_TRIS       %b            //trisc   I/O direction register
#define MX_GFXLCD_RS         %c            //3       Reset
#define MX_GFXLCD_CS         %d            //2       Chip Select
#define MX_GFXLCD_SCLK       %e            //1       Serial Clock
#define MX_GFXLCD_SDATA      %f            //0       Serial Data
to look like this

Code: Select all

#define MX_GFXLCD_PORT       portc            //portc   I/O port
#define MX_GFXLCD_TRIS       trisc            //trisc   I/O direction register
#define MX_GFXLCD_RS         4            //3       Reset
#define MX_GFXLCD_CS        0            //2       Chip Select
#define MX_GFXLCD_SCLK      3            //1       Serial Clock
#define MX_GFXLCD_SDATA      5            //0       Serial Data
You can change the port and tris defines to another port if you wish.

And then find this line a bit lower down in the code

Code: Select all

#define MX_GFXLCD_BUS		0					//0 - Hw / 1 - Sw
and change to this

Code: Select all

#define MX_GFXLCD_BUS		1					//0 - Hw / 1 - Sw
This should again allow you to drive the display in software mode.

Let me know how you get on.
Attachments
gLCDscreen shot.JPG
gLCDscreen shot.JPG (16.16 KiB) Viewed 25656 times

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode (F Code v5)

Post by Mark »

I am now revisiting Formula Flowcode with the EB058 on PortD.
The message chain above gave a solution for Flowcode 4.
I am now with Flowcode 5. Could you revisit the advice above so that
we can use the display when programmed with Flowcode 5 please.

Thanks,

Mark
Go with the Flow.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: gLCD with Formula Flowcode

Post by Benj »

Hi Mark,

It is a bit easier to do with v5.

Customise the component code and edit the defines code section.

You will see a section of code like this. There are four such sections and you will probably only need to edit the first on unless you are using another component which is using SPI comms. If you are unsure then edit all 4 sections so the values are identical.

Code: Select all

	#define MX_SPI_REF1
	#define %a_MX_SPI_UREF			1
	#define MX_SPI_CHANNEL_1		%l
	#define MX_SPI_MOSI_PIN_1		%g
	#define MX_SPI_MOSI_PORT_1		port%f
	#define MX_SPI_MOSI_TRIS_1		tris%f
	#define MX_SPI_MISO_PIN_1		%i
	#define MX_SPI_MISO_PORT_1		port%h
	#define MX_SPI_MISO_TRIS_1		tris%h
	#define MX_SPI_SCK_PIN_1		%e
	#define MX_SPI_SCK_PORT_1		port%d
	#define MX_SPI_SCK_TRIS_1		tris%d
	#define MX_SPI_CS_PIN_1			0
	#define MX_SPI_CS_PORT_1		0
	#define MX_SPI_BMODE_1			5
	#define MX_SPI_PR_SCALE_1		4
	#define MX_SPI_PO_SCALE_1		0
	#define MX_SPI_INT_1			0
The first line you want to edit is this.

Code: Select all

#define MX_SPI_CHANNEL_1		%l
to

Code: Select all

#define MX_SPI_CHANNEL_1		0
1 is the hardware channel which uses the dedicated SPI pins. 0 is the software channel which uses the pins as described in the Pin/Port/Tris parameters.

Once you have changed the bus type then simply edit the connections. Here is a quick example using portb.

Code: Select all

	#define MX_SPI_MOSI_PIN_1		0
	#define MX_SPI_MOSI_PORT_1		portb
	#define MX_SPI_MOSI_TRIS_1		trisb
	#define MX_SPI_MISO_PIN_1		1
	#define MX_SPI_MISO_PORT_1		portb
	#define MX_SPI_MISO_TRIS_1		trisb
	#define MX_SPI_SCK_PIN_1		2
	#define MX_SPI_SCK_PORT_1		portb
	#define MX_SPI_SCK_TRIS_1		trisb
The CS definitions are regarding Slave mode which is currently not implemented so you do not have to worry about these. As long as the CS pin is setup correctly in the component connections window then this should be all you have to do.

Let me know how you get on.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: gLCD with Formula Flowcode v5

Post by Mark »

Ben,

Thanks, this works fine.

For other users:

9v pp3 from battery -ve to 5v out on buggy, battery +ve to VPWA on EB058 board. 5v+9v=14v :)
Buggy connected to EB058 gLCD with standard 9in D type jumper, short version preferable.

Routine below, lights screen, clears it and prints Hello. Slowish, so be patient.
LED's at front show active I/O 'progress' on 0, 4 and 5.
Support with standard posts from apetures on both boards, 2cm M3 brass posts work fine.

The gLCD allows plots of movement, mazes etc.
Buggy plus gLCD
Buggy plus gLCD
FF + gLCD.jpg (99.21 KiB) Viewed 24691 times
FFlowcode v5 + gLCD EB058 Basic.fcf
Buggy + gLCD
(18.57 KiB) Downloaded 718 times
Go with the Flow.

Post Reply