Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 11:57:40 11:57


Login with username, password and session length


Pages: [1]
Print
Author Topic: Problem with Proton Basic and a 16x4 LCD  (Read 8693 times)
0 Members and 1 Guest are viewing this topic.
Lumos
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 73
-Receive: 11


« on: October 24, 2010, 08:27:33 08:27 »

Hello,

With commands "Print at 3,1 ..." and "Print at 4,1..." the text is written from the first position 3,4 and 4,4.
Print at 1,1 and 2,1 is ok.
(I use LCD_Lines 4, LCD_Interface 4)

Who can help me?
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 538
-Receive: 408



« Reply #1 on: October 24, 2010, 09:29:26 09:29 »

That's not much to go on
You need to give us a bit more info, like show some sample code, your set up for the lcd then we may be able to help you

wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #2 on: October 24, 2010, 12:14:27 12:14 »

Try inserting this line near the top of your code as it seem's to cure a lot of wierd lcd problems with certain chips
Declare FLASH_CAPABLE = FALSE
Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
piappo
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 2
-Receive: 4


« Reply #3 on: October 24, 2010, 12:49:37 12:49 »

try this:

Cls
Print At 1, 1 , ""
Print At 2, 1,  ""
Print At 3, 1 , "try"
Print At 4, 1,  "this"
Logged
Lumos
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 73
-Receive: 11


« Reply #4 on: October 24, 2010, 06:58:00 18:58 »

hello, thanks for your help.

Declare FLASH_CAPABLE = FALSE -> did not work
Print At 1, 1...4,1 -> did not work
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #5 on: October 24, 2010, 08:06:08 20:06 »

Lumos is your code a secret? or the pic chip you used? and of couse the chipset the LCD is using.

That's not much to go on
You need to give us a bit more info, like show some sample code, your set up for the lcd then we may be able to help you
wizpic
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 538
-Receive: 408



« Reply #6 on: October 24, 2010, 08:53:52 20:53 »

Lumos is your code a secret? or the pic chip you used? and of couse the chipset the LCD is using.

The code is there it's hiding just above the picture  Cheesy
It's called RHandT.txt

It must be hwo they have been uploaded

wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
piappo
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 2
-Receive: 4


« Reply #7 on: October 24, 2010, 09:05:53 21:05 »

change your code con this:
start:

   
   
  
   Print At 1,17,"Ta(",Dec2 Ta,") > Ti(",Dec2 Ti,")"
   Print At 2,17,"rHa(",Dec2 rHa,")< rHi(",Dec2 rHi,")"
   
Line 3 is an extension of Line 1 and Line 4 is an extension of Line 2


if the display is 20x4:

        Print At 1,21,"Ta(",Dec2 Ta,") > Ti(",Dec2 Ti,")"
   Print At 2,21,"rHa(",Dec2 rHa,")< rHi(",Dec2 rHi,")"
« Last Edit: October 24, 2010, 09:18:25 21:18 by piappo » Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #8 on: October 24, 2010, 10:26:07 22:26 »

The problem is in your config 18Fxxx devices need Config start /and/end
and inculed the Declare Flash_Capable = FALSE  

plus there maybe another gotyou about the 16x4 line display, but I don't have my notes here at home.
look at the post above, its something about the code.
Code:
Config_Start
   PLLDIV = 5           ' Divide by 5 (20 MHz oscillator input)
   CPUDIV = OSC1_PLL2   ' [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
   USBDIV = 2           ' USB clock source comes from the 96 MHz PLL divided by 2
   FOSC = HS            ' Internal oscillator, HS used by USB
   FCMEN = OFF          ' Fail-Safe Clock Monitor disabled
   IESO = OFF           ' Oscillator Switchover mode disabled
   PWRT = OFF           ' PWRT disabled
   BOR = On             ' Brown-out Reset enabled in hardware only (SBOREN is disabled)
   BORV = 3             ' Minimum setting
   VREGEN = Off         ' USB voltage regulator not enabled
   WDT = OFF            ' HW Disabled - SW Controlled
   WDTPS = 128          ' 1:128
   MCLRE = OFF          ' RE3 input pin enabled; MCLR disabled
   LPT1OSC = OFF        ' Timer1 configured for higher power operation
   PBADEN = Off         ' PORTB<4:0> pins are configured as analog input channels on Reset
   CCP2MX = On          ' CCP2 input/output is multiplexed with RC1
   STVREN = On          ' Stack full/underflow will cause Reset
   LVP = OFF            ' Single-Supply ICSP disabled
   XINST = OFF          ' Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
   Debug = OFF          ' Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
Config_End

Declare Flash_Capable = FALSE
« Last Edit: October 24, 2010, 10:28:24 22:28 by pickit2 » Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #9 on: October 24, 2010, 10:30:07 22:30 »

you thinking
Declare LCD_Interface 8

or to slow the display down

LCD_CommandUs = 2000
LCD_DataUs = 50

Or you thinking

LCDOUT $FE,

I know the LCDOUT $FE, worked one time in proton even though it's PBasicPro , but I think it was the problem Declare Flash_Capable = FALSE  
takes care of
« Last Edit: October 24, 2010, 10:32:45 22:32 by bbarney » Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #10 on: October 24, 2010, 10:56:10 22:56 »

Here is some of my though.

Since your program is displayed then I would assumed your initialize OK. How about the address of the LCD defined in Proton? It could be the DELAY not long enough between display each char. Try to slow down a bit between display each char will help.

I think there is a delay problem like bbarney has said, please FOCUS on that.

However here is LCD addresses:

Some 4x20 and 4x16 LCD have line address as:

Line1 0x00
Line2 0x20
Line3 0x00
Line4 0x40

For Hitachi HD66712 controller the address:

Line1 0x00
Line2 0x20
Line3 0x40
Line4 0x80

16 chars/line display address:
Line 1 0x80
Line 2 0xC0
Line 3 0x90
Line 4 0xD0

20 chars/line display address:
Line 1 0x80
Line 2 0xC0
Line 3 0x94
Line 4 0xD4

Tom
Logged

Con Rong Chau Tien
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 494
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #11 on: October 24, 2010, 11:07:48 23:07 »

I agree with TomJackson69, check your LCD display data sheet to make sure the display address are done correctly.
Logged

If I have said something that offends you, please let me know, so I can say it again later.
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #12 on: October 25, 2010, 02:15:27 02:15 »

Lumos
try what piappo say's but just try putting 40 characters on line one and see if the other char show up on line 3
you really need to setup up the config to like pickit says as portb.3 doubles as a ccp pin if not set right and you have it as your enable pin and you should use TRISB %xxxxxxxxxx along with PORTB % xxxxxxxxx so you know every pin is set the way you hope
 It would really help if you posted a link to the displays datasheet
one question does the display have 2 chips on it so 2 enable pins ?
another thing is you have
Quote
Print Cls
start:
    Print At 3,1,"Ta(",Dec2 Ta,") > Ti(",Dec2 Ti,")"
   Print At 4,1,"rHa(",Dec2 rHa,") < rHi(",Dec2 rHi,")"

try putting the cls further down with a delay and you just need cls no need for the print

Quote
start:

Cls
DelayMS 500
   
            Print At 3,1,"Ta(",Dec2 Ta,") > Ti(",Dec2 Ti,")"
   Print At 4,1,"rHa(",Dec2 rHa,") < rHi(",Dec2 rHi,")"
« Last Edit: October 25, 2010, 02:56:23 02:56 by bbarney » Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
Lumos
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 73
-Receive: 11


« Reply #13 on: October 25, 2010, 08:46:07 08:46 »

many, many thanks, piappo, it work  Grin

Thanks also to the others for the quick help
« Last Edit: October 25, 2010, 08:52:49 08:52 by Lumos » Logged
Ahmad_k
SCG Moderator
Hero Member
*****
Offline Offline

Posts: 747

Thank You
-Given: 169
-Receive: 1288



« Reply #14 on: October 25, 2010, 05:39:44 17:39 »

Guys this is an old problem with proton using 16x4 LCD.

There was an error with "Print at 4,1" and  "at 3,1"
According to the help :
 $FE, $C0        Move cursor to beginning of second line
 $FE, $94        Move cursor to beginning of third line
 $FE, $D4        Move cursor to beginning of fourth line

there was an error. this should be :
 $FE, $C0        Move cursor to beginning of second line
 $FE, $90        Move cursor to beginning of third line
 $FE, $D0        Move cursor to beginning of fourth line

and this error is embedded in the compiler. so if you want to print at 4,1 just use the above command.

ex : Print $FE,$D0,"Test String"
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC