ADAfruit OLED 4X20

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

ADAfruit OLED 4X20

Post by siliconchip »

hi all
when using the ADAfruit OLED 4 x20 in hardware is there anything needed to do to run it on 4 bits in software, I'm connected to the hardwares display on inputs D4,D5,D6 and D7 as per datasheet but only the top line displays any text, in simulation all works well within flowcode any help appreciated thanks

bob
Attachments
HEX+20-4DISPLAYV2.fcfx
(22.21 KiB) Downloaded 348 times
Last edited by siliconchip on Thu Feb 23, 2017 7:06 pm, edited 2 times in total.

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

If the top line is working correctly then the display is communicating correctly on the 4-bit mode. Keep sending an ASCII character to the display e.g. 'X' in a loop with a small delay and you should eventually see data appearing on the bottom line of the display.

It could be the display has a none standard memory layout and so the coordinates we are using for the start of line 1 could be incorrect for that device?

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

Hi benj thanks for the reply the top line displays as it should and the second line shows what should be on the bottom line im not sure what you mean by adding a loop and delay is it worth increasing the delay i already have ?

bob

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

With this program does the entire display eventually fill up with X characters?
HEX+20-4DISPLAYV2.fcfx
(22.7 KiB) Downloaded 364 times

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
thanks for the reply, yes the screen fills quite quickly with Xs, the top line first then the third line then second and finally the bottom line I guess this is what you were aiming for, what does it signify ?

thanks bob

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

It demonstrates the display is fully operational, it's just the RAM layout that is a bit strange.

I think now it's a case of playing with the cursor command, sending a character and seeing where it appears on the display. Then taking this and applying it to your program to get the text appearing in the place you want it.

Do you have a datasheet for the display as that could potentially help clear up the addressing issues?

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
thanks for the reply yes I have a data sheet which ive gone over but cant find anything to help, I have attached it if this is ok

bob
Attachments
TC2004A-01.pdf
(939.32 KiB) Downloaded 329 times

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: ADAfruit OLED 4X20

Post by Benj »

Thanks Bob,

Page 14 shows the display data addresses, however it looks wrong to me as lines 1 and 3 share the same addresses as do 2 and 4.

Try using cursor position x = 20 and y = 0 and see where that prints out.

Also try using cursor position x = 20 and y = 1.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
that works a treat for line 3 and 4 I could get the first and second lines to work but not the third and fourth and what you have suggested works a treat, what was the problem on page 14 of the data sheet ?, also when using a 4x4 keypad do I need to use resistors to +v on all 8 lines before they go in to the inputs once again brilliant thank you

bob

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

Glad it's working for you now.

There is a circuit for a keypad in this datasheet on page 7, the columns are connected to the I/O pins via 10K resistors, the rows are connected to GND via 100K resistors.

https://www.flowcode.co.uk/datasheets/EB014-30-1.pdf

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
all though the program simulates in flowcode I'm yet unable to get the keypad working in hardware, I've used resistors as per the link on both the rows and the coulombs, also swapped the row and coulomb wiring from the keypad to pic but no joy, is there any extra coding needed for the real world outside simulation that I need to add to make the keypad function, lcd is now working fine thanks in advance

bob

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

No the keypad should be fairly straight forward. Are you using a cable or is the keypad on the same PCB or physically close to the uC? If you're using a cable then transmission line effects could be causing you problems.

If you can share your program and a schematic of your keypad then that would help to see if there is anything that needs attention to get this working.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
thanks for the reply, my program is the one stated originally and ive attached a pdf of a keypad I'm using,it is close to the uC and I'm using cables, would the fact I'm using 2 separate ports for the rows and coulombs be a problem ?

cheers bob
Attachments
4x4 keypad.pdf
(213.11 KiB) Downloaded 287 times

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: ADAfruit OLED 4X20

Post by Benj »

Hi Bob,

Two ports shouldn't be an issue, how long are your cables?

Looking at your program the only thing I can see is that RA3 is the MCLR pin and though you are using the internal MCLR this pin can still only be an input pin.

Are you using an EB006 to host the chip or are you using something else like veroboard? I ask because the EB006 treats, 8/14 and 20 pin chips a little differently to make them fit in with with other chip's port pins.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 25 times

Re: ADAfruit OLED 4X20

Post by siliconchip »

hi benj
cables are 10cm long my hardware at this point is on a breadboard

bob

Post Reply