LCD_AnyPin.pbp


+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 40 of 113

Thread: LCD_AnyPin.pbp

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default LCD_AnyPin.pbp

    EDIT: Make sure to note that Darrel now uses VARiables and CONstants, not DEFINES.

    --------------------------------------------------------

    This has come up several times, and likewise, I've tried to approach it several times...

    After a 6 month pause from working on it, suddenly all my problems were staring me right in the face, leaving me to wonder ... "What the Hell was I thinking!" Or, maybe Not thinking.

    After fixing the now obvious mistakes ...
    Finally, "A Winner!"

    Here's a viable solution to ...

    "How do I scatter the pins of the LCD data bus across multiple ports with PicBasic Pro?"

    First, let me show you what a sample program might look like...
    Code:
    ;----[ Change these to match your LCD ]--------------------------------------- 
    LCD_DB4    VAR PORTA.0 
    LCD_DB5    VAR PORTB.3 
    LCD_DB6    VAR PORTB.7 
    LCD_DB7    VAR PORTC.1 
    LCD_RS     VAR PORTD.4 
    LCD_E      VAR PORTA.1 
    LCD_Lines  CON 2 ' # of Lines on LCD, 1 or 2 (Note: use 2 for 4 lines) 
    LCD_DATAUS CON 50 ' Data delay time in us 
    LCD_COMMANDUS CON 2000 ' Command delay time in us 
    INCLUDE "LCD_AnyPin.pbp" ; *** Include MUST be AFTER LCD Pin assignments ****
    
    ;----[ Your Main program starts here ]---------------------------------------- 
    LoopCount VAR WORD
    PAUSE 500 : LCDOUT $FE,1 : PAUSE 250 ; Initialize LCD (You may not need this, 
                                         ; but some displays are picky) 
    
    Main: 
        LCDOUT $FE,1 ; clear screen 
        LCDOUT $FE,$87,"Hello,",$FE,$C8,"From DT!"
    
        FOR LoopCount = 0 TO 65535 
            LCDOUT $FE,$80, IDEC LoopCount 
            LCDOUT $FE,$C0, IHEX4 LoopCount 
        NEXT LoopCount
    GOTO Main
    Pretty simple ey?

    Just assign the Pins, Include the file, and away you go, using LCDOUT just like you always have.

    Ok, so now for the other Simple part that can go tragically wrong if you're not careful.
    Yes, ... that's right, ... I'm modifying the Library again.

    Or, more accurately, ... "You" are modifying the Library.
    And before "You" change anything, ...
    "MAKE SURE" you have a backup of the file.
    Don't blame me if it gets messed up and you don't have anything to restore it with.
    And, I will apologize to MeLabs Support ahead of time for the extra support calls this will generate.
    Back it up! and they won't have a problem.


    In your PBP folder (the one with PBPW.EXE in it), open the Library file for the type PIC you are using.

    For 16F's open PBPPIC14.lib with Notepad.
    For 18F's open PBPPIC18.lib

    Search for this string ";* LCDOUT ". That's "semicolon star space LCDOUT space".
    You should see a section that looks like this ...
    Code:
    ;****************************************************************
    ;* LCDOUT     : Send char to LCD                                *
    ;*                                                              *
    ;* Input      : W = char                                        *
    ;* Output     : None                                            *
    ;*                                                              *
    ;* Notes      :                                                 *
    ;****************************************************************
     
        ifdef LCDOUTJ_USED
      LIST
    LCDOUTJ    movf    FSR, W    ; Jumpman entry
      NOLIST
    LCDOUT_USED = 1
        endif
     
        ifdef LCDOUT_USED
    ; NEW Code goes here...
      LIST
    LCDOUT  movwf   R3 + 1          ; Save char
    That one is from PBPPIC14.lib, for PBPPIC18.lib the only difference is it will show FSR0L, instead of FSR.

    Insert this code into the spot marked ; NEW Code goes here...
    It's very important that you get the EXACT line. Be careful ...
    Code:
    ;****************************************************************
    ;*               Added for HighJack                             *
    ;****************************************************************
    HIGHJACK_USED = 1                                              ;*
    LCDOUT_HIGHJACKED = 1                                          ;*
        ifdef HJ_LCDOUT                                            ;*
      LIST                                                         ;*
    LCDOUT                                                         ;*
            L?GOTO  HJ_LCDOUT                                      ;*
      NOLIST                                                       ;*
        else                                                       ;*
    ;****************************************************************
    Now, scroll down past the LCDOUT code, and you should see this ...
    Code:
      NOLIST
    DUNN_USED = 1
    PAUSEUS_USED = 1
        endif
    ; Second piece of NEW Code goes here ...
     
    ;****************************************************************
    ;* LOOK2      : Get data from any register                      *
    ;*                                                              *
    ;* Input      : R0 address / constant                           *
    ;*            : W data type                                     *
    ;* Output     : R0 result                                       *
    ;*                                                              *
    ;* Notes      :                                                 *
    ;****************************************************************
    Insert this code into the spot marked ; Second piece of NEW Code goes here ...
    Code:
    ;****************************************************************
    ;*               Modified for HighJack                          *
    ;****************************************************************
        endif
    If you got it right, you can now use your HD44780 LCD on any pins you wish.
    If you got it wrong, restore the file you backed up (You did back it up, right?). Then try again. It work's. Really! Trust me!

    GoodNote: This modification will NOT interfere with your normal PBP LCDOUT routines.
    In order to invoke the Custom LCD port routines, the main file must have the statement ...

    INCLUDE "LCD_AnyPin.pbp"
    If that statement is NOT included in your program, the LCDOUT commands will work the same way they always have.

    There are 2 files required to implement this approach ...

    LCD_AnyPin.pbp
    VirtualPort.bas -- (Included from the LCD_AnyPin.pbp file)

    Both files are included in the Zip file below. Extract them to your PBP folder.
    Attached Files Attached Files
    Last edited by Demon; - 20th September 2024 at 00:42.
    DT

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    Amazing!

    Congratulations Darrel!

    I am very impressed! Really!

    Thank you very much.

    Ioannis

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks Ioannis!

    Really!<hr>
    Lesson Learned, when it gets too tough.
    Set it aside for awhile.

    It might look easier when you come back to it later.
    Just make sure you come back to it.

    <br>
    DT

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    Yes you are right about that. It happens alot to me too!

    Since I'm more the hardware guy, is a little confussing to really understand what you are doing. But as long as it works, thats fine!

    Anyway you write great piece of code. I really appreciate your offers.

    Ioannis

  5. #5
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Needed to do this on one of my projects the other day. This will be very useful. Thanks Darrel.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oops!

    Apparently, not ALL my problems were staring me in the face.

    I had PAUSEs in the LCD_Init: routine, and they were changing the system registers.
    So I Changed them to DelayUS, which doesn't use system registers.

    It worked OK before, but now it works right. Or, at least more behaved when Initializing.

    I've updated the LCD_AnyPin.zip file in the first post.
    Version 2.1
    <br>
    DT

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    <h1> * * * * Another Home Run Darrel ! * * * *</h1>
    <p>
    <font color=red><h2> THANK YOU !</font color></h2><p>
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel, it will come in handy.
    Dave
    Always wear safety glasses while programming.

  9. #9


    Did you find this post helpful? Yes | No

    Talking Nice Nice Nice

    Thanks Darrel once again,

    To be completely honest: When i have a new doubt in PBP i don´t just think i´ll post it on the forum... i really really think:
    "HE will now, i`ll better ask him"

  10. #10
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    ....

    And before "You" change anything, ...
    "MAKE SURE" you have a backup of the file.
    Don't blame me if it gets messed up and you don't have anything to restore it with.
    And, I will apologize to MeLabs Support ahead of time for the extra support calls this will generate.

    <br>
    Darrel,

    I appreciate you sharing the code with us; and respect your knowledge. Thank you.

    BTW;
    Even though you clearly stated it, you will get this question anyway.

    Question from an UnKnown user:
    Hi Darrel, I tried to apply your "LCD_AnyPin" code into my project. I followed your instructions exactly as you stated. But, it did not work and now my LCDOUT command does not work at all. Can you collaborate me to solve this problem? because I don't see any problem on my side. I think your code is not ready for everyone, yet. Didn't you test it before releasing it?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  11. #11
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Reply to UnKnown user:
    You were warned.
    You didn't follow directions.
    You Blew It!
    Not my problem!
    And by the way, there's a copy of the file on the CD you got when you bought PBP.
    <br>
    DT

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer View Post
    ..... I think your code is not ready for everyone, yet. Didn't you test it before releasing it?
    Ohh, come on Sayzer, don't be to pessimistic! 8-)

    Ioannis

  13. #13
    Join Date
    Mar 2005
    Location
    Novi Sad, Vojvodina
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel.

    Regards
    Emil

  14. #14
    kezuke's Avatar
    kezuke Guest


    Did you find this post helpful? Yes | No

    Talking

    thank you very much!!!

  15. #15


    Did you find this post helpful? Yes | No

    Default OK now my post

    This is great stuff no doubt, it should be a suggestion to improve the PBP compiler in the future, i am sure we all had this nibble problem before.

    But it is not backwards compatible is it? all of my previous code will be impossible to compile with this change, am i wrong?

    Is it impossible to ask for backwards compatibility? Some magic from the magician please ;D.
    Being completely ignorant about this: IF LCD_E is not defined then use original LCDOUT command else use DTs version. (Most surely not possible )

    An obviuos solution is to have a whole new folder for the PBP modified and one for the original PBP, but in the end it will tend to give trouble, i am almost sure. I know i can handle it but this could be really dangerous code for newbies.

    Just my thought

    Again, thanks a lot DT


    DJC
    Last edited by Josuetas; - 7th September 2007 at 06:17.

  16. #16
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    Your answer is on the first post by Darrel explaining that all programs will work as before.

    Read it carefully from top to bottom.

    Ioannis

  17. #17
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    Ohh, come on Sayzer, don't be to pessimistic! 8-)

    Ioannis
    ....
    .......
    ..........

    Quote Originally Posted by Ioannis View Post
    Your answer is on the first post by Darrel explaining that all programs will work as before.

    Read it carefully from top to bottom.

    Ioannis

    ...
    .....
    ........


    Ioannis, do you see what I meant?

    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    Yes, I see... No comments!

    Ioannis

  19. #19


    Did you find this post helpful? Yes | No

    Angry Hey my wrong!!!

    You dont have to be such.......

    Thanks for the nice answer Ioannis

  20. #20
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    You are welcome!

    Ioannis

  21. #21
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor who scattered the pins of the LCD data bus across multiple ports with PicBasic Pro succesfully

    Now, scroll down past the LCDOUT code, and you should see this ...
    Code:
     NOLIST
    DUNN_USED = 1
    PAUSEUS_USED = 1
        endif
    I just realized that in my file, it is

    Code:
    DONE_USED = 1
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  22. #22
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Then they must sell a different version in Turkey.

    Because it's definitely DUNN_USED = 1 here
    <br>
    DT

  23. #23
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    There is nothing like "DUNN" in the file.

    Here is a piece from the code.

    Code:
    ....
    .......
        endif
    
            movlw   LCD_DATAUS	; Wait for data operation to complete
            call    PAUSEUS
            bsf     STATUS, C       ; Set no timeout for Serout2mod
            return
      NOLIST
    DONE_USED = 1
    PAUSEUS_USED = 1
        endif
    
    ;****************************************************************
    ;* LOOK2      : Get data from any register                      *
    ;*                                                              *
    ;* Input      : R0 address / constant                           *
    ;*            : W data type                                     *
    ;* Output     : R0 result                                       *
    ;*                                                              *
    ;* Notes      :                                                 *
    ;****************************************************************
    
        ifdef LOOK2_USED
      LIST
    LOOK2   iorlw   0               ; Check for constant
            btfsc   STATUS, Z
            goto    DONE            ; Constant so all set
            movwf   R4              ; Save type
            movf    R0, W           ; Set FSR for translate
            movwf   FSR             ; Put address in FSR
            btfsc   R0 + 1, 0       ; Long address?
            bsf     STATUS, IRP     ; Yes
            clrf    R0              ; Clear the result
            clrf    R0 + 1
            btfsc   R4, 7           ; Check type
            goto    look2bit        ; Bit type
            movf    INDF, W         ; Get low byte of data
            movwf   R0              ; Store it
            btfss   R4, 1           ; Byte or word?
            goto    DONE            ; Byte
            incf    FSR, F          ; Point to high byte
            movf    INDF, W         ; Word - get high byte
            movwf   R0 + 1          ; Store high byte
            goto    DONE
    look2bit call   CONVBIT         ; Change bit to mask
            andwf   INDF,W          ; Isolate bit
            btfss   STATUS, Z       ; Bit / no bit?
            incf    R0, F           ; Bit
            goto    DONE
      NOLIST
    CONVBIT_USED = 1
    DONE_USED = 1
        endif

    So instead of DUNN_USED = 1, I have DONE_USED = 1.


    Anyone else has the same?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  24. #24
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I can confirm what Sayzer is saying...

    Just randomly picking PBPPIC14.LIB from my PBP2.46 there is no DUNN_USED but DONE_USED...

    however...

    PBPPIC18.LIB does have DUNN_USED...

    So my British version is mid-way between Darrels American version, and Sayzers Turkish version... yup... about right on the Atlas too... so Alain will have a greater probability of being DONE than DUNN, and Ioannis and Luciano will almost certainly be DONE at sometime...

  25. #25
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,619


    Did you find this post helpful? Yes | No

    Talking The tree hiding the forrest ...

    Hi, Mel

    I've "DONE" in Pbpic14.lib and "DUNN" in Pbpic18.lib ...

    just like you !

    Buuuuuut ... is it really important ??? ( LOL ...); if I understood Darrel ... It's just to show the place where to include a piece of code.

    What ??? I did say something stupid ??? ... I apologize, then ! Acoording to Khomeiny Ayatollah ( and Sayzer ! ) ... What's the cost ?

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  26. #26
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Mel

    I've "DONE" in Pbpic14.lib and "DUNN" in Pbpic18.lib ...

    just like you !

    Buuuuuut ... is it really important ??? ( LOL ...); if I understood Darrel ... It's just to show the place where to include a piece of code.

    What ??? I did say something stupid ??? ... I apologize, then ! Acoording to Khomeiny Ayatollah ( and Sayzer ! ) ... What's the cost ?

    Alain

    Alain,

    You are making jokes, but I am sure only you are having some kind of smile on your face.

    I prefer not to fill this thread with your strange ongoing discussion.

    But, if you like to continue, then lets jump into OFF TOPIC section and see what you got there. Are you in?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  27. #27
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,993


    Did you find this post helpful? Yes | No

    Default

    On my old 2.40 compiler I can confirm what Melanie stated:

    PBPBIC12.lib: DONE_USED
    PBPPIC14.lib: DONE_USED
    PBPPIC17.lib: DUNN_USED
    PBPPIC18.lib: DUNN_USED

    Also note that on the last two libraries there are some ifdef SERIN2DONE_USED that are strange to me.

    Ioannis

  28. #28
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > Buuuuuut ... is it really important ??? ( LOL ...); if I understood Darrel ... It's just to show the place where to include a piece of code.

    I would think yes, because the clueless outnumber the clued ten to one on this forum. There's folks starting projects that are way beyoned their understanding or ability levels and stumbling over which way around a Resistor should be soldered in (oh, and yes, I do teach people that there is a proper way to insert Resistors and all non-polarised components).

  29. #29
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Although I am already using Darrel's LCD at any pin modification, I saw some difference and posted here.

    So that those "clueless" firends can also give it some meaning as to see "why?", and go on.

    Maybe this way, Melanie's students will not ask her whether the difference in their file creates any issue.

    If I see more difference I will post again.
    Alain will jump in and make some jokes and smile on his own -again.




    -----------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  30. #30
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I don't count you amongst the clueless Sayzer, I do consider you're amongst the living rather than the comatose... and your flagging the anomaly is both valid and worthwhile noting - if just for those that will follow us reading this thread and wonder why their files are different.

    I don't teach people PICBasic, although I do point out to those down in the production department that there is a right-way and a wrong-way of doing things... and when you do it properly, it makes a difference. For example, I mentioned Resistors... yes you can put them in any way you want (there are exceptions), but if you align them all the same way, so you can read the values left-to-right or top-to-bottom, such a simple thing doesn't half make a board look neater.

  31. #31
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,619


    Did you find this post helpful? Yes | No

    Post

    Hi, Sayzer

    To close the ( this tremendous ) subject ...

    1) "Anonymous user" DID NOT Follow "exactly" what to do ... instead of what you stated.

    2) No, I don't smile at all to those ... make me rather sad ...

    3) I Always respect real efforts to understand ...

    Take it easy ... making jokes is one of the best ways to remember something !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  32. #32
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    ROFL,

    A comical list of mistakes on my part.
    It all still works, but I can definitely see the confusion.

    Apparently when making the first Post, I used the beginning of LCDOUT from the PBPPIC14.lib.
    Then I was checking for differences between the 14 and 18.libs and didn't see any, so I copied the end of LCDOUT from the PBPPIC18.lib file. Then after Sayzer's post, I only looked at the 18.lib (which had DUNN), DOH!

    Thanks for the help Sayzer, and the confirmation from everyone else.

    I need to make new instructions for the installation of HighJack routines anyhow.
    Now there's LCD_AnyPin, PC064PYL, LCD_Shift and others that will use the same Modification.
    So I need to see if I can work out the confusion during installation.
    <br>
    DT

  33. #33
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel and thx for the great hack.

    I have had it working fine on 16F Pics and 18F pics, but today I tried it on a USB 18F2550 and it tells me the Hijacked-LCDOUT not found.

    As well as modifying the pbppic14.lib and pbppic18.lib , I also added it to the pbppi18l.lib as this seems to be called from PBPUSB18.LIB but no joy and get the error.

    Is it because it uses different files in the USB18 folder?

    Cheers

    Sean.
    *********************
    http://www.cncdudez.co.uk
    *********************

  34. #34
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sean-h View Post
    Is it because it uses different files in the USB18 folder?
    I don't think so.
    It ends up using the same library as non-USB programs.

    Do you have any LCDOUT statements in the program yet?
    Or are you trying to get it to compile before adding any?

    I ask because it won't add that portion of code until there are LCDOUTs.
    <br>
    DT

  35. #35
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I don't think so.

    Do you have any LCDOUT statements in the program yet?
    Or are you trying to get it to compile before adding any?

    I ask because it won't add that portion of code until there are LCDOUTs.
    <br>
    Spot on, that was it I had them Rem'ed out while setting up code.
    Now LCDOUT command in code, it compiles perfectly

    Many thanks Darrel, Good Stuff.
    *********************
    http://www.cncdudez.co.uk
    *********************

  36. #36
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Noob alert!

    I hate to sound like a noob (but I am) so here goes....

    I needed to do exactly this in a project, move the LCD data bus to different pins that is, I did the edit, saved the files (yes w/backup) and placed the example snippet of code into my BAS file.

    When I compile I'm getting this error:

    Error: unable to execute mpasmwin.Error[113]
    "symbol not previously defined (_LCD_DATAUS)"
    "symbol not previously defined (_LCD_COMMANDUS)"

    if I remove the lines:

    LCD_DB4 VAR PORTB.5
    LCD_DB5 VAR PORTB.4
    LCD_DB6 VAR PORTB.3
    LCD_DB7 VAR PORTB.2
    LCD_RS VAR PORTB.7
    LCD_E VAR PORTB.6

    it compiles (assembles?) w/o error. I can't find _LCD_DATAUS or _LCD_COMMANDUS in any readable files in my PBP folder.


    also if I leave those lines in, and just rem the INCLUDE "LCD_AnyPin.pbp" it compiles fine.

    (it's a 16F883 I'm working with on PBP 2.6)
    Last edited by PICn-It; - 13th November 2009 at 05:45.

  37. #37
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    LCD_DATAUS and LCD_COMMANDUS are constants that you must declare in your program. Shown in the first post of this thread.
    Code:
    LCD_Lines     CON 2    ' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
    LCD_DATAUS    CON 50   ' Data delay time in us 
    LCD_COMMANDUS CON 2000 ' Command delay time in us
    They are not optional.
    <br>
    DT

  38. #38
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    LCD_DATAUS and LCD_COMMANDUS are constants that you must declare in your program. Shown in the first post of this thread.
    Code:
    LCD_Lines     CON 2    ' # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
    LCD_DATAUS    CON 50   ' Data delay time in us 
    LCD_COMMANDUS CON 2000 ' Command delay time in us
    They are not optional.
    <br>
    I'm sorry, I should have posted a code snippet for you to see, I already did define them, is a "declaration" different that this?:

    Code:
    ; Define LCD registers and bits
    DEFINE LCD_DREG PORTB ;
    DEFINE LCD_DBIT 4 ;
    DEFINE LCD_RSREG PORTB ;
    DEFINE LCD_RSBIT 0 ;
    DEFINE LCD_EREG PORTB ;
    DEFINE LCD_EBIT 1 ;
    DEFINE LCD_COMMANDUS 2000   ; Set command delay time in uS
    DEFINE LCD_DATAUS 50        ; Set data delay time in uS
    DEFINE LCD_BITS 4           ; Set LCD buss size (4-bit or 8-bit) 
    DEFINE LCD_LINES 2          ; Set number of lines on LCD
    
    LCD_DB4   VAR PORTB.5
    LCD_DB5   VAR PORTB.4
    LCD_DB6   VAR PORTB.3
    LCD_DB7   VAR PORTB.2
    LCD_RS    VAR PORTB.7
    LCD_E     VAR PORTB.6
    ;INCLUDE "LCD_AnyPin.pbp"    ; this include MUST be AFTER LCD Pin assignments
    I tried this in PBP 2.46 and it does compile, but my MPLAB chokes because of some file missing or unsupported (COD file I think)
    Last edited by PICn-It; - 14th November 2009 at 00:46.

  39. #39
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Go back up to the first post and take another look at the highlighted code example.

    There are no DEFINEs, only VAR and CON.
    It must be exactly as shown (except for the actual pins used).

    Don't improvise or over think it. Just copy/paste and modify for your pins.
    <br>
    DT

  40. #40
    Join Date
    Nov 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Go back up to the first post and take another look at the highlighted code example.

    There are no DEFINEs, only VAR and CON.
    It must be exactly as shown (except for the actual pins used).

    Don't improvise or over think it. Just copy/paste and modify for your pins.
    <br>
    I must have some other issue at hand then if it's really that simple.

    Just for the sake of it I created a new project with the following minimal code, it still fails:
    (again MPLAB v8.40, PBP v2.60, PIC16F883)



    Code:
    CLEAR                        ; standard opening move
    ;DEFINE OSC 4                ; set oscillator speed
    
    LCD_DB4   VAR PORTB.5
    LCD_DB5   VAR PORTB.4
    LCD_DB6   VAR PORTB.3
    LCD_DB7   VAR PORTB.2
    LCD_RS    VAR PORTB.7
    LCD_E     VAR PORTB.6
    INCLUDE "LCD_AnyPin.pbp"    ; this include MUST be AFTER LCD Pin assignments
    
    PAUSE 500
    
    TRISA = %11111111
    TRISB = %00000000
    ADCON1=%00000111            
    
    DO
    loop: 
    
          LCDOUT $FE, 1
          PAUSE 250
          LCDOUT "Hello"
          LCDOUT $FE, $C0
          LCDOUT "World"
          PAUSE 250
          
    END

    ...and this is my output spew:
    Executing: "D:\PBP\PBPMPLAB.BAT" -ampasmwin -k# -p16F883 "Untitled.bas"
    Executing: "D:\PBP\PBPW.EXE" -ampasmwin -k# -p16F883 "Untitled.bas"
    PICBASIC PRO(TM) Compiler 2.60, (c) 1998, 2009 microEngineering Labs, Inc.
    All Rights Reserved.
    Pass 1:
    Pass 2:
    Code Gen:
    Macro Pass:
    mpasmwin /o- "D:\PIC Projects\Untitled.ASM"

    ERROR: Unable to execute mpasmwin.Error[113] D:\PIC PROJECTS\UNTITLED.ASM 244 : Symbol not previously defined (_LCD_DATAUS)
    Error[113] D:\PIC PROJECTS\UNTITLED.ASM 244 : Symbol not previously defined (_LCD_DATAUS)
    Error[113] D:\PIC PROJECTS\UNTITLED.ASM 244 : Symbol not previously defined (_LCD_COMMANDUS)
    Halting build on first failure as requested.
    BUILD FAILED: Sat Nov 14 14:08:14 2009
    Sorry to bother you about this, and than you for taking the time to replay to my posts. Pardon me as I'm a noob to PIC programming and have not developed any intuition with this environment yet.

    If this code indeed works for you, as shown, it should work for me but isn't.
    (yet)
    Last edited by PICn-It; - 14th November 2009 at 23:32.

Members who have read this thread : 10

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