Shop OBEX P1 Docs P2 Docs Learn Events
LCD Positioning Errors — Parallax Forums

LCD Positioning Errors

Lee_SpeakmanLee_Speakman Posts: 32
edited 2006-02-11 14:55 in BASIC Stamp
Hi, im having problems with my LCD, it is a serial LCD from Scott Edward Electronics, my problem is, that If i consistently want to write to a certian part of the screen, the LCD will do so a few times, then its like the command to return to to that part of the screen doesnt get sent and it carrys on to the next line, or it will do a 'home' command and start from the begining, here is some simple code replicating the problem:

' {$STAMP BS2}
counter VAR Word
PAUSE 1000

SEROUT 0,$4054, [noparse][[/noparse]254,1]
main
SEROUT 0,$4054, [noparse][[/noparse]254,130]
PAUSE 5
SEROUT 0,$4054, [noparse][[/noparse]DEC counter]
counter=counter+1
PAUSE 200
GOTO main
The Serial interface is designed for 2400bps and 9600bps, im currently using 9600bps.


Any Help would be apprechaited. Lee S

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-10 00:25
    [size=2][code]
    counter VAR Word 
    PAUSE 1000 
    
    SEROUT 0,$4054, [noparse][[/noparse]254,1] 'HOMEs cursor 
    main: 
    SEROUT 0,$4054, [noparse][[/noparse]254,130] 'print Special character 
    PAUSE 5 
    SEROUT 0,$4054, [noparse][[/noparse]DEC counter] 'print counter value 
    counter=counter+1 'incr counter 
    PAUSE 200 
    GOTO main
    



    The above, basically your program, LS, will keep going and going because you aren't re-HOMEing your cursor.· I assume you want to over-write each time (?), so...[/code][/size]
    counter VAR Word
    PAUSE 1000
     
    main:
     SEROUT 0,$4054, [noparse][[/noparse]254,1]        'HOMEs cursor
     SEROUT 0,$4054, [noparse][[/noparse]254,130]      'print Special char
     PAUSE 5
     SEROUT 0,$4054, [noparse][[/noparse]DEC counter]  'print counter value
     counter=counter+1              'incr counter
     PAUSE 200
     GOTO main
    
    

    Yes?
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 00:32
    Thankyou PJ, Im trying to Overwrite text, as the Display is updating information quite fast and if I have to clear and update the whole screen flickering is very apparent. I have just tried your program and every so often it will print text in the 'Home' Posistion and not in the posistion I tell it to- In this case "2 addresses in" I thinking that this might be a problem with the LCD's serial interface, I dont think the BS2 code is wrong - although im pretty new to this!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-10 00:34
    Here's were a program with "magic numbers" can be tough to follow -- I've attached a vesion using our style guidelines; see if it does what you want.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-10 00:42
    One thing to keep in mind about your program is that if the number you're now printing occupies fewer digits than the previous value (e.g., you go from 10000 to 10) you may not know it as you're not clearing the old number by writing over the top of it.· You can add a Nib variable to your program called "pad" and then use this routine to right-justify any value up to five digits wide; the leading zeros (as if you used DEC5) are replaced with spaces.

    RJ_Print5:
    · LOOKDOWN cntr, >=[noparse][[/noparse]10000, 1000, 100, 10, 0], pad
    · SEROUT Lcd, Baud, [noparse][[/noparse]REP " "\pad, DEC cntr]
    · RETURN

    Move the cursor to the position of the 10,000s digit, then call RJ_Print5 with GOSUB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 00:45
    Thanks Jon, but no luck, I have just tried your code and the same error occurs, I have a picture of it but I cant find an uploader. This time It counted up to around 29 on address 130, then it printed 29 starting at address 128, then it went back to address 130, so my screen read 2930, weird Huh? I take this is defo an issue with the serial interface? Should I talk to my supplier? (Milford Electronics in the UK)

    Im using a Blue and White LCD screen and when I character is updating it seems to leave a black shadow behind it, and when It goes onto line 2 it prints onto line 3 then after that line 2 then 4.

    Issues with PIC maybe?
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 01:00
    Example of above problem: Occurs randomly


    Picture0231.jpg

    Black Shadow of new LCD character being written. Is this a problem with Blue LCD's?

    [noparse][[/noparse]IMG]http://i28.photobucket.com/albums/c211/Popee/Picture0233.jpg[noparse][[/noparse]/IMG]
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 01:00
    Picture0233.jpg
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-10 01:08
    · Well, Clearing the Display (FormFeed) is ASCII 12 ($0C) and you aren't doing that anywhere
    · 254 ($FE) is a Blank character (I use the ASCII $20, instead); 1 ($01) is a HOME (which is non-destructive; and 130 ($82) is a special character -- at least·this is so on Scott's ILM-216s (my reference.)
    · Never mind me.
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 01:15
    On mine [noparse][[/noparse]130,1] Means write to the 3rd Address in the LCD's memory, in this case the 3rd character of the top line. I tried your code with the clear screen, and alough it works, its still not always writing to the correct posisition. The only time I ever get correct formatting is if I clear the screen and do a full line of text, however it looks awful due to the black shadows on the characters that change.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-10 01:20
    What is the SPECIFIC model number of your display -- I was using BPI-216 commands in my example. I have used SEETRON displays for years and never had a lick of trouble. In fact, I never used any other serial LCD until we came out with our own.

    I have no idea what the shadow is -- that's something you'll want to talk with Scott about as it could be a defective display.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 11:39
    The one im using has Milford on the back part number 6-201E, but its described as a Standard BPK, the screen im using is a BPP-420V series.

    Datasheet can be found here, but its no different from the seetron one http://www.milinst.com/Audio_Visual/6_201.pdf
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-10 16:25
    Hey guys thanks for your advice, I spoke to a guy from milford and told him my problem, he was adamant that there was something wrong with my program, but i insisted that he checked it. I emailed it to him and using the same setup as mine, he concluded that:

    Dear Sir
    An interesting problem it would appear that the internal buffers
    are unable to cope with the incoming data when it is presented at 9K6
    baud.
    If you send the data at 2K4 baud ( BPS jumper out) the Driver
    board is capable of handling the data stream without any spurious data
    being produced.

    I have a good mind to ask for a refund, as in my eyes as when I bought this item it was on the Basis that any function could be done at 9600bps. Does that seem fair?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-10 19:24
    Lee,

    ·· Some LCDs process data faster than others, but the bottom line is that certain commands take longer to execute on an LCD.· For example our Parallax LCD requires a PAUSE 5 after doing a CLS (ASCII 12).· Without it the LCD may miss commands or get garbled data.· You certainly could ask for a refund, but it may just be a matter of re-writing the code so that it is not hammering the LCD with data.· If you need a faster refresh than what you get doing that you may need another display.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Lee_SpeakmanLee_Speakman Posts: 32
    edited 2006-02-11 14:55
    Thanks Chris, ive tried pauses in between comands and everything. It works fine if i want to write to the 2nd, 3rd or 4th lines. Ive asked him if this problem occurs with their more advanced boards, so hes going to check it on Monday. I will ask for a refund and upgrade to a better board if the others are fine!!!
Sign In or Register to comment.