1. TAKYMOUNIR

    Thread Starter Active Member

    Jun 23, 2008
    351
    1
    PLEASE CAN SOME ONE CHECK THIS PROGRAM FOR ME
    THIS PROGRAM FIRST DISPLAY 0 TO 9 ON THE NEXT LINE OF THE LCD(LAB -X1) AND AFTER THAT START BUBBLING ALPHABIT( A TO Z) A START BUBBLING FROM 0 TO 9 AND AFTER THAT B ,...

    Code ( (Unknown Language)):
    1.  
    2. ; Section 05, Program LCDX2
    3. ;***************************************************************************************
    4. ;
    5. ; ; PROCESSOR: PIC 16F877
    6. ; COMPILER: PIC BASIC PRO
    7. ;
    8. ; STUDENT NAME:TAKEY ASAAD & HAROLD ARRINDELL
    9. CLEAR ;CLEAR MEMORY
    10. DEFINE OSC 4 ;OSC SPEED
    11. DEFINE LCD_DREG PORTD ;DEFINE DATE REGISTER
    12. DEFINE LCD_DBIT 4 ;DEFINE WIDTH OF DATA PATH
    13. DEFINE LCD_RSREG PORTE ; DEFINE SELECT REGISTER
    14. DEFINE LCD_RSBIT 0 ;SELECT BIT
    15. DEFINE LCD_EREG PORTE ;ENABLE REGISTER
    16. DEFINE LCD_EBIT 1 ;ENABLE BIT
    17. ADCON1=%00000111 ;SET PORTA AND PORTE TO DIGITAL
    18. DEFINE ADC_BITS 8 ;DEFINE ADCIN PARAMETERS
    19. DEFINE ADC_CLOCK 3 ;SET CLOCK SOURCE
    20. DEFINE ADC_SAMPLEUS 50 ;SET SAMLING TIME IN US
    21. LOW PORTE.2 ;LCD R/W LINE LOW (W)
    22. PAUSE 100 ;WAIT FOR LCD TO START UP
    23. I VAR BYTE
    24. J VAR BYTE
    25. NUM1 VAR BYTE
    26. NUM2 VAR BYTE
    27. DELAY VAR BYTE
    28. LINE1 VAR BYTE[20]
    29. LINE2 VAR BYTE[20]
    30. ;PORTD=%00000000
    31. TRISD=%00000000
    32. TRISA=%11111111
    33. START:
    34. ;LCDOUT $FE,1
    35. FOR I = 0 TO 19
    36. LINE1[I]=32
    37. NEXT I
    38. FOR I = 0 TO 9
    39. LINE2[I]=48+I
    40. NEXT I
    41. FOR I = 10 TO 19
    42. LINE1[I]=32
    43. NEXT I
    44. PAUSE 100
    45. LCDOUT $FE,1,STR LINE1
    46. LCDOUT $FE,$C0,STR LINE2
    47. PAUSE 100
    48. BUBBLING:
    49. LOOP1:
    50. LCDOUT $FE,$C0,STR LINE2
    51. LINE2=LINE2>>1
    52. FOR I =0 TO 25
    53. LINE2[0]=65+I
    54. GOSUB GETADC
    55. GOSUB DISPLAYLCD
    56. PAUSE DELAY
    57. FOR J =0 TO 10
    58. NUM1=LINE2[J]
    59. NUM2=LINE2[J+1]
    60. SWAP NUM1 , NUM2
    61. LINE2[J]=NUM1
    62. LINE2[J+1]=NUM2
    63. ;PAUSE DELAY
    64. GOSUB DISPLAYLCD
    65. NEXT J
    66. NEXT I
    67. GOTO BUBBLING
    68. GETADC:
    69. ADCIN 0 ,DELAY
    70. SELECT CASE DELAY
    71. CASE IS <100 ;LIMIT DELAY TO BE MIN =100 AND MAX =2000MS
    72. DELAY =100
    73. CASE IS >200
    74. DELAY =200
    75. CASE ELSE
    76. END SELECT
    77. RETURN
    78. DISPLAYLCD:
    79. LCDOUT $FE,1
    80. PAUSE 100
    81. LCDOUT $FE,$80,STR LINE1
    82. PAUSE 100
    83. LCDOUT $FE,$C0,STR LINE2
    84. RETURN
    85. END
    86. [/I][/I][/I]
     
    Last edited by a moderator: Mar 30, 2012
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    STOP SHOUTING!!!



    And post your code with code tags. Use left bracket, the word code then right bracket. En the code with left bracket. forward slash. right bracket.

    It will persevere indents and make your code easier to read.



    You need to state your issue. What is the problem? And what have you done to troubleshoot the problem?

    What is "bubbling"?
     
  3. TAKYMOUNIR

    Thread Starter Active Member

    Jun 23, 2008
    351
    1
    the program should display
    0123456789
    A0123456789
    0A123456789
    .
    .
    0123456789A
    B0123456789
    0B123456789
    .
    .
    AND SO ON
    MY CODE DO A0123456789
    B0123456789
    SO CAN YOU PLEASE CHECK WHY ID DOES NOT MAKE BUBBLING OR SWAPING
     
    Last edited: Apr 5, 2012
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,012
    Again please stop shouting. All capital letters is shouting.

    I have no idea what "BUBBLING OR SWAPING" is.

    Have you stepped through your code with the debugger?
     
  5. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    It looks like you have an index or counter backwards in your code. That is, you are incrementing the wrong variable first...
     
    TAKYMOUNIR likes this.
Loading...