Mercurial > public > hwos_code
comparison src/adc_lightsensor.asm @ 475:237afdfb4918
2.12 release candidate...
buttons invertable via PC command (OSTC+ only)
author | heinrichsweikamp |
---|---|
date | Fri, 13 Jan 2017 13:08:17 +0100 |
parents | 2880aa1264f5 |
children | b455b31ce022 |
comparison
equal
deleted
inserted
replaced
474:2880aa1264f5 | 475:237afdfb4918 |
---|---|
584 rrcf WREG ;/2 -> 5-25 | 584 rrcf WREG ;/2 -> 5-25 |
585 decf WREG,W ;-1 | 585 decf WREG,W ;-1 |
586 decf WREG,W ;-1 | 586 decf WREG,W ;-1 |
587 decf WREG,W ;-1 -> 2-22 | 587 decf WREG,W ;-1 -> 2-22 |
588 banksel analog_sw2 | 588 banksel analog_sw2 |
589 btfss button_polarity,1;(1= normal, 0=inverted) | |
590 bra sw2_inverted | |
589 addwf analog_sw2,W ; average (~128) | 591 addwf analog_sw2,W ; average (~128) |
590 banksel common | |
591 cpfsgt ADRESH | 592 cpfsgt ADRESH |
592 bra get_analog_sw1 | 593 bra get_analog_sw1 |
593 bsf analog_sw2_pressed | 594 banksel common |
595 bsf analog_sw2_pressed ; Left button normal | |
596 bra get_analog_sw1 | |
597 sw2_inverted: | |
598 subwf analog_sw2,W ; average (~128) | |
599 cpfslt ADRESH | |
600 bra get_analog_sw1 | |
601 banksel common | |
602 bsf analog_sw2_pressed ; Left button inverted | |
594 get_analog_sw1: | 603 get_analog_sw1: |
604 banksel common | |
595 movlw b'00101001' ; power on ADC, select AN10 | 605 movlw b'00101001' ; power on ADC, select AN10 |
596 rcall wait_adc | 606 rcall wait_adc |
597 banksel analog_counter | 607 banksel analog_counter |
598 movff ADRESH,WREG | 608 movff ADRESH,WREG |
599 addwf analog_sw1_raw+0 | 609 addwf analog_sw1_raw+0 |
629 rrcf WREG ;/2 -> 5-25 | 639 rrcf WREG ;/2 -> 5-25 |
630 decf WREG,W ;-1 | 640 decf WREG,W ;-1 |
631 decf WREG,W ;-1 | 641 decf WREG,W ;-1 |
632 decf WREG,W ;-1 -> 2-22 | 642 decf WREG,W ;-1 -> 2-22 |
633 banksel analog_sw1 | 643 banksel analog_sw1 |
644 btfss button_polarity,0;(1= normal, 0=inverted) | |
645 bra sw1_inverted | |
634 addwf analog_sw1,W ; average (~128) | 646 addwf analog_sw1,W ; average (~128) |
635 banksel common | |
636 cpfsgt ADRESH | 647 cpfsgt ADRESH |
637 bra get_analog_sw_done | 648 bra get_analog_sw_done |
638 bsf analog_sw1_pressed | 649 banksel common |
650 bsf analog_sw1_pressed ; right button normal | |
651 bra get_analog_sw_done | |
652 sw1_inverted: | |
653 subwf analog_sw1,W ; average (~128) | |
654 cpfslt ADRESH | |
655 bra get_analog_sw_done | |
656 banksel common | |
657 bsf analog_sw1_pressed ; right button inverted | |
639 get_analog_sw_done: | 658 get_analog_sw_done: |
659 banksel common | |
640 movlw b'10001101' ; Restore to right justified | 660 movlw b'10001101' ; Restore to right justified |
641 movwf ADCON2 | 661 movwf ADCON2 |
642 btfsc analog_sw1_pressed | 662 btfsc analog_sw1_pressed |
643 return | 663 return |
644 btfsc analog_sw2_pressed | 664 btfsc analog_sw2_pressed |