LCD Data on portA and portB


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default Solved

    it seems like people might be trying to use this as a reference so im gonna post the custom sub i made to compensate for my pins not being in the right order. you can put any port\pin in place of the ones i have

    for more info see:
    http://www.geocities.com/SiliconVall...d/commands.htm

    ----- lcd type and setup.
    4 bit mode
    left to right
    no cursor no blink
    2 line
    8 character
    ------


    lcde var PORTC.1 '<---- LCD Enable
    lcdrs var PORTC.0'<---- LCD R/S
    lcd7 var PORTA.0 '<---- LCD DATA 7
    lcd6 var PORTA.1 '<---- LCD DATA 6
    lcd5 var PORTA.2 '<---- LCD DATA 5
    lcd4 var PORTB.3 '<---- LCD DATA 4 *notice this is one portB*
    B1 var byte '<---- HOLDS LCD CHARACTER ASCII DATA BYTES


    LCD3: 'lcd subroutine
    lcdrS = 1 'ascii mode
    FOR X = 0 TO 7 ' Count from 0 to 7 (8 character per line on lcd)
    LOOKUP X,["EYE DLY "],B1 ' Get character number B0 from string to variable B1

    lcd7 = B1.7 'puts top half of ascii data on pins 7-4
    lcd6 = B1.6
    lcd5 = B1.5
    lcd4 = B1.4
    gosub lcdtog 'toggle the e line
    lcd7 = B1.3 'puts bottom half of ascii data on pins 7-4
    lcd6 = B1.2
    lcd5 = B1.1
    lcd4 = B1.0
    gosub lcdtog 'toggle the e line

    NEXT X ' Do next character
    Return


    lcdtog:
    pause 1
    High Lcde 'set lcd enable line high
    pause 1
    Low Lcde 'set lcd enable line low
    pause 1
    Return


    lcdinit:
    '-----------------------
    Pause 35 'wait at least 35ms
    lcdrS = 0 'instruction mode

    pause 50
    lcd7 = 0
    lcd6 = 0
    lcd5 = 1
    lcd4 = 0 'initialize the lcd
    gosub lcdtog 'Toggle E line

    '---------------------------
    FOR X = 0 TO 4 ' Count from 0 to 4 (5 commands to be sent)
    LOOKUP X,[$28,$0C,$0C,$06,$01],B1 ' Get character number B0 from string to variable B1

    lcd7 = B1.7
    lcd6 = B1.6
    lcd5 = B1.5
    lcd4 = B1.4
    gosub lcdtog
    lcd7 = B1.3
    lcd6 = B1.2
    lcd5 = B1.1
    lcd4 = B1.0
    gosub lcdtog
    pause 30
    NEXT X ' Do next character
    '----------------------------
    Return

  2. #2
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default Hansknec

    Thanks Edward, but there is still something that seems unclear to me. You are calling this a subroutine, but there seems to be no method of passing a variable into it. It looks like it will print "EYE DLY " when called. Could you elaborate a little about passing a string into the subroutine? I've gotten pretty lazy over the years and I'm very much used to setting up some human terminology in my lcd calls like this:
    *************
    Line1 CON 128
    Line2 CON $c0
    clr CON 1
    I CON $FE
    *************

    I then pass the values out in simple human language terms as follows:
    ***************
    lcdout I,clr 'clear the LCD
    lcdout I,Line1, "Ion current"
    lcdout I,Line2,#valu dig 2,".",#valu dig 1,#valu dig 0,"e-0",#scale 'scientific notation display of current reading.

    ***************
    I realize that you are no longer using lcdout, but your own routine instead but I'm still missing something.

    Thanks,
    John.
    (your web site is awesome by the way and I really need to spend more time studying all your info)

  3. #3
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hansknec
    ...I realize that you are no longer using lcdout, but your own routine instead but I'm still missing something.
    John,
    sorry for joining here,
    but if you want the full power of PBPs LCDOUT

    there is quite some work to do.

    I doubt EDWARD is going to do it for you.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  4. #4
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Hansknec,

    H>Thanks Edward, but there is still something that seems unclear to me. You are calling this a subroutine, but there seems to be no method of passing a variable into it<<

    In PBP, you do not pass variables to subroutines...It is not like C and C++, or Variable passing in 3rd and 4th generation langauges. they are basically all global... Take a look at the LookUp command in the PBP manual:

    http://www.microengineeringlabs.com/...ces/pbpmanual/

    You can simulate much of LCDout command manually, but that means keeping track of Commands and Data Writes. (which is easily done).
    Other than that... using manual LCD control (without LCDout) is not done that often, except by folks who need to so such things, and those who like to re-invent the wheel... ;-}

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  5. #5
    hansknec's Avatar
    hansknec Guest


    Did you find this post helpful? Yes | No

    Default Hansknec

    Sorry,

    I keep jumping back and forth between PBP and CCS C, so I confuse my terminology, but the end effect of the LCDout command is very similar to passing a string variable into the unseen code that the compiler grabs from the bowels of the PBP directory at compile time. I felt that the code presented by Edward was pretty close to what the original intent of the thread was trying to solve. I was just hoping that there was something more to be gained (and shared). I don't know how many PBP users are out there using LCD's, but it sort of blows when you find out that the hardware serial port pin happens to be in the middle of your LCD data bus. I know..I know.. poor planning on my part right? I didn't originally think I needed the hardware serial port, but I have become fond of its interrupt capabilities. My problem can be solved by rewriting my code in C, but I'm kind of fond of PBP and have used it for numerous projects over the years.
    -John

  6. #6
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello John,

    John>>but the end effect of the LCDout command is very similar to passing a string variable into the unseen code that the compiler grabs from the bowels of the PBP directory at compile time.<<

    Yes the PBP is close to the passing of variables... not quite like C...you don't have function variables that are only addressable via that function. (non-global Variables).

    John >> I felt that the code presented by Edward was pretty close to what the original intent of the thread was trying to solve. I was just hoping that there was something more to be gained (and shared).<<

    Are you attemping to do your own LCD routines? If so, that is fine. I do my own LCD routines...I do not use LCDout, unless I absolutely have to. I don't feel like using 4 or 8 bits of a chip for LCD's, and I built my own backpack for serial communication. I just make my routines similar to LCDout, and plug away...

    Earlier in this thread, I gave a example of making the commands similar to a a LCDout.



    I thought about purchasing a C compiler (I program professionally with C/C++, using Borland compilers.) I thought it would be nice to have a C compiler, and I would understand its "terminology" and aspects of the language much better than PBP. I prefer (just because I am used to it) functions that pass variables, syntex that uses "{" and "}". Stuff like that.


    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  7. #7
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    @Dwayne

    how about this:

    This is a qoute
    Code:
    ' This is no working code!
      Line 1   'not working
      Line 2   'not working
    
    'etc . . .
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 19:52
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23:29

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