PIC18F8720 proteus and mplab

Discussion in 'The Projects Forum' started by techkumar, Mar 16, 2011.

  1. techkumar

    Thread Starter New Member

    Sep 14, 2008
    2
    0
    Hi. I'm new to assembly language.I'm doing running light using 25 leds and pic18f8720. Testing on proteus. I'm unable to make it work.

    Kindly see the attached source code and proteus dsn file. Hope some one can correct my mistakes here.

    Source asm, hex and dsn files here:
    http://www.4shared.com/file/mXSlyfpo/Project_mplab.html

    Thank you.

    [​IMG]

    Code ( (Unknown Language)):
    1.  
    2. #include<p18F8720.inc>
    3.  
    4. org 0X00
    5. goto start
    6. org 0X08
    7. goto ISR_timer
    8. org 0X18
    9. goto ISR_reset
    10. retfie
    11.  
    12. start setf TRISB;
    13. clrf TRISD;
    14. clrf TRISE;
    15. clrf TRISF;
    16. clrf TRISH;
    17. clrf TRISJ;
    18. BCF RCON,IPEN, A;
    19. BSF INTCON,GIEH,A;
    20. BSF INTCON,INT0IE;
    21. goto patt1;
    22.  
    23. patt1 movlw B'00010101';
    24. movwf PORTD,A;
    25. movwf PORTE,A;
    26. movwf PORTF,A;
    27. movwf PORTH,A;
    28. movwf PORTJ,A;
    29. CALL ISR_timer;
    30. CALL ISR_reset;
    31. clrf WREG;
    32. movlw B'00001010';
    33. movwf PORTD,A;
    34. movwf PORTE,A;
    35. movwf PORTF,A;
    36. movwf PORTH,A;
    37. movwf PORTJ,A;
    38. CALL ISR_timer;
    39. CALL ISR_reset;
    40. BTFSS PORTB,2,A;
    41. goto patt1;
    42. goto patt2;
    43. patt2 movlw B'00011001';
    44. movwf PORTD,A;
    45. movwf PORTE,A;
    46. movwf PORTF,A;
    47. movwf PORTH,A;
    48. movwf PORTJ,A;
    49. CALL ISR_timer;
    50. CALL ISR_reset;
    51. clrf WREG;
    52. movlw B'00000110';
    53. movwf PORTD,A;
    54. movwf PORTE,A;
    55. movwf PORTF,A;
    56. movwf PORTH,A;
    57. movwf PORTJ,A;
    58. CALL ISR_timer;
    59. CALL ISR_reset;
    60. BTFSS PORTB,2,A;
    61. goto patt2;
    62. goto patt3;
    63. patt3 movlw B'00000111';
    64. movwf PORTD,A;
    65. movwf PORTE,A;
    66. movwf PORTF,A;
    67. movwf PORTH,A;
    68. movwf PORTJ,A;
    69. CALL ISR_timer;
    70. CALL ISR_reset;
    71. clrf WREG;
    72. movlw B'00011000';
    73. movwf PORTD,A;
    74. movwf PORTE,A;
    75. movwf PORTF,A;
    76. movwf PORTH,A;
    77. movwf PORTJ,A;
    78. CALL ISR_timer;
    79. CALL ISR_reset;
    80. BTFSS PORTB,2,A;
    81. goto patt3;
    82. goto patt4;
    83. patt4 movlw B'00000111';
    84. movwf PORTD,A;
    85. movwf PORTE,A;
    86. movwf PORTF,A;
    87. movwf PORTH,A;
    88. movwf PORTJ,A;
    89. CALL ISR_timer;
    90. CALL ISR_reset;
    91. clrf WREG;
    92. movlw B'00011000';
    93. movwf PORTD,A;
    94. movwf PORTE,A;
    95. movwf PORTF,A;
    96. movwf PORTH,A;
    97. movwf PORTJ,A;
    98. CALL ISR_timer;
    99. CALL ISR_reset;
    100. BTFSS PORTB,2,A;
    101. goto patt4;
    102. goto patt5;
    103. patt5 movlw B'00000111';
    104. movwf PORTD,A;
    105. movwf PORTE,A;
    106. movwf PORTF,A;
    107. movwf PORTH,A;
    108. movwf PORTJ,A;
    109. CALL ISR_timer;
    110. CALL ISR_reset;
    111. clrf WREG;
    112. movlw B'00011000';
    113. movwf PORTD,A;
    114. movwf PORTE,A;
    115. movwf PORTF,A;
    116. movwf PORTH,A;
    117. movwf PORTJ,A;
    118. CALL ISR_timer;
    119. CALL ISR_reset;
    120. BTFSS PORTB,2,A;
    121. goto patt5;
    122. goto patt1;
    123.  
    124. ISR_reset BTFSS PORTB,1,A;
    125. goto patt1;
    126. return;
    127.  
    128.  
    129. ISR_timer BCF T0CON,PSA;
    130. BSF T0CON, 0;
    131. BSF T0CON, 1;
    132. BSF T0CON, 2;
    133. MOVLW 0XB3;
    134. MOVWF TMR0H;
    135. MOVLW 0XB4;
    136. MOVWF TMR0L;
    137. BCF INTCON, TMR0IF;
    138. BSF T0CON, TMR0ON;
    139. BTFSS INTCON,TMR0IF;
    140. RETURN;
    141. END
    142.  
    143.  
     
    Last edited by a moderator: Mar 16, 2011
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Have you set the configuration word(s) mentioned in the data-sheet section special futures of the CPU. Even if you just simulate in proteus I think these bits must be correct.
     
  3. techkumar

    Thread Starter New Member

    Sep 14, 2008
    2
    0
    Hi. I have followed those bits as per data sheet.

    It seems i'm having problem with my software as well. Error as the reset interrupt is not working well.
     
  4. astro1

    New Member

    Sep 8, 2007
    1
    0
    put 10k res on pin 9 to +20v, seems to run ok.
     
Loading...