How to work with LCD in a mode of 8 bits?


Closed Thread
Results 1 to 10 of 10
  1. #1
    MCU Destroyer's Avatar
    MCU Destroyer Guest

    Post How to work with LCD in a mode of 8 bits?

    Good time All !

    For some reasons I LCD is connected to PIC16F877A by means of 8 data lines. That is the mode of 8 bits is used and 3 signals for its management (RS, E and R/W) are still used.

    As to me to work in PBP from in such a way connection LCD.

    In a mode of 4 bits, on LCD symbols are not deduced all - LCD has not time to accept them and passes symbols. Therefore I have decided to use a mode of 8 bits.

    I thank for attention.

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


    Did you find this post helpful? Yes | No

    Default

    In a mode of 4 bits, on LCD symbols are not deduced all - LCD has not time to accept them and passes symbols. Therefore I have decided to use a mode of 8 bits.
    It sounds like the data is coming too fast on your LCD.

    You need a Delay of char command LCDdata, so that the LCDout will not throw out the data too fast for your LCD_DATAUS to slow down that output.

    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...

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


    Did you find this post helpful? Yes | No

    Default

    MCU Destroyer,

    as Dwayne already mentioned: it is most likely a timing problem.
    And I doubt the 8bit Mode will solve that problem.

    Could you tell us what brand and model the LCD is?

    And could you also post your schematic and code?
    regards

    Ralph

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



  4. #4
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    From the manual:

    PBP defaults to using a 4MHz oscillator.

    Adding the statement DEFINE OSC 8 near the beginning of the PicBasic Pro program tells
    PBP an 8MHz oscillator will be used instead. The acceptable oscillator definitions are:

    3(3.58) 4 8 10 12 16 20 24 25 32 33 40

    Telling PBP the oscillator frequency allows it to compensate and produce
    the correct timing for COUNT, DEBUG, DEBUGIN, DTMFOUT, FREQOUT,
    HPWM, HSERIN, HSEROUT, I2CREAD, I2CWRITE, LCDOUT, OWIN, OWOUT,
    PAUSE, PAUSEUS, SERIN, SERIN2, SEROUT, SEROUT2, SHIFTIN,
    SHIFTOUT, SOUND, XIN and XOUT.

    * * *
    Luciano

  5. #5
    MCU Destroyer's Avatar
    MCU Destroyer Guest


    Did you find this post helpful? Yes | No

    Default

    Please look my code:

    ++++++++++++++++++++++++++++++++++++++
    define osc 20
    Define LCD_DREG PORTA
    Define LCD_DBIT 0
    Define LCD_RSREG PORTE
    Define LCD_RSBIT 0
    Define LCD_EREG PORTE
    Define LCD_EBIT 1
    DEFINE LCD_RWREG PORTE
    DEFINE LCD_RWBIT 2

    ADCON1 = 7
    Pause 3000
    loop: Lcdout $fe, 1
    Pause 9000

    Lcdout "Hello"
    Pause 9000

    Lcdout $fe, $c0, "World"
    Pause 9000

    Goto loop
    End
    ++++++++++++++++++++++++++++++++++++++++++++++++
    LCD model: MT-16S2H (v.3) - this LCD full combine on conclusions with any LCD (for example Data Vision). And I use PIC16F877A, quartz 20 MHz (mode HS for PIC).

    Probably really wash PIC works too quickly but how I then can increase a delay of commands for LCD? I have not found suitable commands...

  6. #6
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    From the PBP manual
    5.39. LCDOUT

    ‘ Set command delay time in us
    DEFINE LCD_COMMANDUS 2000

    ‘ Set data delay time in us
    DEFINE LCD_DATAUS 50


    Luciano

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


    Did you find this post helpful? Yes | No

    Default

    how about PORTA.4??? is this pin tie with pull-up resistor???

    Not sure if PBP handle the R/W pin for you. Can you add a LOW PORTE.0 and post results...
    Steve

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

  8. #8
    MCU Destroyer's Avatar
    MCU Destroyer Guest


    Did you find this post helpful? Yes | No

    Thumbs up

    Great thank All !

    Now all worked.

    When I use commands

    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    and increased delays by 30 %, LCD has earned in a mode 4 bits.

    But nevertheless it is possible in PBP to work with LCD in a mode 8 bits?

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MCU Destroyer
    But nevertheless it is possible in PBP to work with LCD in a mode 8 bits?
    DEFINE LCD_BITS 8

    But why would you want to waste 4 Port Bits?
    regards

    Ralph

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



  10. #10
    MCU Destroyer's Avatar
    MCU Destroyer Guest


    Did you find this post helpful? Yes | No

    Default

    Now I any more do not wish to spend all for nothing a bits of port. It simply question for the my general development - became already interestingly can-whether PBP work with LCD in a mode 8 bits.

    Once again all many thanks !

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. first project, and yes, doesn`t work
    By bogdan in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 28th April 2009, 06:13
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. assembly in Pic
    By lerameur in forum Off Topic
    Replies: 11
    Last Post: - 1st May 2008, 20:06
  5. 16f88 can't get lcd to work
    By nicjo in forum General
    Replies: 12
    Last Post: - 13th December 2006, 02:20

Members who have read this thread : 1

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