+ Reply to Thread
Page 3 of 3 FirstFirst 123
Results 81 to 108 of 108

Thread: LCD_AnyPin.pbp

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

    Default

    Each family of PIC's has it's own library.

    PBPPIC14.lib is for the normal 14-bit cores (12, 16F).
    PBPPIC18.lib is for the 18F's.
    PBPPI18L.lib is for 18F's with PBPL (longs).
    And PBPPI14E.lib is the enhanced 14-bit cores.

    The HighJack routines should be installed in the corresponding .lib file for the PIC you want to use LCD_AnyPin with.

    Once again ... make a copy of the file before editing it !!!!
    DT

  2. #82
    Join Date
    Jan 2009
    Posts
    79

    Default fixed

    Thank You,
    I was changing the PBPPIC14.LIB instead of the PBPPI14E.LIB .... NOW IS FINE

    once again Thank You

  3. #83
    Join Date
    Jan 2009
    Posts
    79

    Default LCDOUT for other LCD controllers than HD44780

    Do you think is a way to use LCDOUT (using LCD_AnyPin) to a HD66717 lcd module considering the diferences from HD44780 ?

    HD44780 vs HD66717.pdf

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

    Default

    Yes.

    That should be easy to do.
    DT

  5. #85
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,196

    Default

    bogdan , It sound like 8 bit instead of 4 bit mode....

    Dave Purola,
    N8NTA

  6. #86
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,235

    Default Re: LCD_AnyPin.pbp

    Quote Originally Posted by Darrel Taylor View Post
    Each family of PIC's has it's own library.

    PBPPIC14.lib is for the normal 14-bit cores (12, 16F).
    PBPPIC18.lib is for the 18F's.
    PBPPI18L.lib is for 18F's with PBPL (longs).
    And PBPPI14E.lib is the enhanced 14-bit cores.

    The HighJack routines should be installed in the corresponding .lib file for the PIC you want to use LCD_AnyPin with.

    Once again ... make a copy of the file before editing it !!!!

    For PIC16F737, I am getting "ERROR: (HighJacked-LCDOUT Not found in PBPPIC??.LIB"

    The HighJack routine is in all the files needed.

    What am I missing?

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

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

    Default Re: LCD_AnyPin.pbp

    Do you have more than 1 installation of PBP?
    MCS or MPLAB may be looking at a different folder.

    Or the routines may be inserted in the wrong lines of the .lib file.
    DT

  8. #88
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,235

    Default Re: LCD_AnyPin.pbp

    Hi Darrel,

    It is compiling it for other PICs with no problem.

    And checking the lines of the files for inserted codes, they are all ok.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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

    Default Re: LCD_AnyPin.pbp

    The library file used with the PIC16F737 is PBPPIC14.lib
    If it compiles for other 16F's like an 877a then I don't see a reason for it to not compile for the 737.

    Do you have any LCDOUT commads in your program? Or are you trying to compile the include by itself?

    If there are no LCDOUT statements, the HighJack routines will not be included.
    DT

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

    Default Re: LCD_AnyPin.pbp

    Quote Originally Posted by Darrel Taylor View Post
    The library file used with the PIC16F737 is PBPPIC14.lib

    If there are no LCDOUT statements, the HighJack routines will not be included.
    There is the issue.

    In fact, it was among my notes, but I missed it.

    Problem solved.

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

  11. #91
    Join Date
    Feb 2011
    Posts
    14

    Default Re: LCD_AnyPin.pbp

    Is it possible to take this 1 step further and support LCDs with 2 Enable pins?

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

    Default

    Yes, we've done that.

    If you don't need to scatter the data bus pins, you can do it with this ...
    http://www.picbasic.co.uk/forum/show...=2388#post2388

    Or if the data bus need to be scattered, there's this thread ...

    In particular post #35, but read the whole thread.
    http://www.picbasic.co.uk/forum/showthread.php?t=7596
    DT

  13. #93
    Join Date
    Jul 2011
    Posts
    14

    Default Re: LCD_AnyPin.pbp

    Hi,

    I have try with succes the library but I have a strange error. I have compiled this simple part of code:

    Code:
    LCD_DB4         var PORTB.1
    LCD_DB5         vAR PORTB.2
    LCD_DB6         VAR PORTB.3
    LCD_DB7         VAR PORTB.4
    LCD_RS          VAR PORTB.5
    LCD_E           VAR PORTC.5
    LCD_LINES       CON 1
    LCD_DATAUS      CON 50
    LCD_COMMANDUS   CON 1500
    OSC             con 20
    
    TRISA.0 = 1
    TRISB = 0
    TRISC = 0
    
    INCLUDE "LCD_AnyPin.pbp"
    
    pause 500
    lcdout $FE,1
    pause 250
    
    Main:
        lcdout $FE, $80, "Abcdef"
    Ever:
        high PORTA.1
        PAUSE 500
        LOW PORTA.1
        PAUSE 500
    GOTO Ever
    When I run this I see odd things like "AAdfg" or " dAfg" etc etc. I think that is a timing error, you have suggestion for this kind of error?

    Thank you (and sorry for my bad english).

  14. #94
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,235

    Default Re: LCD_AnyPin.pbp

    What is this "OSC con 20" doing in there?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  15. #95
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Re: LCD_AnyPin.pbp

    Also use these:

    Code:
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 100
    NOT these:
    Code:
    LCD_DATAUS      CON 50
    LCD_COMMANDUS   CON 1500
    Ioannis

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

    Default Re: LCD_AnyPin.pbp

    It should be the constants, not the defines.

    But Sayzer is right. OSC con 20 will not compile if you have used DEFINE OSC 20.
    Which means PBP thinks your PIC is running at 4Mhz.
    DT

  17. #97
    Join Date
    Jul 2011
    Posts
    14

    Default Re: LCD_AnyPin.pbp

    Quote Originally Posted by Darrel Taylor View Post
    It should be the constants, not the defines.

    But Sayzer is right. OSC con 20 will not compile if you have used DEFINE OSC 20.
    Which means PBP thinks your PIC is running at 4Mhz.
    Sorry you guys, I wrote:

    OSC WITH 20

    but I had to write:

    DEFINE OSC 20

    I could not understand the error because it compiled correctly. Thanks to all.

  18. #98
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: LCD_AnyPin.pbp

    Was LCD_AnyPin included in PBP version 2.6 as was suggested a couple of times in this thread? If not, why not?

  19. #99
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default Re: LCD_AnyPin.pbp

    Now that PBP3 is released let me re-phrase my above question: Was LCD_AnyPin included in PBP3 and if not, why not?

  20. #100
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: LCD_AnyPin.pbp

    Not it's not, because it's not a common and frequent way to use an LCD.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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

    Default Re: LCD_AnyPin.pbp

    The mechanism used in LCD_ANYPIN that overrides library commands was used in PBP3.

    However, it was used in the HPWM command due to necessity.
    Microchip changed the 18FxxK80 parts so much that the CCP modules were not compatible with the old HPWM library code.

    So Jeff wrote some new HPWM routines, I came up with a way to replace the existing library routines (borrowing from LCD_AnyPin), then Charles did the actual implementation on a chip by chip basis in the .pbpinc files. Really cool stuff.

    We've talked about it alot, and as long as no bad side affects are found with the K80 HPWM commands ... one possibility is to allow overriding many of the library functions with new routines, and I'm sure LCD_AnyPin will be one of the first if that happens.

    Steve,
    In another thread you mentioned PBP_HARDWAREDEF.
    That's part of the library override.

    In the .pbpinc file for a K80, that macro is declared.
    It is simply a #include, that adds the new code for HPWM.

    A #define is added too (HPWM_OVERRIDE).
    The old library code is wrapped with IFNDEF HPWM_OVERRIDE, so with the define ... the old routines are eliminated and the new included routines take over.

    Imagine overriding HSERIN/HSEROUT to use buffers.
    DT

  22. #102
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: LCD_AnyPin.pbp

    Thanks for the explanation, still waiting the user command (whatsoever it is called) explanation

    I can imagine a load of override AND overload without any problem...I also have no problem to imagine why people think we are so excited about that. And, finally, I have no problem to imagine how many rants & questions this will bring as well... maybe we can finally get rid of those "WHY my LED do not blink on PORTA" questions?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  23. #103
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: LCD_AnyPin.pbp

    Code:
    ;  Additional header code to accommodate device-specific library routines
    #header
        #define HPWM_OVERRIDE 1
    PBP_HARDWAREDEF  macro
        #include PBP_PATH\HPWM_K80_1.HWLIB
      endm
    #endheader
    Hhhhhhhhhhha! Another thing to chew on... even if it's just fow HPWM now....

    HPWM "Hello", 13,10
    Last edited by mister_e; - 11th August 2011 at 07:15.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  24. #104
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563

    Default Re: LCD_AnyPin.pbp

    Hi,

    Another weird proposition.

    LCDOUT is a blocking command if I am not wrong and it would be great if a task/que scheduler like app could be designed. During command delay it wastes 2 ms. I believe a whole LCD update/refresh within 200ms should be acceptable.

    So the idea is keeping a buffer equal to the total number of LCD character and updating the LCD from it character by character at 2ms interval, through an ISR. So a LCDOUT $FE, 1 just clears the buffer and LCDOUT puts the character in buffer rather than sending it directly to LCD I/Os. Making the timebase 1ms maybe through a compare module may couple other functions as well. RTC for example, non-blocking interrupt compatible delays, MUX options on the LCD lines etc. Use of 2 dimensional arrays makes it possible to have different LCD display screens ready to called just by a pointer may be automatically, sequentially, unattended.....

    Hey I am not drunk ........I did it a couple of years back in a hard way. LCD being handled entirely in ASM and not compatible with LCDOUT.

    Can't afford 2ms delays in my sinewave inverter (Work in Progress for a PBP WiKi)
    Regards

    Sougata

  25. #105
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190

    Default Re: LCD_AnyPin.pbp

    Hi,

    I'm trying to use LCD_Anypin with an external clock but I'm not having success. Pic 16f819 (Posted in another thread in PBP Pro)

    I wrote some code incorporating LCD_Anypin and ran it on a development board with a 10Mhz crystal oscillator. I used one odd pin for the LCD.

    It compiled with DEFINE OSC 10 and it ran perfectly on the development board.


    I then placed the chip into a working board using an external 10Mhz clock input and set the fuses accordingly. This was the only change in hardware.

    Software wise I tried DEFINE EXTCLK_OSC and the same plus 10 on end, I also tried OSC 10 as well. Both these produced an output on the LCD but very oddly.

    4 line display. As a test I did LCDOUT $FE,$80,"TEST" and LCDOUT $FE,$94,"AAAA"

    resulted in:-

    1st Line has a flashing cursor at the end of the line.
    2nd line blank
    3rd line has ooo<
    4th line blank

    Adding charactrs to the LCDOUT matches character count on 3rd line. i.e AAAAAA produces ooooo<

    I wondered if there was something specific timing wise that LCD_Anypin wouldn't work correctly with an external clock?

    Anyone any ideas why I get the gobbledegook output with ext clk and correct text with xtal input??

    Thanks
    Last edited by tasmod; - 27th January 2012 at 14:59.

  26. #106
    Join Date
    Jan 2006
    Location
    North of France
    Posts
    18

    Default Re: LCD_AnyPin.pbp

    Hello.
    Old thread but so useful !
    Thanx to Darrel.

    Fyi this mod seems not working with SPLC780D / 4 lines / 20char.
    It compiles but the screen show various contrasts.

    I'll try with a HD44780 next week and will confirm.

  27. #107
    Join Date
    Jan 2006
    Location
    North of France
    Posts
    18

    Question Re: LCD_AnyPin.pbp

    I'checked today and did a try vith an LCD 2 lines and same issue.
    Then I suppose the problem doesnt come from the screen.

    PIC : 16F685
    PBP : 2.60C
    Modded files : pbppic14.lib pbppi14e.lib pbppic18.lib pbppi18l.lib
    Added files in PBP dir : LCD_AnyPin.pbp & VirtualPort.bas
    Shematic is exactly identical in case one and 2.

    Case one - The code below works with modded files but without use AnyPin function :
    Code:
    @ device PIC16F685, intrc_osc_NOCLKOUT, wdt_off, pwrt_on, mclr_off, protect_off, bod_on
    
    ANSEL  = %00000000       ' Set pin AN0 to AN7
    ANSELH = %0000           ' Set pins AN8 to AN11
    
    '===============================================================================
    Define LCD_COMMANDUS 2000 ' Command Delay (uS)
    Define LCD_DATAUS 50 ' Data Delay (uS)
    
    DEFINE LCD_DREG PORTB               ' Set LCD Data on PORTB
    DEFINE LCD_DBIT 4                   ' Set starting Data bit on PORTB.4 (0 or 4) if 4-bit bus i.e, PortB.4-PORTB.7
    DEFINE LCD_RSREG PORTC              ' Set LCD Register Select on PORTA
    DEFINE LCD_RSBIT 6                  ' Set LCD Register Select bit on PORTA.4 (PORTA.3 is only in input mode)
    DEFINE LCD_EREG PORTC               ' Set LCD Enable on PORTC
    DEFINE LCD_EBIT 7                   ' Set LCD Enable bit on PORTC.7
    DEFINE LCD_BITS 4                   ' LCD in 4 bit mode
    DEFINE LCD_LINES 2                  ' 4 lines LCD display
    '===============================================================================
    
    ;----[ 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
        PAUSE 1000
        LCDOUT $FE,"Starting..."
        PAUSE 1000
         
        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
    Case two - The code below doesnt work with modded files and using AnyPin function :
    Code:
    @ device PIC16F685, intrc_osc_NOCLKOUT, wdt_off, pwrt_on, mclr_off, protect_off, bod_on
    
    ANSEL  = %00000000       ' Set pin AN0 to AN7
    ANSELH = %0000           ' Set pins AN8 to AN11
    
    '===============================================================================
    'Pins free assignment with Hijack by Darrel Taylor [http://www.picbasic.co.uk/forum/showthread.php?t=7038] 
    LCD_DB4    VAR PORTB.4 
    LCD_DB5    VAR PORTB.5 
    LCD_DB6    VAR PORTB.6 
    LCD_DB7    VAR PORTB.7 
    LCD_RS     VAR PORTC.6 
    LCD_E      VAR PORTC.7 
    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"
    '===============================================================================
    
    ;----[ 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
        PAUSE 1000
        LCDOUT $FE,"Starting..."
        PAUSE 1000
         
        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
    In both cases, it compiles well without error but with AnyPin, the screen seems not initializing.

    Cause AnyPin was realised before the 2.60C PBP ver., is there a compatibility issue ?

    Thanx a lot for any help.

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

    Default Re: LCD_AnyPin.pbp

    LCD_AnyPin works with all versions of PBP from 2.46 and later.

    But you'll need to use the MPASM assembler.
    Which means you also need to change your @ DEVICE statement.

    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOR_ON & _IESO_OFF & _FCMEN_OFF
    Don't forget to comment the default __config line in the 16F685.inc file in your PBP folder.

    And you have started a command sequence in your LCDOUT line ... but there's no command.

    LCDOUT $FE,"Starting..."

    That will do strange things to the LCD.

    After assembling with MPASM, and removing the LCDOUT line ... this is what I get with a 16F685 and PBP 2.60 ...

    DT

Members who have read this thread : 2

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