Menu

LCD Print integer don't work ???

Erdy
2013-05-06
2013-05-30
  • Erdy

    Erdy - 2013-05-06

    Hello,

    I can't LCD16x2 print variable type Word or Integer correctly ! I can print Strings, Longs and Bytes, so LCD works.

    Dim myInt As Integer
    myInt = 20000
    Locate 1, 6
    Print myInt
    

    Displays ////0

    Program compiled by Great Cow BASIC (0.9 21/4/2013)
    Pic16F628A
    LCD 2x16, 8 data lines

    Thanks

     
  • Erdy

    Erdy - 2013-05-07

    Forget this for now !

    There is a problem but it's linked with previous code ??

    Sorry

     
  • Erdy

    Erdy - 2013-05-07

    Here is the minimum code that bugs :

    Integers can't be printed when Long are printed too ???

    ' ----------------------
    #chip 16F628A, 4
    #config MCLR_OFF
    ' ----------------------
    ' -- PIC_to_LCD lines --
    ' ----------------------
    #Define LCD_IO 4
    #Define LCD_DB4 PortB.4
    #Define LCD_DB5 PortB.5
    #Define LCD_DB6 PortB.6
    #Define LCD_DB7 PortB.7
    '
    #Define LCD_RS PortB.3
    #Define LCD_RW PortB.2
    #Define LCD_Enable PortB.1
    ' ----------------------
    '
    ' ----------------------
    ' -- Main routine ------
    ' ----------------------
    Main:
    ' --- Byte -------------
    Cls
    Locate 0, 0
    Print "8 bit count"
    Dim bCountx As Byte
    For bCountx = 0 To 255
         locate 1,4
         Print bCountx
    Next bCountx
    '
    ' --- Integer ----------
    Wait 3 s
    Cls
    Locate 0, 0
    Print "16 bit count"
    Dim intCountx As Integer
    For intCountx = 1000 To 2000
        locate 1,4
        Print intCountx
    Next intCountx
    '
    ' --- Long -------------
    Wait 3 s
    Cls
    Locate 0, 0
    Print "32 bit count"
    Dim longCountx As Long
    For longCountx = 3900000000 To 3900000200
        locate 1,4
        Print longCountx
    Next intCountx
    '
    ' ----------------------
    Wait 3 s
    Goto Main
    ' ----------------------
    End
    ' Compiler Version (DD/MM/YYYY): 0.9 21/4/2013
    ' Program and data sizes
    ' ----------------------
    ' Long printing implemeted  (LCD Print Integer Bugs)
    ' Program Memory: 1107/2048 words (54,05%)
    ' RAM: 76/224 bytes (33,93%)
    ' Long Printing Commented   (LCD Print Integer Works)
    ' Program Memory: 779/2048 words (38,04%)
    ' RAM: 44/224 bytes (19,64%)
    ' Byte Printing Commented   (LCD Print Integer Bugs)
    ' Program Memory: 982/2048 words (47,95%)
    ' RAM: 74/224 bytes (33,04%)
    

    Thanks

     
  • Chuck Hellebuyck

    Try adding a wait in the print loop.
    I've found LCDs can be sensitive to too many bytes too quickly.

     
  • Erdy

    Erdy - 2013-05-08

    I tried what you suggested !

    ' --- Integer ----------
    Wait 3 s
    Cls
    Locate 0, 0
    Print "16 bit count"
    Dim intCountx As Integer
    For intCountx = 1000 To 2000
        locate 1,4
        Wait 100 us
        Print intCountx
        Wait 100 us
    Next intCountx
    

    It still prints ///0

    It must be a shared variable between Print_Long and Print_Integer … ???? I suspect  SysCalcTempX in LCD.h Print,  it must be the remainder for long as for integer … but still searching :-).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.