lcdout versus serout2


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Posts
    12

    Default lcdout versus serout2

    In trying to plagiarize existing works I have found numerous instances of where there are lcdout commands. I use a LCD with a "backpack" affair such that it takes standard serout commands. In trying to convert the lcdout to a serout command I have found numerous allusions to using the serout2 command instead as it supposedly mimics the lcdout command. However, it does not work as advertised in the meager, limited little world I live in. The command I am trying to duplicate is
    lcdout $fe,1,"TIME:",HEX2 hh,":",HEX2 mm,":",HEX2 ss
    and I use the command
    serout2 PORTB.6,84,[hex hh,":",hex mm,":",hex ss] I have also tried
    serout2 PORTB.6,84,[hex2 hh,":",hex2 mm,":",hex2 ss]
    serout2 PORTB.6,84,[ihex2 hh,":",ihex2 mm,":",ihex2 ss]
    serout2 PORTB.6,84,[hex #hh,":",hex #mm,":",hex #ss]
    In poring over the manual and looking futilely for some clues I confess to being stymied in my efforts. The display gives meaningless jumbles instead of pristine characters. Perhaps someone of greater programming prowess could enlighten me as to my deficiency.
    Thanks

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Presumabley the LCD display works OK if driven from a PC ?

    Normally a backpack LCD would expect to receive RS232 levels. Your seting of "84" is for 9600 baud TRUE. Unless you are using a MAX232 to perform the translation from TTL to RS232 I believe you will need to use INVERTED. Try changing the "84" to "16468" as shown in Appendix A of the PBP manual.

    You also dont say what speed your PIC is running at and the manual includes the following warning "9600 baud may be unreliable with 4MHz clock"
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    Join Date
    Mar 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Clarification

    The lcd works fine if I send text using the standard serout command so the lcd itself is fine. Also, I inserted some code into the program using serout and it appears fine so the connections have proven correct as well. I will try the new code instead of 84 tommorrow. By the way I'm using a 20 mhz clock.
    Thank you for your help in this matter.

  4. #4
    Join Date
    Mar 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Once more into the breach

    Changing the 84 to 16468 in the serout2 command does make the display at least readable. However, the display appears to be in hex format as the numbers count up through A1, A2 and so on. I haven't thoroughly re-examined the manual for the hundredth time but I thought including the HEX command would change the numbers back to the standard convention. I will re-read that section on serout2 as my manual now falls open to that part. Thanks so much for your input so far. The command I now use is
    serout2 PORTB.6,16468,[hex2 hh,":",hex2 mm,":",hex2 ss]
    If you have any further thoughts on how to make this work I would be most interested if you would share them.
    Again, thanks for interest in helping me.

  5. #5
    Join Date
    Mar 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default To complete

    Just to complete this entry. I deciphered the issues and have satisfactorily resolved them.
    Thanks.

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Glad to hear the display works... just need to fix the content now

    All numbers are stored internally as HEX. Try using DEC instead.

    BIN, DEC and HEX modifiers are used to output an ASCII representation of the number.

    eg, myVar = 65

    LCDout myVar displays "A"

    LCDout DEC myVar displays "65"

    LCDout HEX myVar displays "41"

    LCDout BIN myVar displays "1000001" (leading zeros not displayed unless you specify how many bits to show)
    Keith

    www.diyha.co.uk
    www.kat5.tv

  7. #7
    Join Date
    Mar 2006
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Clarification

    I apologize for the ambiguity of my last message. What I intended was that all of my problems, jumbles on the display and also incorrect counting were all rectified. This appears to be a good example of needing to pull back from a project sometimes to get a fresh start. Indeed, I don't think I would have seen the problem with the display not displaying correct. It never occured to me that I had selected the wrong logic levels on the display. I was thoroughly convinced that the command using the 84 instead of 16468 was correct. But as for it counting wrong I overlooked that the numbers were in BCD. The initial problem had me so consumed I overlooked that one little fact. Thank you for taking your time to answer what to many is such a simple problem it's not worth their time. It was extremely frustrating.
    Again thanks.

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. Gps/glcd
    By karenhornby in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st April 2008, 16:18
  3. Help GPS read with serin
    By leinske in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th September 2007, 02:33
  4. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts