Printstring to LCD not working ?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
KeesD
Posts: 6
Joined: Thu Aug 16, 2007 9:40 pm
Location: Leiden (NL)
Has thanked: 2 times
Been thanked: 1 time
Contact:

Printstring to LCD not working ?

Post by KeesD »

Hello,

Printing a string from a stringvariable does not work with the printstring function. The processor is a PIC18F4520.
I am using flowcode 5.1.0.0. PrintASCII and printnumber do work, so the PIC is ok.
It worked with a PIC16F877a.

How can this be fixed, or what am I doing wrong ?

Kind regards,

Kees

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: Printstring to LCD not working ?

Post by DavidA »

Hi KeesD,

Ill give this a check first thing tomorrow morning.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Printstring to LCD not working ?

Post by dazz »

hi try this one code not very pretty but it works
Attachments
string.fcf
(11.5 KiB) Downloaded 287 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: Printstring to LCD not working ?

Post by DavidA »

Hello KeesD,

We dont have an 18F4520 here, closest i could find was an 18F4523, which worked perfectly.

I would suggest you create a simple program to test it out if you arent doing already.

create a variable "MyStringVar"

LCDStart()

Loop

PrintString(MyStringVar)

Cursor(0,0)

EndLoop

And see if that works with your chip.

KeesD
Posts: 6
Joined: Thu Aug 16, 2007 9:40 pm
Location: Leiden (NL)
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Printstring to LCD not working ?

Post by KeesD »

Hello,

thank you for your help.
I tried your program, but it did not work (blank display)
Further I tried the following:
(All variables are created first)

MyStr = "PrintThis"
LCDDisplay Start
LCDDisplay PrintString MyStr
Delay 10s

Result: Blank display. I expect to see "PrintThis" for 10 seconds.

I have done some more tests:

LCDDisplay Start
LCDDisplay Printstring "PrintThis"
Delay 10s

Result: Only one strange character (ascii 0xDC) is printed.

LCDDisplay Start
LCDDisplay PrintASCII "PrintThis"
Delay 10s

Result: This works! The text "PrintThis" is on the display.

So I tried the following:

MyStr = "PrintThis"
i=0 //index
Smb=0 //byte, ascii symbol
LCDDisplay Start
Loop while i<9
Smb = MyStr
LCDDisplay PrintASCII Smb
i=i+1
end loop
Delay 10s

This does not work.

Has it something to do with indexing a string ?

Because it works with PrintASCII I think th Pic is ok.
Also the printnumber and other functions work fine.

Kind regards,

Kees

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Printstring to LCD not working ?

Post by dazz »

hi kees forgot to say the one i wrote press one button and it prints one string press the other it prints the second string hth
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Printstring to LCD not working ?

Post by dazz »

heres your first one working hth
Attachments
kees1.jpg
kees1.jpg (168.09 KiB) Viewed 7593 times
kees2.jpg
kees2.jpg (138.89 KiB) Viewed 7593 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Printstring to LCD not working ?

Post by JonnyW »

Hello.
Has it something to do with indexing a string ?
No, this is pretty fundamental stuff so it should not fail. One thing to point out though is that your variable MyStr is stored in RAM, where as the literal "PrintThis" is in ROM. Could the issue be something to do with your RAM accesses (and could you write a program to test this?).

For example:

Code: Select all

  i = 'a'
  PrintASCII(i)
Should print 'a' onto the screen. Try variants all at once, so:

Code: Select all

  i = 'a'
  PrintASCII(i)
  PrintASCII('b')
  PrintASCII(i + 2)
Should show up as 'abc'

If this only prints 'b', try performing a loop:

Code: Select all

  i = 0
  while i < 5
    PrintASCII('x')
    i = i + 1
  loop
Should print 5 'x' characters. If this does not, then your RAM is almost certainly not working correctly.

I have put some tests in this FCF file, enable one macro at a time and let us know what the results on screen are (and which tests fail) and this may help solve the problem. You may have to set your ports correctly.
multi_lcd_ram_tests.fcf
5 tests of the LCD
(18.05 KiB) Downloaded 286 times
Cheers,

Jonny

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Printstring to LCD not working ?

Post by JonnyW »

Hello again.

Ben has suggested check your config on the 18F chip for 'Extended CPU', and make sure this is off. This effects RAM accesses apparently (I'm just the messenger!).

Cheers,

Jonny

KeesD
Posts: 6
Joined: Thu Aug 16, 2007 9:40 pm
Location: Leiden (NL)
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Printstring to LCD not working ?

Post by KeesD »

Hello,

The parameter "Enable extended CPU" was enabled.
I disabled it and everything is working now !
So it had something to do with the internal workings of the chip.

I think I should read the datasheet of the 18F4520 to see what these parameters do and how the memory is organized.

Thanks to everyone who has given an answer to my quetion. It was helpful.

Kind regards,

Kees

Post Reply