LCDOUT custom commands - how to?


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 69
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default LCDOUT custom commands - how to?

    Hello,

    I just bought a LCD from ELECTRONIC ASSEMBLY http://www.lcd-module.de/deu/pdf/doma/dog-m.pdf. It is a ST7036 (HD44780 compatible) controlled display.

    After I made all required connexions, it doesn't work but I think I need to initialise the display since some settings like "Display ON/OFF" and "Contrast" are set by software (no cabling).

    I've got the initialisation codes in this table (see attachment) but... I don't really know how to use them.

    I declared all DEFINEs and wrote
    Code:
    LCDOUT $FE, $0F
    to switch the display on? Nothing happens - must be wrong.

    The "$FE" must be wrong. I found also the documentation about the controller that pilots this display here http://www.lcd-module.de/eng/pdf/zubehoer/st7036.pdf.

    It's surely not complicated, nevertheless I'm a little lost...
    Attached Images Attached Images  
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Nope, the first LCDOUT should take care of the initialisation. For safety sake use a 500mSec-1Sec at the top of your code before the first LCDOUT.

    LCDOUT $FE,1 just clear the display.

    Be sure you don't use your LCD on analog i/o AND/OR open drain type without using the right method (pull-up, set all I/Os to digital)

    As usual, your WHOLE code and PIC# will help.
    Steve

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

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Code

    I'm still not sure how to connect the datalines from the display to the PIC (is it DB0 = D7 and so on or is it DB0 = D4 and so on).

    Here is my code:
    Code:
    'PIC 16F88
    
    ' LCD circuitery
    '23,24,25,26,32,33,34,35,40 - Vdd (+5V)
    '27,38  - Vss (GND)
    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3
    '39 RS  - PORTA.4
    '36 E   - PORTA.6
    '37 R/W - PORTA.7
    
    
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 4           'LCD data starting bit 0 or 4 
    DEFINE LCD_RSREG PORTA      'LCD register select port 
    DEFINE LCD_RSBIT 4          'LCD register select bit 
    DEFINE LCD_EREG PORTA       'LCD enable port 
    DEFINE LCD_EBIT 6           'LCD enable bit 
    DEFINE LCD_RWREG PORTA      'LCD read/write port
    DEFINE LCD_RWBIT 7          'LCD read/write bit
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    START:
        Lcdout $FE, 1           'Clear screen
    
    
    MAIN:
        pause 1000
        lcdout $FE, 2,   "This is line one"
        lcdout $FE, $C0, "This is line two"
        goto MAIN
    
    end
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    This...

    '28 DB0 - PORTA.0
    '29 DB1 - PORTA.1
    '30 DB2 - PORTA.2
    '31 DB3 - PORTA.3

    is not compatible with this...

    DEFINE LCD_DREG PORTA 'LCD data port
    DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

    ...and double-check with the Datasheet that you've disabled all Analogue Functions on PortA.

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    The display's datasheet makes me connect the lines D4 to DB3, D5 to DB2, D6 to DB1 and D7 to DB0 (see attachment "DB-Lines_connections.jpg"). This is why I thought the starting bit would be the fourth.

    I changed:
    Code:
    DEFINE LCD_DREG PORTA       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting bit 0 or 4
    and added:
    Code:
    ADCON0.0   = 0              'Disable Converter Module
    I went through the PIC's datasheet and couldn't find other settings that could affect the A ports. Still, the display looks just dead.

    I have two of them and react the same. I changed for my second 16F88 and the result is same too.
    Attached Images Attached Images  
    Roger

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Normally for a 4 bit bus

    DB0-DB3 = D4-D7

    Also if you are using a 16F88 check the ANSEL register
    Keith

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

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    ANSEL is set to have all analog ports disabled.

    As you suggested, I connected DB0 to D4 and so on...

    Still nothing happens.

    I'm just suprised that the display don't even flickers a little. It looks just like dead. Two displays doing the same makes me think I'm doing something wrong.

    Is is right to say that to make it work the Enable bit must be high? If yes, I could at least mesure it with my logic probe or oscillo....

    What can I "electrically" check else to minimise the cabling error risk?
    Roger

  8. #8
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Is there (or should there be) a contrast control that needs adjusting ?
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default

    i'm not sure if PBP handle the R/W line itself.

    How about LOW PORTA.7

    AND maybe i'm blind.. i don't see any config fuses?

    On some LCD, you need to tie the unused DB lines to GND, in your case they should be tied to 5V.

    AND what about the CSB line?
    <img SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1215&d=1164381937">
    Last edited by mister_e; - 24th November 2006 at 17:24.
    Steve

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

  10. #10
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Fuses & contrast setting

    Mister_e don't worry, your eyes are absolutely fine ;-)

    I'm using ICProg to program the µC and the fuses are set in there since I can't pass this kind of settings from PBP.

    The actual settings are:
    WDT:ON
    PWRT:ON
    MCLR:ON
    BODEN:ON
    LVP:OFF
    CPD:OFF
    DEBUGGER:OFF
    CCPMX:ON

    I've connected the display as it is described on the schematic so the DB line are all connected to Vdd and the CSB (I don't know what this is for) is connected to Vss.

    I just tried the PORTA.7 = 0 option.... still nothing.

    Keith, the contrast control is software set. I agree, this could be the problem and this is also why I need to understand how I have to adress (exact command syntax) the display.

    The LCD CONTRAST setting could be the problem.

    I've attached the initialisation codes for this display (unfortunately, it's an 8 bit example - is it important?). Is it possible that the LCDOUT $FE command doesn't fit with this display's controller (ST7036)?
    Attached Images Attached Images  
    Roger

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


    Did you find this post helpful? Yes | No

    Default Yes you can!

    Quote Originally Posted by flotulopex
    Mister_e don't worry, your eyes are absolutely fine ;-)

    I'm using ICProg to program the µC and the fuses are set in there since I can't pass this kind of settings from PBP.
    Hi flotulopex, I use IC PROG and I pass the config fuse data to it from code always. Which assembler are you using PBP or MPASM? Also what osc speed?
    Code:
    for MPASM try
    @MyConfig = _HS_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF 
    @MyConfig = MyConfig  & _CP_OFF & _BODEN_ON & _DATA_CP_OFF
    @ __config  MyConfig
    
    for PBP try
    @ DEVICE pic16F88, HS_OSC
    ' Set Oscillator Fuse in Programmer to high speed make XT for low speed
    @ DEVICE pic16F88, WDT_ON
    ' Watchdog Timer
    
    @ DEVICE pic16F88, PWRT_ON
    ' Power-On Timer
    
    @ DEVICE pic16F88, MCLR_ON 
    ' Master Clear Options (Internal)
    
    @ DEVICE pic16F88, BOD_OFF
    ' Brown-Out Detect
    
    @ DEVICE pic16F88, LVP_OFF
    ' Low-Voltage Programming
    
    @ DEVICE pic16F88, CPD_OFF
    ' Data Memory Code Protect
    ' Set to CPD_OFF for Development Copy
    ' Set to CPD_ON for Release Copy
    
    @ DEVICE pic16F88, PROTECT_OFF
    Also make sure to define your oscillator if you do not use default 4 mhz
    JS
    Last edited by Archangel; - 25th November 2006 at 09:00.

  12. #12
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default Time to go back to basics I think

    There are basically two things that could be stopping you display from working.

    1. a problem with the PIC

    2. a problem with the display.


    To test 1....

    I would assign an entire 8 bit port for the LCD eg PortB (just for test purposes) and connect LEDs to each bit. Also put LEDs on the pins of another port that you will use for the control lines.

    Have a count run from 0-255 and output that to port B and observe that the LEDs count up correctly.

    Likewise output all possible combinations on the pins you use for the control lines just to ensure that all your output pins are correctly configured and can successfully light the LEDs.


    to test 2......

    Once you know that you PIC is capable of driving all the required lines, connect up the LCD display in 8 bit mode and then try all the commands to get it working. Once you have it working it should be simple to change to 4 bit mode.

    As far as I can see the only difference between 4 and 8 bit mode is in the initialisation which tells the LCD how it is connected. All subsequent commands should be the same, the only difference being that instead of sending a byte you have to send two nibbles instead which obviously takes twice as long.

    I have had a further thought about something that caught me out a few weeks ago when changing to a different display. I didnt have the R/W line connected to the PIC, but I also didnt have it tied to anything either. The origianl display must have had some form of internal pullup/pulldown resistor as it didnt mind about the floating pin but the new display would not do anything until correctly terminated.

    The second datasheet you mentioned for the actual controller chip has full examples of initialising in 8 and 4 bit mode so all the actual values you need are listed there. Ignore the fact that it is written in 8051 assembler just use the values in your PBP code. Being 44780 compatable means that it should work fine with LCDout so my bet is a misconfiguration of the PIC or a wiring fault unless you are really unlucky and have killed a piece of hardware.
    Keith

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

  13. #13
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Fuses!!!! yes, it works really :-)

    Wow Joe S!!

    Yes it works; I'm very surprised indeed. I was told it was not possible with ICProg.

    I'm using PBP. Where did you find the correct syntax to use for every fuses?



    Keith,

    You're right. Let's go on with method. I'm starting to check as you suggest. Will come back when done.
    Roger

  14. #14
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default PIC tested = ok

    Hi Keithdoxey,

    I tested the PIC with my logic probe and hope doing so is fine (please let me know if it is not a good practice - I'm not an electronician).

    My PIC looks okay so far.

    Going now to the second step: check the LCD.

    Come back later.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    I'm using PBP. Where did you find the correct syntax to use for every fuses?
    If you're using PM, open m16f88.inc file in c:\pbp\inc folder, they're located at the top.

    If you're using MPASM, open p16f88.inc file in C:\Program Files\Microchip\MPASM Suite folder. They're located at the bottom.

    There's a huge thread Here about that.
    Steve

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

  16. #16
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Got so much to learn today...

    Thanks Mister_e,

    Fuse config is now clear to me ;-)

    Back to my display, I did what keithdoxley suggested but still it's not working.

    Finally, I connected my usual display on the PIC with an 8 bit data-bus. It works fine so, for sure, the PIC is not the problem.

    I have contacted ELECTRONIC ASSEMBLY and asked for more informations. I still can't believe I would have broken both displays...

    For normal use, the display must be set in Read or Write (R/W)?

    One last thing about the contrast control: would be the syntax to change the contrast's setting "LCDOUT $FE, $74"? According to the table (Initialise_LCD.bmp) in post #10, it should but how to change the amount of contrast???
    Last edited by flotulopex; - 25th November 2006 at 14:19.
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Thanks Mister_e,

    Fuse config is now clear to me ;-)
    You're welcome, It's always handy to have theses in your code.

    One last thing: for normal use, the display must be set in Read or Write (R/W)?
    Unless you want to read from your LCD (Wich i still don't understand why anyway) you should set the PIN to 0, low, gnd.
    Steve

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

  18. #18
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default LCD Write?

    Yes, really handy. Thanks a lot again.

    I would appreciate to find some more explanations on how to read (understand) and write to the display the configuration commands such as LCDOUT $FE, xxx.

    Merci encore.
    Roger

  19. #19
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Contrast to be set - yes, but how?

    I've got an answer from ELECTRONIC ASSEMBLY (EA). They say this display is fully HD4470 compatible.

    So, until the contrast (all the display in fact) is not initialised properly, nothing will happen on the display.

    I've got this table extracted from the PDF file I inserted in my first post:


    This example is for a 8 bits display. I would prefer to use it with 4 bits but if it is easier to start this way...

    Can somebody tell me what syntax I have to use to modify the contrast settings?

    Is it LCDOUT $FE, $74? I tried this already but nothing happened.

    I don't understand how to use this table. Could somebody explain me please?

    BTW, EA also sent me some assembly examples (see attachments); for those who understand this, it may help, maybe. Unfortunately, I don't know assembler...

    Mister_e, see the picture? Thanks you, again ;-)
    Attached Files Attached Files
    Last edited by flotulopex; - 26th November 2006 at 12:34.
    Roger

  20. #20
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Take a look at http://www.lcd-module.de/eng/pdf/zubehoer/st7036.pdf

    Pages 34-38 tell you exactly what each register contains and what each bit does.

    Page 39 shows 8 bit initialisation

    Page 41 shows 4 bit initialistaion but you dont need to go down to that lave. PBP should take care of that for you.

    Just look for the commands that set the contrast. It look to be "$7x" where x is the setting 0-F for the 16 possible values.

    I would follow Steves advice for leaving a long delay after the first initialistaion command then try something like this
    Code:
    contrast             var byte
    contrastcommand var byte
    
    
    
    For contrast = 0 to 15
       contrastcommand = $70 + contrast
       LCDout $FE, contrastcommand
       pause 10
       LCDout $FE,1, "contrast=", DEC2 contrast
       pause 1000
    Next
    That should send all possible values to the LCD for adjusting the contrast and if it works you will see on the display the values that give a visible display. Then pick the best one.

    Cant really offer much more as I dont have that type of display.
    Keith

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

  21. #21
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default let's try this

    Okay.

    I'll go back to my breadboard and try.

    Come back asap.
    Roger

  22. #22
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default ...

    I did almost everything all of you suggested.

    Still nothing works; the display is just not showing anything.

    I even tried to reverse the bus order (sorry Melanie) since the guy from EA said this would be so (but I can't believe it - D0 on display should be connected to DB0 and so on, for sure).

    Ii is now sunday 15:45 local time and I won't be able to have news before tomorrow morning.

    So, let's wait a little...
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Can you try...
    Code:
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    ManualLCDInit:
        FLAGS=2  ' Void PBP lcd initialisation... it's a nice feature !!!
        PAUSE 500
        Lcdout $FE, $30
        Lcdout $FE, $30
        Lcdout $FE, $30
        Lcdout $FE, $20 ' official 4 bit mode
        Lcdout $FE, $28 ' Function Set
        Lcdout $FE, $14 ' Bias
        Lcdout $FE, $78 ' Contrast set
        Lcdout $FE, $5E ' Power/Icon/Contrast
        Lcdout $FE, $6A ' Follower control
        Lcdout $FE, $0C ' Display ON
        Lcdout $FE, $01 ' Clear display
        Lcdout $FE, $06 ' Entry mode Set
       ' --------------------------------- End LCD init!
    
        LCDOUT $FE,1,"Line1",$FE,$C0,"Line 2"
    Pouet: 
        Goto Pouet
    there's still some more code efficient solutions so far..
    Steve

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

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


    Did you find this post helpful? Yes | No

    Lightbulb

    Hey Steve.

    I could be wrong, but I think it needs a fix.

    The LCD will Power-up in 8-bit mode, but PBP will still be sending 4-bit.
    So each nibble acts as a full command.
    If you use $33 (twice), then it will get the "reset" 4 times, instead of $30,$00,$30,$00 ...

    Then when it switches to 4-bit mode, it receives an extra nibble from the $20 which puts it out of sync with the rest of the data. By pulsing the E pin once it clocks in another $0 which is a "nothing" command and puts it back in sync.

    Like this ...
    Code:
    ManualLCDInit:
        FLAGS=2  ' Void PBP lcd initialisation... it's a nice feature !!!
        PAUSE 500
        Lcdout $FE, $33
        Lcdout $FE, $33
        Lcdout $FE, $20 ' official 4 bit mode
        @  bsf LCD_EREG, LCD_EBIT
        PAUSEUS 20
        @  bcf LCD_EREG, LCD_EBIT
    
     ; -- rest is the same --
    DT

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


    Did you find this post helpful? Yes | No

    Default Turn off comparators too

    Hi flotulopex,
    Ms Melanie mentioned to make sure all analog stuff is off, I saw no mention of the comparators. That silly 16F88 uses them. One of the harder early 16f series to set up because it uses ansel, adcon and cmcon registers and people seem to miss one or the other.
    CMCON=7
    JS

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


    Did you find this post helpful? Yes | No

    Default

    Darrel, i think you're right. My previous work on a regular 44780 controller type so far but will send
    3,0,3,0,3,0, and lastly 2,0... so 3 not really needed 0's...

    I did something else, but i don't think it will be handy now.

    NOW...
    Code:
        @  bsf LCD_EREG, LCD_EBIT
        PAUSEUS 20
        @  bcf LCD_EREG, LCD_EBIT
    yup, or
    Code:
        @  bsf LCD_EREG, LCD_EBIT
        @  PAUSEUS?C LCD_DATAUS
        @  bcf LCD_EREG, LCD_EBIT
    Joe S. The analog comparator are disable at POR on this one. But it's always nice to include the line too as safety sake.
    Last edited by mister_e; - 27th November 2006 at 07:00.
    Steve

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

  27. #27
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    It's so cruel: when I think all has been done, you All come with more suggestions and I'm in my office now and will have to wait until this evening to try all this out ;-)

    Okay Joe, I'll try this one. You're right, some settings on this PIC can be tricky if we forget them.

    Darrel, you're far ahead of what I'm able to understand. It sounds so clear for you. What shall I do, replace Mister_e's $30 by your $33?

    Merci Steve, it will be easy to copy/paste and check quickly.

    Come back to you later.

    Thank you All.
    Roger

  28. #28
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default LCDOUT xx, xx explanations needed PLEASE

    Until I can try all what you suggest, I would like to understand how you Guys read and interpret the codes in the Initialisation Table I put in my post #19. It looks so obvious to you, unfortunately it is not to me...

    As an example, I would like to know how you come to a LCDOUT $FE, $0C to switch On the display.

    In the table the line sais Display ON/OFF, you see the bits RS(I don't even know what this one is for) and R/W, and then you have for each DB7...0 a value (0 or 1). Finally you've got this $0F value which appears to me as coming from nowhere.

    I admit that the $FE is a standart value for sending datas to the display.

    But, in this example, where comes the $0C from? I'm lost...

    I'm missing this very basic stuff and bothering you with stupid questions so was this discussed in antoher thread already?
    Roger

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


    Did you find this post helpful? Yes | No

    Default Das Book

    Quote Originally Posted by flotulopex

    But, in this example, where comes the $0C from? I'm lost...
    Hi flotulopex,
    No question you do not know the answer to is stupid.
    $0C - listed in PBASIC PRO MANUAL page 94. $0C = Cursor Off
    JS

  30. #30
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default but "how to" on my own?

    Hello Joe S.,

    I read this document (PBP manual) almost any time I have a question but I sometimes don't understand the explanations.

    As you mention, the actual $0C value listed in the manual switches the Cursor OFF; Mister_e sais that, according to the table, it switches the Display ON. There is a difference.

    Mister_e must have interpreted the table; this is what I would like to be able to do too.

    So, my question was more precisely to:
    a) understand the definition table (in post #19);
    b) learn how to use the informations on there.

    I don't know how to express myself more clearly but if my question looks confusing, please tell me.
    Roger

  31. #31
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    As you mention, the actual $0C value listed in the manual switches the Cursor OFF; Mister_e sais that, according to the table, it switches the Display ON. There is a difference.

    Mister_e must have interpreted the table; this is what I would like to be able to do too.

    So, my question was more precisely to:
    a) understand the definition table (in post #19);
    b) learn how to use the informations on there.
    Look at the datasheet for the LCD controller, specifically Page 26.

    "Display On/OFF"

    The 8 bits for the register = 00001DCB

    D= display 1=on 0=off
    C=cursor 1=on 0=off
    B=blink cursor 1=on 0=off

    so "00001100"

    Will give Display On Cursor and Blink off which is $0C

    $0C is the command to turn the Cursor OFF but it also turns the dsipay on as well

    $0E will turn the display on with a cursor
    Keith

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

  32. #32
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    So, the code looks like this now:
    Code:
    include "16F88-FUSES.BAS"
    
    'PIC 16F88 - 4MHz
    
    ' LCD circuitery
    '23,24,25,26,32,33,34,35,40 - Vdd (+5V)
    '27,38  - Vss (GND)
    '31 DB0 - PORTB.0
    '30 DB1 - PORTB.1
    '29 DB2 - PORTB.2
    '28 DB3 - PORTB.3
    '39 RS  - PORTB.4
    '36 E   - PORTB.6
    '37 R/W - PORTB.7
    
    DEFINE LCD_DREG PORTB       'LCD data port 
    DEFINE LCD_DBIT 0           'LCD data starting bit 0 or 4 
    DEFINE LCD_RSREG PORTB      'LCD register select port 
    DEFINE LCD_RSBIT 4          'LCD register select bit 
    DEFINE LCD_EREG PORTB       'LCD enable port 
    DEFINE LCD_EBIT 6           'LCD enable bit 
    DEFINE LCD_RWREG PORTB      'LCD read/write port
    DEFINE LCD_RWBIT 7          'LCD read/write bit
    DEFINE LCD_BITS 4           'LCD bus size 4 or 8 
    DEFINE LCD_LINES 2          'Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000   'Command delay time in us 
    DEFINE LCD_DATAUS 50        'Data delay time in us
    
    
    ' Register settings
    OSCCON     = %01100000      'Internal RC set to 4MHZ
    ANSEL      = %00000000      'Disable Analogue Inputs
    OPTION_REG = %01000000      'Enable PORTB pullups
    
    
    ManualLCDInit:
        FLAGS=2  ' Void PBP lcd initialisation... it's a nice feature !!!
        PAUSE 500
        Lcdout $FE, $33
        Lcdout $FE, $33
        Lcdout $FE, $20 ' official 4 bit mode
        @  bsf LCD_EREG, LCD_EBIT
        PAUSEUS 20
        @  bcf LCD_EREG, LCD_EBIT
        Lcdout $FE, $28 ' Function Set
        Lcdout $FE, $14 ' Bias
        Lcdout $FE, $78 ' Contrast set
        Lcdout $FE, $5E ' Power/Icon/Contrast
        Lcdout $FE, $6A ' Follower control
        Lcdout $FE, $0C ' Display ON
        Lcdout $FE, $01 ' Clear display
        Lcdout $FE, $06 ' Entry mode Set
       ' --------------------------------- End LCD init!
    
        LCDOUT $FE,1,"Line1",$FE,$C0,"Line 2"
    Pouet: 
        Goto Pouet
    
    end
    Guess what? The display still doesn't work.

    I'm waiting for AE to give some answers...

    At least, have a look at how the displays look like (they're only 2mm thick). Would be really nice if something could be written on it, no? (pin 21 is on the upper right corner looking at picture PICT0001small.JPG).

    Keithdoxey, it's getting clearer to me. I have to grab a piece of paper and study a little. Thanks a lot since this is exactly the kind of information I was looking for.
    Attached Images Attached Images   
    Last edited by flotulopex; - 27th November 2006 at 16:40.
    Roger

  33. #33
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    I use these to lines to make sure all the analog and comparator stuff is killed dead...

    ANSEL = %00000000 ' Disable Analogue Inputs
    CMCON = %00000111 ' Disable Comparators

    Looking at your photos it looks as if Pin37 of the LCD R/W is connected via a blue/green wire to pin 13 of the PIC RB7. There also seems to be an additional brown wire flying off somewhere from this pin. Where does the other end of that connect to ?

    Try with the R/W line connected directly to 0V as you only need to write to the PIC.

    One other point... I suggested putting LEDs on the PIC and observing it counting up to ensure that the count operated correctly. You said that you tested the pins with a logic probe, presumabley one pin at a time just to observe the two different states.

    The reason I suggested the LEDs is that when I first used a 16F88 I hadnt killed all the analogue bits properly and although I could turn an LED on on any pin, when I changed another pin the first LED would go out.

    The reason being that updating a pin involves reading the port register for the existing values, modifying it and writing it back. If any analogue stuff is still enabled the pin reads as a zero and will get set to zero even though it was previously a one.

    Do you have access to a "normal" HD44780 display of any size just to test that your PIC is correctly configured. From what I have seen so far there shouldt be any real problems getting this display to work as it is 44780 compatible. If you try with a normal display and it still doesnt work then something isnt right with the PIC. Once you have that working it should just be a matter of swapping the displays.
    Keith

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

  34. #34
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    Looking at your photos it looks as if Pin37 of the LCD R/W is connected via a blue/green wire to pin 13 of the PIC RB7. There also seems to be an additional brown wire flying off somewhere from this pin. Where does the other end of that connect to ?
    It is the DATA wire (brown) coming from ICSP programmer (AN589). I've attached a "full view". Green LED on programmer is for power presence and yellow one (between both black relays) is for connection/disconnection of MCLR-DATA-CLOCK.

    Wires:
    black = GND (Vss)
    red = +5V (Vdd)
    yellow = MCLR
    orange = Clock
    brown = Data

    One other point... I suggested putting LEDs on the PIC and observing it counting up to ensure that the count operated correctly. You said that you tested the pins with a logic probe, presumabley one pin at a time just to observe the two different states.
    You're right. The LED you are talking about is there and as you suggest, I use it as an optical check. Do you mean I should connect more LEDs just to make sure it works fine?

    Do you have access to a "normal" HD44780 display of any size just to test that your PIC is correctly configured. From what I have seen so far there shouldt be any real problems getting this display to work as it is 44780 compatible. If you try with a normal display and it still doesnt work then something isnt right with the PIC. Once you have that working it should just be a matter of swapping the displays.
    Yes. As mentionned earlier, I made this check too and with my other displays (have lots of them), no problem!!
    Attached Images Attached Images  
    Last edited by flotulopex; - 27th November 2006 at 20:16.
    Roger

  35. #35
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by flotulopex
    It is the DATA wire (brown) coming from ICSP programmer (AN589).

    Wires:
    black = GND (Vss)
    red = +5V (Vdd)
    yellow = MCLR
    orange = Clock
    brown = Data
    Ok. might be worth trying with R/W just connected to 0V.

    You're right. The LED you are talking about is there and as you suggest, I use it as an optical check. Do you mean I should connect more LEDs just to make sure it works fine?
    Yes. Put 8 leds on there and observe the count eg
    Code:
    OFF OFF OFF OFF OFF OFF OFF OFF (0)
    OFF OFF OFF OFF OFF OFF OFF ON  (1)
    OFF OFF OFF OFF OFF OFF ON  OFF (2)
    OFF OFF OFF OFF OFF OFF ON  ON  (3)
    OFF OFF OFF OFF OFF ON  OFF OFF (4)
    OFF OFF OFF OFF OFF ON  OFF ON (5)
    ......
    ON  ON  ON  ON  ON  ON  OFF OFF (252)
    ON  ON  ON  ON  ON  ON  OFF ON (253)
    ON  ON  ON  ON  ON  ON  ON  OFF (254)
    ON  ON  ON  ON  ON  ON  ON  ON (255)
    If the sequence doesnt work then the port isnt being correctly set

    Yes. As mentionned earlier, I made this check too and with my other displays (have lots of them), no problem!!
    Sorry, missed that.

    Good luck !!!!

    Keith
    Keith

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

  36. #36
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Hardware issue now: LEDs....

    I must wait unil tomorrow morning: missing a few LEDs...
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    flotul,

    I've been looking at the pictures, and it appears that the data bus is reversed.

    There's 4 wires (2 geen, 2 white) on lcd pins 28-31. They are connected like this.

    <pre> LCD PIC <br> 31 (D4) 9 (B3)<br> 30 (D5) 8 (B2)<br> 29 (D6) 7 (B1)<br> 28 (D7) 6 (B0)<br></pre>Should be the other way around.
    <br>
    DT

  38. #38
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    flotul,

    I've been looking at the pictures, and it appears that the data bus is reversed.

    There's 4 wires (2 geen, 2 white) on lcd pins 28-31. They are connected like this.

    <pre> LCD PIC <br> 31 (D4) 9 (B3)<br> 30 (D5) 8 (B2)<br> 29 (D6) 7 (B1)<br> 28 (D7) 6 (B0)<br></pre>Should be the other way around.
    <br>
    You have better eyes than me. I cant tell from the photos.

    Would be a lot easier with 4 different colours though, or even GGWW instead of GWWG because at least you could tell it was reversed
    Keith

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

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


    Did you find this post helpful? Yes | No

    Default

    Yeah, I was going Bug-Eyed too trying to follow them all.

    PICT0003small.JPG in Post#34 helped.

    Had to save it to disk so I could zoom in and out with an Image Preview.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default Zoom

    Quote Originally Posted by Darrel Taylor
    Yeah, I was going Bug-Eyed too trying to follow them all.

    PICT0003small.JPG in Post#34 helped.

    Had to save it to disk so I could zoom in and out with an Image Preview.
    <br>
    I use Firefox and it's Zoom plugin, very helpful, Zoom in right in browser.
    JS

Similar Threads

  1. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  2. need help in coding..
    By daphne8888 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 19th March 2008, 07:31
  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 : 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