0,0 → 1,204 |
CCS PCW C Compiler, Version 3.110, 15448 |
|
Filename: d:\@kaklik\programy\pic_c\mereni\vyskomer_drak\main.LST |
|
ROM used: 54 (5%) |
Largest free fragment is 970 |
RAM used: 5 (7%) at main() level |
6 (9%) worst case |
Stack: 1 locations |
|
* |
0000: MOVLW 00 |
0001: MOVWF 0A |
0002: GOTO 019 |
0003: NOP |
.................... #include "D:\@Kaklik\programy\PIC_C\mereni\vyskomer_drak\main.h" |
.................... #include <16F84.h> |
.................... //////// Standard Header file for the PIC16F84 device //////////////// |
.................... #device PIC16F84 |
.................... #list |
.................... |
.................... #use delay(clock=4000000) |
0004: MOVLW 12 |
0005: MOVWF 04 |
0006: MOVF 00,W |
0007: BTFSC 03.2 |
0008: GOTO 018 |
0009: MOVLW 01 |
000A: MOVWF 0D |
000B: CLRF 0C |
000C: DECFSZ 0C,F |
000D: GOTO 00C |
000E: DECFSZ 0D,F |
000F: GOTO 00B |
0010: MOVLW 4A |
0011: MOVWF 0C |
0012: DECFSZ 0C,F |
0013: GOTO 012 |
0014: NOP |
0015: NOP |
0016: DECFSZ 00,F |
0017: GOTO 009 |
0018: RETLW 00 |
.................... #fuses XT,NOWDT |
.................... |
.................... |
.................... |
.................... #DEFINE SCLK PIN_A2 |
.................... #DEFINE DOUT PIN_A3 |
.................... #DEFINE DIN PIN_A1 |
.................... #include "MS5534A.c" |
.................... |
.................... #DEFINE CLK 250 |
.................... #DEFINE WORD1 0b111010101000 |
.................... #DEFINE WORD2 0b111010110000 |
.................... #DEFINE WORD3 0b111011001000 |
.................... #DEFINE WORD4 0b111011010000 |
.................... |
.................... void send_bit(bit) |
.................... { |
.................... output_bit(DIN,bit); |
.................... output_high(SCLK); |
.................... Delay_us(CLK); |
.................... output_low(SCLK); |
.................... } |
.................... int1 read_bit() |
.................... { |
.................... output_high(SCLK); |
.................... Delay_us(CLK); |
.................... output_low(SCLK); |
.................... if (input(DOUT)) return true; |
.................... if (!input(DOUT)) return false; |
.................... } |
.................... |
.................... void read_byte(*byte_r) |
.................... { |
.................... int i; |
.................... |
.................... for(i=0;i>=7;i++) |
.................... { |
.................... *byte_r = read_bit(); |
.................... *byte_r << 1; |
.................... } |
.................... } |
.................... |
.................... void send_command(command,width) |
.................... { |
.................... int i; |
.................... for (i=width;i>=0;i--) |
.................... { |
.................... send_bit(bit_test(command,0)); |
.................... command >>1; |
.................... } |
.................... } |
.................... |
.................... void bar_reset() |
.................... { |
.................... int8 i; |
.................... |
.................... for(i=0;i>=20;i++) send_bit(Bit_test(i,0)); |
.................... } |
.................... |
.................... int16 bar_con_pre() |
.................... { |
.................... int16 word; |
.................... |
.................... send_command(0b1111010000,9); |
.................... |
.................... Delay_ms(10); |
.................... |
.................... While(input(DOUT)) Delay_us(100); |
.................... |
.................... read_byte(&word); |
.................... word << 8; |
.................... read_byte(&word); |
.................... |
.................... return word; |
.................... } |
.................... |
.................... int16 bar_con_term() |
.................... { |
.................... int16 word; |
.................... |
.................... send_command(0b1111001000,9); |
.................... |
.................... Delay_ms(10); |
.................... |
.................... While(input(DOUT)) Delay_us(100); |
.................... |
.................... read_byte(&word); |
.................... word << 8; |
.................... read_byte(&word); |
.................... |
.................... return word; |
.................... } |
.................... |
.................... int16 bar_read_cal(command) |
.................... { |
.................... int16 word; |
.................... |
.................... send_command(command,11); |
.................... |
.................... Delay_ms(10); |
.................... |
.................... While(input(DOUT)) Delay_us(100); |
.................... |
.................... read_byte(&word); |
.................... word << 8; |
.................... read_byte(&word); |
.................... |
.................... return word; |
.................... } |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... void main() |
.................... { |
0019: CLRF 04 |
001A: MOVLW 1F |
001B: ANDWF 03,F |
.................... output_high(pin_B2); |
001C: BSF 03.5 |
001D: BCF 06.2 |
001E: BCF 03.5 |
001F: BSF 06.2 |
.................... while(true) |
.................... { |
.................... while(!input(pin_B1)) |
0020: BSF 03.5 |
0021: BSF 06.1 |
0022: BCF 03.5 |
0023: BTFSC 06.1 |
0024: GOTO 02D |
.................... { |
.................... output_high(pin_A3); |
0025: BSF 03.5 |
0026: BCF 05.3 |
0027: BCF 03.5 |
0028: BSF 05.3 |
.................... Delay_ms(50); |
0029: MOVLW 32 |
002A: MOVWF 12 |
002B: CALL 004 |
.................... } |
002C: GOTO 020 |
.................... output_low(pin_A3); |
002D: BSF 03.5 |
002E: BCF 05.3 |
002F: BCF 03.5 |
0030: BCF 05.3 |
.................... Delay_ms(50); |
0031: MOVLW 32 |
0032: MOVWF 12 |
0033: CALL 004 |
.................... } |
0034: GOTO 020 |
.................... |
.................... } |
.................... |
0035: SLEEP |