Goto main main rcall initialize clear movlw movwf

This preview shows page 3 - 4 out of 4 pages.

goto main main rcall Initialize clear movlw 0 movwf Counter send decf Counter, 1 ;prepare value for movf Counter, w ;move to portA movwf PORTA check1 movlw 0 movwf Bounce btfsc PORTD, RD3 goto check1 movlw 1 movwf Bounce rcall Delay check2 btfsc PORTD, RD3 goto check1 movlw 1 xorwf Bounce, w btfss STATUS, Z goto check1 ;rcall Delay decf Counter, 1 incf Counter ;check if 9 movlw 9 ;cpfsgt Counter xorwf Counter, w btfsc STATUS, Z goto clear goto send Initialize movlw B'11111111' ;make portd input movwf TRISD movlw B'00000000' ;make porta output movwf TRISA return Delay MOVLW 6072 / 256 ;load high byte in TMR0 MOVWF TMR0H MOVLW 6072 % 256 ;load low byte in TMR0 MOVWF TMR0L BCF INTCON,TMR0IF ; If set, clear flag & return MOVLW B'10000001' ; Setup T0CON MOVWF T0CON ; 8-bit mode, Prescaler 1:128 Loop1 BTFSS INTCON,TMR0IF; Test TMR0IF flag GOTO Loop1 ; Check again if not set BCF INTCON,TMR0IF ; If set, clear flag & return RETURN end
Image of page 3

Subscribe to view the full document.

Program Code Description The way that the code works is that it makes Port A as an output port and implements a timer into the microcontroller. Also, a counter is implemented into the microcontroller which allows the LED lights to turn on and off depending on what value the counter has. The value of the counter changes as the button is being pushed. New Instructions The new set of instructions was to make the lights go backwards. In other words, instead of the light going 0, 1, 2… 7, the lights will go 7, 6, 5… 0. Conclusion There was a problem figuring out how to make the lights go in a reverse order. This problem was easily fixed once the counter was changed from incrementing to decrementing. The experiment can be improved by prolonging the timer in order to fully see the bouncing effect.
Image of page 4
You've reached the end of this preview.
  • Spring '12
  • BartelVanDerVeek
  • Turn, Bounce message, cpfsgt Counter

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern