Intel 8085 microprocessor

Discussion in 'Programmer's Corner' started by vincent19-mas, May 8, 2013.

  1. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    Hey guys,

    I will be doing a project using this microprocessor.

    My title is Temperature sensor using ADC 0804 and display it in a LCD.

    So, I have tried to interface the LCD with 8 bit mode of operation with the following coding :
    Code ( (Unknown Language)):
    1. CPU "8085.TBL"
    2. ORG 2000H
    3. LXI SP,3FF0H
    4.  
    5. MVI A,80H
    6. OUT 83H
    7.  
    8. MVI A,38H
    9. CALL WR_CMD
    10. MVI A,38H
    11. CALL WR_CMD
    12. MVI A,38H
    13. CALL WR_CMD
    14. MVI A,0CH
    15. CALL WR_CMD
    16. MVI A,06H
    17. CALL WR_CMD
    18. MVI A,80H
    19. CALL WR_CMD
    20. LXI H,MSG_LINE1
    21.  
    22. LINE1: MOV A,M
    23. CPI 0
    24. JZ NEXT_LINE
    25. CALL WR_CHAR
    26. INX H
    27. JMP LINE1
    28.  
    29. NEXT_LINE: MVI A,0C0H
    30. CALL WR_CMD
    31. LXI H,MSG_LINE2
    32.  
    33. LINE2: MOV A,M
    34. CPI 0
    35. JZ EXIT
    36. CALL WR_CHAR
    37. INX H
    38. JMP LINE2
    39. EXIT: RST 1
    40.  
    41. WR_CMD: OUT 80H
    42. MVI A,00000100B
    43. OUT 82H
    44. MVI A,00000000b
    45. OUT 82H
    46. CALL DELAY2
    47. RET
    48.  
    49. WR_CHAR: OUT 80H
    50.     MVI A,00000101B
    51.     OUT 82H
    52.     MVI A,00000001B
    53.     OUT 82H
    54.     CALL DELaY1
    55.     RET
    56.  
    57. DELAY1: MVI C,40
    58. LOOP_1: DCR C
    59.     JNZ LOOP_1
    60.     RET
    61.  
    62. DELAY2: MVI C,255
    63. LOOP_2: DCR C
    64.     JNZ LOOP_2
    65.     RET
    66.  
    67. MSG_LINE1: DFB "8085 DEVELOPMENT",0
    68. MSG_LINE2: DFB "SYSTEM-KUKUM",0
    69. END
    The output of this code that dispay on the LCD is :
    8085 DEVELOPMENT
    SYSTEM-KUKUM

    Now, because 8255 PPI IC have only Port A, B and C each 8 ports respectively, I might be suffer from insufficient IO pins to be used. So I plan to interface the LCD with only 4 bit.

    Anyone knows how am I able to interface a 2x16 LCD(controller: HD47780) using 4 bit mode ?

    Thanks and appreciate your help !
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Yes. Most people do it this way. It is explained in the data sheet.
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    A thing that strike me. Is that it is much simpler to interface both the LCD and the ADC directly to the CPU using a memory or IO mapped approach. If you use some kind of premade 8085 development board. I guess using the IO mapped approach will be preferable. Do you have to use the 8255 for device interface? In any way it would be helpful to see a drawing on how you plan to interface the LCD and ADC
     
  4. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    Suggested ways of interface

    I plan to just connect 4 pins of Data pins of LCD so that I will have more ports to be used

    Any guidance ?

    Thanks!
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
  6. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Can you be more specific on where the change from 38H to 20H is in the process.
     
  8. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    This is the initialization for 8 bit mode where 38H is used.
    How about when in 4 bit mode ?

    Thanks !
     
    • 234.png
      234.png
      File size:
      42.8 KB
      Views:
      48
    • 235.png
      235.png
      File size:
      48.5 KB
      Views:
      41
  9. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    yes I see. Take a look at this PDF. It show how to do the correct 4 bit mode setting. Note the timing. Also it is only after the 4. command that you need to write 2x4 bits
     
    Last edited: May 8, 2013
  10. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    So does that means I convert the 6 bit number to hex ? DB7, BB6,DB5,DB4, RS and E ?
    Cause in 8 bit mode, it involve 10 bits binary number. I am confuse about this.

    Anyway, when dealing with ADC 0804, I have to convert the temperature sense in analog to digital then convert it to ASCII then display it on a LCD. I am pretty confuse in binary to ASCII conversion. Let say the temperature it sensed is 30 degree celcius. How am I able to display this 30 to the LCD ? Can provide me some example ?

    Thanks !

    Anyway, do you mind providing more hints/example coding to deal with LCD in 4 bits ?

    Thanks !
     
  11. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    RS and E are more like control signal. Given that you only want to write to the LCD the R/W pin can be tied low. Then you have a low to high transition on the E pin The LCD will read the data on the databus. Then you write to the LCD after setting it in 4 bits mode. You write the upper 4 bits data first to D7-D4, then give a low to high transition on E. Then write the lower 4 bits to D7-D4 and give give a low to high to low transition on E.
     
  12. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    Means I need to modify my wor_cmd and wr_char function ??? Thanks

    Can you provide me with a simple example ? Thx
     
  13. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Yes those functions must be changed to fit the four bits mode. As for the example. I can not help much. I did a lot of code on the Z80, but never on the 8085. Was not very fond of 8086 either.
     
  14. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    How about the 38H??? I should change to 20H?? 38H = 0000111000 which the sequence is RS,R/W, DB7, DB6,DB5,...DB1,DB0.it is 10 bit consisting of 8 data bit and 2 control pins.So for 4 bi data mode, how can I define the binary number ??? RS, R/W, DB7, DB6, DB5,DB4 then it is 6 bit binary number ??? Confuse about this..thanks
     
  15. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Here is my initialization for 4-bit mode. Send the following as high nybble, low nybble:

    0x28
    0x28
    0x06
    0x0C
    0x10
     
    vincent19-mas likes this.
  16. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    So for the wr_char and wr_cmd function , I have to mask lower and upper bit ?
     
  17. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    I am not sure how to change the wr_cmd and wr_char function. Any advice ?

    Thanks !
     
  18. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    You could also put the LCD and the ADC on the same port. Then use the E(LCD) and CS(ADC) lines to control which device that is accessed on the common port
     
  19. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    How can I do that ?

    Thanks !
     
  20. vincent19-mas

    Thread Starter Member

    Dec 27, 2012
    83
    1
    How do I send it as high nybble and low nybble ?

    I am pretty stuck in this!

    Please anyone help me :)

    Thanks !
     
Loading...