Continue to Site

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.

  • 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.

how to stop the program, only from 0 to 9

Status
Not open for further replies.

johms Bautista

New Member
Sir Good morning, I have a question on how to stop the counter up to 9 only because i'm new to programming pic16f84a.. the output was 7 segment display.
 

Attachments

  • 0-9.asm
    850 bytes · Views: 213
According to your program the code will run and run.... When the code hits the final delay you will get a stack underrun and the processor will reboot and start over!!!


You need a forever loop
Code:
#include <p16f84a.inc>

     cblock 0x20
       delay1
       delay2
     endc

     org0
       bsf STATUS,RP0
       clrf TRISB
       clrf TRISA
       bcf STATUS,RP0
       clrf PORTB
     
     main
       movlw b'11000000'
       movwf PORTB
       call delay
       
       movlw b'11111001'
       movwf PORTB
       call delay
       
       movlw b'10100100'
       movwf PORTB
       call delay
       
       movlw b'10110000'
       movwf PORTB
       call delay
       
       movlw b'10011001'
       movwf PORTB
       call delay
       
       movlw b'10010010'
       movwf PORTB
       call delay
       
       movlw b'10000010'
       movwf PORTB
       call delay
       
       movlw b'11111000'
       movwf PORTB
       call delay
       
       movlw b'00000000'
       movwf PORTB
       call delay
       
       movlw b'00010000'
       movwf PORTB
       call delay       
       
     stop   goto stop   ; <------- halt here!!!   
       
     delay
       decfsz delay1,f
       goto delay
       decfsz delay2,f
       goto delay
       return
   end
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top