Printstring to LCD not working ?
Moderator: Benj
-
- 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 ?
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
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
-
- 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 ?
hi try this one code not very pretty but it works
- Attachments
-
- string.fcf
- (11.5 KiB) Downloaded 289 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- 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 ?
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.
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.
-
- 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 ?
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
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
-
- 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 ?
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
-
- 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 ?
heres your first one working hth
- Attachments
-
- kees1.jpg (168.09 KiB) Viewed 7617 times
-
- kees2.jpg (138.89 KiB) Viewed 7617 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- 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 ?
Hello.
For example:
Should print 'a' onto the screen. Try variants all at once, so:
Should show up as 'abc'
If this only prints 'b', try performing a 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. Cheers,
Jonny
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?).Has it something to do with indexing a string ?
For example:
Code: Select all
i = 'a'
PrintASCII(i)
Code: Select all
i = 'a'
PrintASCII(i)
PrintASCII('b')
PrintASCII(i + 2)
If this only prints 'b', try performing a loop:
Code: Select all
i = 0
while i < 5
PrintASCII('x')
i = i + 1
loop
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. Cheers,
Jonny
- 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 ?
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
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
-
- 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 ?
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
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