Mercurial > public > hwos_code
comparison src/ms5541.asm @ 656:8af5aefbcdaf default tip
Update to 3.31 beta
| author | heinrichsweikamp |
|---|---|
| date | Thu, 27 Nov 2025 18:32:58 +0100 |
| parents | 75e90cd0c2c3 |
| children |
comparison
equal
deleted
inserted
replaced
| 655:c7b7b8a358cd | 656:8af5aefbcdaf |
|---|---|
| 633 movlw b'01010100' ; +3*high as start and 1+low as stop | 633 movlw b'01010100' ; +3*high as start and 1+low as stop |
| 634 movwf dbuffer ; ... | 634 movwf dbuffer ; ... |
| 635 movlw d'13' ; send command | 635 movlw d'13' ; send command |
| 636 rcall send_data_MS5541 ; ... | 636 rcall send_data_MS5541 ; ... |
| 637 rcall get_2bytes_MS5541 ; read result | 637 rcall get_2bytes_MS5541 ; read result |
| 638 movff dMSB,ir_s8_buffer+1 ; copy result, high byte first | 638 movff dMSB,ms5541_rawdata+1 ; copy result, high byte first |
| 639 movff dLSB,ir_s8_buffer+0 ; copy result, low byte second | 639 movff dLSB,ms5541_rawdata+0 ; copy result, low byte second |
| 640 | 640 |
| 641 movlw b'01011000' ; +3*high as start and 1+low as stop | 641 movlw b'01011000' ; +3*high as start and 1+low as stop |
| 642 movwf dbuffer ; ... | 642 movwf dbuffer ; ... |
| 643 movlw d'13' ; send command | 643 movlw d'13' ; send command |
| 644 rcall send_data_MS5541 ; ... | 644 rcall send_data_MS5541 ; ... |
| 645 rcall get_2bytes_MS5541 ; read result | 645 rcall get_2bytes_MS5541 ; read result |
| 646 movff dMSB,ir_s8_buffer+3 ; copy result, high byte first | 646 movff dMSB,ms5541_rawdata+3 ; copy result, high byte first |
| 647 movff dLSB,ir_s8_buffer+2 ; copy result, low byte second | 647 movff dLSB,ms5541_rawdata+2 ; copy result, low byte second |
| 648 | 648 |
| 649 movlw b'01100100' ; +3*high as start and 1+low as stop | 649 movlw b'01100100' ; +3*high as start and 1+low as stop |
| 650 movwf dbuffer ; ... | 650 movwf dbuffer ; ... |
| 651 movlw d'13' ; send command | 651 movlw d'13' ; send command |
| 652 rcall send_data_MS5541 ; ... | 652 rcall send_data_MS5541 ; ... |
| 653 rcall get_2bytes_MS5541 ; read result | 653 rcall get_2bytes_MS5541 ; read result |
| 654 movff dMSB,ir_s8_buffer+5 ; copy result, high byte first | 654 movff dMSB,ms5541_rawdata+5 ; copy result, high byte first |
| 655 movff dLSB,ir_s8_buffer+4 ; copy result, low byte second | 655 movff dLSB,ms5541_rawdata+4 ; copy result, low byte second |
| 656 | 656 |
| 657 movlw b'01101000' ; +3*high as start and 1+low as stop | 657 movlw b'01101000' ; +3*high as start and 1+low as stop |
| 658 movwf dbuffer ; ... | 658 movwf dbuffer ; ... |
| 659 movlw d'13' ; send command | 659 movlw d'13' ; send command |
| 660 rcall send_data_MS5541 ; ... | 660 rcall send_data_MS5541 ; ... |
| 661 rcall get_2bytes_MS5541 ; read result | 661 rcall get_2bytes_MS5541 ; read result |
| 662 movff dMSB,ir_s8_buffer+7 ; copy result, high byte first | 662 movff dMSB,ms5541_rawdata+7 ; copy result, high byte first |
| 663 movff dLSB,ir_s8_buffer+6 ; copy result, low byte second | 663 movff dLSB,ms5541_rawdata+6 ; copy result, low byte second |
| 664 | 664 |
| 665 ; calculate C1 (16 Bit) | 665 ; calculate C1 (16 Bit) |
| 666 movff ir_s8_buffer+1,C1+1 | 666 movff ms5541_rawdata+1,C1+1 |
| 667 bcf STATUS,C | 667 bcf STATUS,C |
| 668 rrcf C1+1 | 668 rrcf C1+1 |
| 669 bcf STATUS,C | 669 bcf STATUS,C |
| 670 rrcf C1+1 | 670 rrcf C1+1 |
| 671 bcf STATUS,C | 671 bcf STATUS,C |
| 672 rrcf C1+1 | 672 rrcf C1+1 |
| 673 movff ir_s8_buffer+0,C1+0 | 673 movff ms5541_rawdata+0,C1+0 |
| 674 bsf STATUS,C | 674 bsf STATUS,C |
| 675 btfss ir_s8_buffer+1,0 | 675 btfss ms5541_rawdata+1,0 |
| 676 bcf STATUS,C | 676 bcf STATUS,C |
| 677 rrcf C1+0 | 677 rrcf C1+0 |
| 678 bsf STATUS,C | 678 bsf STATUS,C |
| 679 btfss ir_s8_buffer+1,1 | 679 btfss ms5541_rawdata+1,1 |
| 680 bcf STATUS,C | 680 bcf STATUS,C |
| 681 rrcf C1+0 | 681 rrcf C1+0 |
| 682 bsf STATUS,C | 682 bsf STATUS,C |
| 683 btfss ir_s8_buffer+1,2 | 683 btfss ms5541_rawdata+1,2 |
| 684 bcf STATUS,C | 684 bcf STATUS,C |
| 685 rrcf C1+0 | 685 rrcf C1+0 |
| 686 | 686 |
| 687 ; calculate C2 (16 Bit) | 687 ; calculate C2 (16 Bit) |
| 688 movff ir_s8_buffer+2, C2+0 | 688 movff ms5541_rawdata+2, C2+0 |
| 689 bsf STATUS,C | 689 bsf STATUS,C |
| 690 btfss ir_s8_buffer+3,0 | 690 btfss ms5541_rawdata+3,0 |
| 691 bcf STATUS,C | 691 bcf STATUS,C |
| 692 rrcf C2+0 | 692 rrcf C2+0 |
| 693 bsf STATUS,C | 693 bsf STATUS,C |
| 694 btfss ir_s8_buffer+3,1 | 694 btfss ms5541_rawdata+3,1 |
| 695 bcf STATUS,C | 695 bcf STATUS,C |
| 696 rrcf C2+0 | 696 rrcf C2+0 |
| 697 bsf STATUS,C | 697 bsf STATUS,C |
| 698 btfss ir_s8_buffer+3,2 | 698 btfss ms5541_rawdata+3,2 |
| 699 bcf STATUS,C | 699 bcf STATUS,C |
| 700 rrcf C2+0 | 700 rrcf C2+0 |
| 701 bsf STATUS,C | 701 bsf STATUS,C |
| 702 btfss ir_s8_buffer+3,3 | 702 btfss ms5541_rawdata+3,3 |
| 703 bcf STATUS,C | 703 bcf STATUS,C |
| 704 rrcf C2+0 | 704 rrcf C2+0 |
| 705 bsf STATUS,C | 705 bsf STATUS,C |
| 706 btfss ir_s8_buffer+3,4 | 706 btfss ms5541_rawdata+3,4 |
| 707 bcf STATUS,C | 707 bcf STATUS,C |
| 708 rrcf C2+0 | 708 rrcf C2+0 |
| 709 bsf STATUS,C | 709 bsf STATUS,C |
| 710 btfss ir_s8_buffer+3,5 | 710 btfss ms5541_rawdata+3,5 |
| 711 bcf STATUS,C | 711 bcf STATUS,C |
| 712 rrcf C2+0 | 712 rrcf C2+0 |
| 713 | 713 |
| 714 movff ir_s8_buffer+3, C2+1 | 714 movff ms5541_rawdata+3, C2+1 |
| 715 bsf STATUS,C | 715 bsf STATUS,C |
| 716 btfss ir_s8_buffer+0,0 | 716 btfss ms5541_rawdata+0,0 |
| 717 bcf STATUS,C | 717 bcf STATUS,C |
| 718 rrcf C2+1 | 718 rrcf C2+1 |
| 719 bsf STATUS,C | 719 bsf STATUS,C |
| 720 btfss ir_s8_buffer+0,1 | 720 btfss ms5541_rawdata+0,1 |
| 721 bcf STATUS,C | 721 bcf STATUS,C |
| 722 rrcf C2+1 | 722 rrcf C2+1 |
| 723 bsf STATUS,C | 723 bsf STATUS,C |
| 724 btfss ir_s8_buffer+0,2 | 724 btfss ms5541_rawdata+0,2 |
| 725 bcf STATUS,C | 725 bcf STATUS,C |
| 726 rrcf C2+1 | 726 rrcf C2+1 |
| 727 bcf STATUS,C | 727 bcf STATUS,C |
| 728 rrcf C2+1 | 728 rrcf C2+1 |
| 729 bcf STATUS,C | 729 bcf STATUS,C |
| 730 rrcf C2+1 | 730 rrcf C2+1 |
| 731 bcf STATUS,C | 731 bcf STATUS,C |
| 732 rrcf C2+1 | 732 rrcf C2+1 |
| 733 | 733 |
| 734 ; calculate C3 (16 Bit) | 734 ; calculate C3 (16 Bit) |
| 735 movff ir_s8_buffer+5,C3+0 | 735 movff ms5541_rawdata+5,C3+0 |
| 736 bsf STATUS,C | 736 bsf STATUS,C |
| 737 btfss ir_s8_buffer+4,7 | 737 btfss ms5541_rawdata+4,7 |
| 738 bcf STATUS,C | 738 bcf STATUS,C |
| 739 rlcf C3+0 | 739 rlcf C3+0 |
| 740 bsf STATUS,C | 740 bsf STATUS,C |
| 741 btfss ir_s8_buffer+4,6 | 741 btfss ms5541_rawdata+4,6 |
| 742 bcf STATUS,C | 742 bcf STATUS,C |
| 743 rlcf C3+0 | 743 rlcf C3+0 |
| 744 clrf C3+1 | 744 clrf C3+1 |
| 745 btfsc ir_s8_buffer+5,7 | 745 btfsc ms5541_rawdata+5,7 |
| 746 bsf C3+1,1 | 746 bsf C3+1,1 |
| 747 btfsc ir_s8_buffer+5,6 | 747 btfsc ms5541_rawdata+5,6 |
| 748 bsf C3+1,0 | 748 bsf C3+1,0 |
| 749 | 749 |
| 750 ; calculate C4 (16 Bit) | 750 ; calculate C4 (16 Bit) |
| 751 movff ir_s8_buffer+7,C4+0 | 751 movff ms5541_rawdata+7,C4+0 |
| 752 bsf STATUS,C | 752 bsf STATUS,C |
| 753 btfss ir_s8_buffer+6,7 | 753 btfss ms5541_rawdata+6,7 |
| 754 bcf STATUS,C | 754 bcf STATUS,C |
| 755 rlcf C4+0 | 755 rlcf C4+0 |
| 756 clrf C4+1 | 756 clrf C4+1 |
| 757 btfsc ir_s8_buffer+7,7 | 757 btfsc ms5541_rawdata+7,7 |
| 758 bsf C4+1,0 | 758 bsf C4+1,0 |
| 759 | 759 |
| 760 ; C4=C4-250 | 760 ; C4=C4-250 |
| 761 movlw LOW(-.250) ; C4 - 250 --> C4 | 761 movlw LOW(-.250) ; C4 - 250 --> C4 |
| 762 addwf C4+0,W | 762 addwf C4+0,W |
| 764 movlw -1 ; HIGH(- .250) is not understood... | 764 movlw -1 ; HIGH(- .250) is not understood... |
| 765 addwfc C4+1,W | 765 addwfc C4+1,W |
| 766 movwf C4+1 | 766 movwf C4+1 |
| 767 | 767 |
| 768 ; calculate C5 (16 Bit) | 768 ; calculate C5 (16 Bit) |
| 769 movff ir_s8_buffer+4,C5+0 | 769 movff ms5541_rawdata+4,C5+0 |
| 770 bcf C5+0,6 | 770 bcf C5+0,6 |
| 771 btfsc ir_s8_buffer+2,0 | 771 btfsc ms5541_rawdata+2,0 |
| 772 bsf C5+0,6 | 772 bsf C5+0,6 |
| 773 bcf C5+0,7 | 773 bcf C5+0,7 |
| 774 btfsc ir_s8_buffer+2,1 | 774 btfsc ms5541_rawdata+2,1 |
| 775 bsf C5+0,7 | 775 bsf C5+0,7 |
| 776 clrf C5+1 | 776 clrf C5+1 |
| 777 btfsc ir_s8_buffer+2,2 | 777 btfsc ms5541_rawdata+2,2 |
| 778 bsf C5+1,0 | 778 bsf C5+1,0 |
| 779 btfsc ir_s8_buffer+2,3 | 779 btfsc ms5541_rawdata+2,3 |
| 780 bsf C5+1,1 | 780 bsf C5+1,1 |
| 781 btfsc ir_s8_buffer+2,4 | 781 btfsc ms5541_rawdata+2,4 |
| 782 bsf C5+1,2 | 782 bsf C5+1,2 |
| 783 btfsc ir_s8_buffer+2,5 | 783 btfsc ms5541_rawdata+2,5 |
| 784 bsf C5+1,3 | 784 bsf C5+1,3 |
| 785 | 785 |
| 786 ; calculate C5 = UT1 | 786 ; calculate C5 = UT1 |
| 787 ; C5 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) | 787 ; C5 = 8*C5 + 10000 (u16 range 10.000 .. +42.760) |
| 788 clrf isr_xA+1 | 788 clrf isr_xA+1 |
| 796 movlw HIGH d'10000' | 796 movlw HIGH d'10000' |
| 797 addwfc C5+1,F ; = 8*C5 + 10000 | 797 addwfc C5+1,F ; = 8*C5 + 10000 |
| 798 | 798 |
| 799 ; calculate C6 (16Bit) | 799 ; calculate C6 (16Bit) |
| 800 clrf C6+1 | 800 clrf C6+1 |
| 801 movff ir_s8_buffer+6,C6+0 | 801 movff ms5541_rawdata+6,C6+0 |
| 802 bcf C6+0,7 | 802 bcf C6+0,7 |
| 803 | 803 |
| 804 get_calibration_data2: | 804 get_calibration_data2: |
| 805 clrf sensor_state_counter ; reset state counter | 805 clrf sensor_state_counter ; reset state counter |
| 806 bcf block_sensor_interrupt ; re-enable sensor interrupts | 806 bcf block_sensor_interrupt ; re-enable sensor interrupts |
