1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Print ascii code on lcd

Discussion in 'Oshonsoft' started by ese2709, Aug 23, 2012.

  1. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    hi...

    how can i show ascii code character on lcd using oshonsoft

    language: picbasic
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    If you post a circuit showing the LCD type, PIC type with the interconnections, I will post you some sample code.;)
     
  3. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    i not make circuit schematic... :D but i create the pcb layout... using pcb wizard and just place the component manually:D

    View attachment 66615


    this is lcd configuration (16x2 lcd type)

    Code (text):

    Define LCD_BITS = 4
    Define LCD_DREG = PORTB
    Define LCD_DBIT = 0
    Define LCD_RSREG = PORTB
    Define LCD_RSBIT = 6
    Define LCD_RWREG = PORTB
    Define LCD_RWBIT = 5
    Define LCD_EREG = PORTB
    Define LCD_EBIT = 4
    Define LCD_READ_BUSY_FLAG = 1

     
     
    Last edited: Aug 23, 2012
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK

    OK, I see the PIC, is it a 16F or 18F type.??
     
  6. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    pic=16f877a
     
  7. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    Your image shows that you have the PIC and LCD incorrectly wired.
     
  8. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    portb.0 to portb.3 will connect to d0 to d3

    lcd connection will connect using wires... separate board :D
     
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    Redraw the pcb showing the correct wiring and post it, I will recheck it.

    EDIT
    Dont forget the +5V and 0V pins for the PIC..
     
    Last edited: Aug 23, 2012
  10. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Good spot Eric!!! I missed that... This also means his Gnd is also wrong... Its connected to PORTD.7 (Unless that was the OP's intention )
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Try this in Oshonsoft.

    Code (text):
    '16F877A LCD Demo  23Aug2012

    AllDigital
    Define SIMULATION_WAITMS_VALUE = 1

    Dim cntr1 As Byte

    Define LCD_LINES = 2
    Define LCD_CHARS = 16
    Define LCD_BITS = 4
    Define LCD_DREG = PORTB
    Define LCD_DBIT = 0
    Define LCD_RSREG = PORTB
    Define LCD_RSBIT = 6
    Define LCD_EREG = PORTB
    Define LCD_EBIT = 4
    Define LCD_RWREG = PORTB
    Define LCD_RWBIT = 5

    TRISA = %00000000
    TRISB = %00001111
    TRISC = %00000000
    TRISD = %11110000
    TRISE = %00000000

    Lcdinit
    Lcdout "Ready"

    main:

    Lcdcmdout LcdLine2Home

    Lcdout #cntr1
    cntr1 = cntr1 + 1

    Goto main

    End                                              
     
     
  12. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
  13. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0

    :rolleyes: <--- that's me
     
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    The LCD looks OK, did you try that simple Basic program I posted.??

    In your lastest pcb image, you show 1uF caps on your crystal... they should be approx 22pF

    Also why have you used a 1uF symbol for the crystal.??
     
    Last edited: Aug 23, 2012
  15. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    View attachment 66619

    i want to show the last character (1111 1111) on lcd.... :D

    yes... it should 22pF and 20MHz crystal
     
    Last edited: Aug 23, 2012
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Hi,
    Can we please follow a step by step path on this problem.

    Does the Demo program I posted work on your PC when using Oshonsoft.??

    Lcdinit
    Lcdout "Ready", 0xff ; Use the LCD symbol value for any or special characters... 0xff = the last symbol/char

    main:
     
    Last edited: Aug 23, 2012
  17. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    oh my.....

    lcdout 0xff <------ its working now

    before this i have been try that code but it not working.... arghhhhh

    i dont know why :rolleyes:

    but tq eric... hehehe

    i`m going for the next step... my code is nearly finished....

    trying to use internal timer?????????? <--- need to open new thred?
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    Thats good.

    Dont open a new thread, use this one.;)
     
  19. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    Code (text):


    '16F877A LCD Demo  23Aug2012

    AllDigital
    Define SIMULATION_WAITMS_VALUE = 1

    Dim cntr1 As Byte

    Define LCD_LINES = 2
    Define LCD_CHARS = 16
    Define LCD_BITS = 4
    Define LCD_DREG = PORTB
    Define LCD_DBIT = 0
    Define LCD_RSREG = PORTB
    Define LCD_RSBIT = 6
    Define LCD_EREG = PORTB
    Define LCD_EBIT = 4
    Define LCD_RWREG = PORTB
    Define LCD_RWBIT = 5

    TRISA = %00000000
    TRISB = %00001111
    TRISC = %00000000
    TRISD = %11110000
    TRISE = %00000000

    Lcdinit
    Lcdout "Ready"
    Lcdout 0xff

    main:


    Lcdcmdout LcdLine2Home

    Lcdout #cntr1
    cntr1 = cntr1 + 1

    'here code for timer
    'if counter is reach 20, the timer1 will start but counter is still counting
    'when timer is reach 5 second it will stop counting and reset count value to 0

    Goto main

    End    

     

    i hope u can understand.... can i do like that??
     
    Last edited: Aug 23, 2012
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Using a 4MHz crystal will give an internal clock of 1MHz ie: 1microsec

    So what do you plan to do with a 5 * 1uSec Timer1 period.?

    If you explain the purpose of your program/project it would be easier for me to help
     
  21. ese2709

    ese2709 New Member

    Joined:
    Aug 20, 2011
    Messages:
    30
    Likes:
    0
    i think we will discuss this one later.... i will try run some timer code and understand how it working....
     

Share This Page