CCS PCM C Compiler, Version 4.106, 47914 01-II-14 20:13Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC887\main.lstROM used: 786 words (10%)Largest free fragment is 2048RAM used: 67 (18%) at main() level80 (22%) worst caseStack: 2 worst case (1 in main + 1 for interrupts)*0000: MOVLW 020001: MOVWF 0A0002: GOTO 21C0003: NOP0004: MOVWF 7F0005: SWAPF 03,W0006: CLRF 030007: MOVWF 210008: MOVF 0A,W0009: MOVWF 20000A: CLRF 0A000B: MOVF 04,W000C: MOVWF 22000D: MOVF 77,W000E: MOVWF 23000F: MOVF 78,W0010: MOVWF 240011: MOVF 79,W0012: MOVWF 250013: MOVF 7A,W0014: MOVWF 260015: BCF 03.70016: BCF 03.50017: MOVLW 8C0018: MOVWF 040019: BTFSS 00.1001A: GOTO 01D001B: BTFSC 0C.1001C: GOTO 034001D: MOVLW 8C001E: MOVWF 04001F: BTFSS 00.30020: GOTO 0230021: BTFSC 0C.30022: GOTO 0370023: MOVF 22,W0024: MOVWF 040025: MOVF 23,W0026: MOVWF 770027: MOVF 24,W0028: MOVWF 780029: MOVF 25,W002A: MOVWF 79002B: MOVF 26,W002C: MOVWF 7A002D: MOVF 20,W002E: MOVWF 0A002F: SWAPF 21,W0030: MOVWF 030031: SWAPF 7F,F0032: SWAPF 7F,W0033: RETFIE0034: BCF 0A.30035: BCF 0A.40036: GOTO 0B00037: BCF 0A.30038: BCF 0A.40039: GOTO 066.................... #include "main.h".................... #include <16F887.h>.................... //////// Standard Header file for the PIC16F887 device ////////////////.................... #device PIC16F887.................... #list........................................ #device adc=8........................................ #FUSES NOWDT //No Watch Dog Timer.................... #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD).................... #FUSES NOPUT //No Power Up Timer.................... #FUSES MCLR //Master Clear pin enabled.................... #FUSES NOPROTECT //Code not protected from reading.................... #FUSES NOCPD //No EE protection.................... #FUSES NOBROWNOUT //No brownout reset.................... #FUSES IESO //Internal External Switch Over mode enabled.................... #FUSES FCMEN //Fail-safe clock monitor enabled.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O.................... #FUSES NODEBUG //No Debug mode for ICD.................... #FUSES NOWRT //Program memory not write protected.................... #FUSES BORV40 //Brownout reset at 4.0V........................................ #use delay(clock=20000000)*00DC: MOVLW 5F00DD: MOVWF 0400DE: BCF 03.700DF: MOVF 00,W00E0: BTFSC 03.200E1: GOTO 0EF00E2: MOVLW 0600E3: MOVWF 7800E4: CLRF 7700E5: DECFSZ 77,F00E6: GOTO 0E500E7: DECFSZ 78,F00E8: GOTO 0E400E9: MOVLW 7B00EA: MOVWF 7700EB: DECFSZ 77,F00EC: GOTO 0EB00ED: DECFSZ 00,F00EE: GOTO 0E200EF: RETURN*013A: MOVLW 03013B: SUBWF 5F,F013C: BTFSS 03.0013D: GOTO 148013E: MOVLW 5F013F: MOVWF 040140: BCF 03.70141: MOVF 00,W0142: BTFSC 03.20143: GOTO 1480144: GOTO 1460145: GOTO 1460146: DECFSZ 00,F0147: GOTO 1450148: BCF 0A.30149: BCF 0A.4014A: GOTO 2C1 (RETURN).................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)........................................ //NOTE: Must declare MASTER before SLAVE, i2c_isr_state() returns 0.................... // when MASTER is the most recent #use i2c.................... //#use i2c(MASTER, sda=PIN_C1, scl=PIN_C0, stream=I2CM).................... #use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA0)*00A1: MOVF 6A,W00A2: MOVWF 1300A3: BSF 14.400A4: BCF 0C.300A5: BSF 03.500A6: BTFSC 14.000A7: GOTO 0A600A8: CLRF 7800A9: BCF 03.500AA: BTFSC 14.400AB: INCF 78,F.................................................................................................... #define LED PIN_E1.................... #define CE PIN_E2........................................ int16 count;........................................ int8 rcv_buf[0x10]; // I2C receive buffer.................... int8 snd_buf[0x10]; // I2C send buffer........................................ int8 buffer[0x10]; // I2C buffer.................... int8 address;........................................ const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x40, 0x42, 0x0F, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x12, 0x03};........................................ #INT_SSP.................... void ssp_interupt ().................... {.................... BYTE incoming, state;........................................ state = i2c_isr_state();*0066: BSF 03.50067: BTFSC 14.50068: GOTO 0710069: BCF 03.5006A: CLRF 5C006B: BSF 03.5006C: BTFSS 14.2006D: GOTO 071006E: BCF 03.5006F: BSF 5C.70070: BSF 03.50071: BCF 03.50072: MOVF 5C,W0073: INCF 5C,F0074: MOVWF 68........................................ if(state < 0x80) //Master is sending data0075: MOVF 68,W0076: SUBLW 7F0077: BTFSS 03.00078: GOTO 095.................... {.................... incoming = i2c_read();0079: BCF 14.6007A: BTFSS 0C.3007B: GOTO 07A007C: MOVF 13,W007D: BSF 14.4007E: MOVWF 67.................... if(state == 1) //First received byte is address007F: DECFSZ 68,W0080: GOTO 08B.................... {.................... address = incoming;0081: MOVF 67,W0082: MOVWF 5B.................... if (incoming == 2)0083: MOVF 67,W0084: SUBLW 020085: BTFSS 03.20086: GOTO 08B.................... {.................... buffer[0]=make8(count,0);0087: MOVF 29,W0088: MOVWF 4B.................... buffer[1]=make8(count,1);0089: MOVF 2A,W008A: MOVWF 4C.................... }.................... }.................... if(state == 2) //Second received byte is data008B: MOVF 68,W008C: SUBLW 02008D: BTFSS 03.2008E: GOTO 095.................... buffer[address] = incoming;008F: MOVLW 4B0090: ADDWF 5B,W0091: MOVWF 040092: BCF 03.70093: MOVF 67,W0094: MOVWF 00............................................................ }.................... if(state == 0x80) //Master is requesting data0095: MOVF 68,W0096: SUBLW 800097: BTFSS 03.20098: GOTO 0AC.................... {.................... i2c_write(buffer[address]);0099: MOVLW 4B009A: ADDWF 5B,W009B: MOVWF 04009C: BCF 03.7009D: MOVF 00,W009E: MOVWF 69009F: MOVF 69,W00A0: MOVWF 6A.................... }.................... }........................................*00AC: BCF 0C.300AD: BCF 0A.300AE: BCF 0A.400AF: GOTO 023.................... #int_TIMER2 // every 10 ms.................... void TIMER2_isr(void).................... {.................... output_low(CE);00B0: BSF 03.500B1: BCF 09.200B2: BCF 03.500B3: BCF 09.2.................... count=get_timer1();00B4: MOVF 0F,W00B5: MOVWF 7A00B6: MOVF 0E,W00B7: MOVWF 7700B8: MOVF 0F,W00B9: SUBWF 7A,W00BA: BTFSS 03.200BB: GOTO 0B400BC: MOVF 77,W00BD: MOVWF 2900BE: MOVF 7A,W00BF: MOVWF 2A.................... set_timer1(0);00C0: CLRF 0F00C1: CLRF 0E.................... output_high(CE);00C2: BSF 03.500C3: BCF 09.200C4: BCF 03.500C5: BSF 09.2.................... }........................................00C6: BCF 0C.100C7: BCF 0A.300C8: BCF 0A.400C9: GOTO 023.................... void main().................... {*021C: CLRF 04021D: BCF 03.7021E: MOVLW 1F021F: ANDWF 03,F0220: BSF 03.50221: BSF 03.60222: BSF 07.30223: MOVLW 080224: BCF 03.60225: MOVWF 190226: MOVLW 020227: MOVWF 1A0228: MOVLW A60229: MOVWF 18022A: MOVLW 90022B: BCF 03.5022C: MOVWF 18022D: BSF 28.3022E: MOVF 28,W022F: BSF 03.50230: MOVWF 070231: BCF 03.50232: BSF 28.40233: MOVF 28,W0234: BSF 03.50235: MOVWF 070236: MOVLW A00237: MOVWF 130238: MOVLW 360239: BCF 03.5023A: MOVWF 14023B: BSF 03.5023C: BSF 03.6023D: MOVF 09,W023E: ANDLW C0023F: MOVWF 090240: BCF 03.60241: BCF 1F.40242: BCF 1F.50243: MOVLW 000244: BSF 03.60245: MOVWF 080246: BCF 03.50247: CLRF 070248: CLRF 080249: CLRF 09.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);*0250: BSF 03.50251: BSF 03.60252: MOVF 09,W0253: ANDLW C00254: MOVWF 090255: BCF 03.60256: BCF 1F.40257: BCF 1F.50258: MOVLW 000259: BSF 03.6025A: MOVWF 08.................... setup_adc(ADC_OFF);025B: BCF 03.5025C: BCF 03.6025D: BCF 1F.0.................... // setup_spi(SPI_SS_DISABLED);.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);025E: BSF 03.5025F: MOVF 01,W0260: ANDLW C70261: IORLW 080262: MOVWF 01.................... // setup_wdt(WDT_144MS);.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);0263: MOVLW 070264: BCF 03.50265: MOVWF 10.................... setup_timer_2(T2_DIV_BY_16,196,16);0266: MOVLW 780267: MOVWF 780268: IORLW 060269: MOVWF 12026A: MOVLW C4026B: BSF 03.5026C: MOVWF 12.................... setup_ccp1(CCP_OFF);026D: BCF 03.5026E: BSF 28.2026F: MOVF 28,W0270: BSF 03.50271: MOVWF 070272: BCF 03.50273: CLRF 170274: BSF 03.50275: CLRF 1B0276: CLRF 1C0277: MOVLW 010278: MOVWF 1D.................... setup_comparator(NC_NC_NC_NC);0279: BCF 03.5027A: BSF 03.6027B: CLRF 07027C: CLRF 08027D: CLRF 09.................... setup_vref(FALSE);027E: BSF 03.5027F: BCF 03.60280: CLRF 17........................................ delay_ms(1000);0281: MOVLW 040282: BCF 03.50283: MOVWF 5E0284: MOVLW FA0285: MOVWF 5F0286: CALL 0DC0287: DECFSZ 5E,F0288: GOTO 284.................... int n;.................... for (n=0;n<40;n++)0289: CLRF 5D028A: MOVF 5D,W028B: SUBLW 27028C: BTFSS 03.0028D: GOTO 295.................... {.................... putc(cmd[n]);028E: MOVF 5D,W028F: CALL 03A0290: BTFSS 0C.40291: GOTO 2900292: MOVWF 19.................... }0293: INCF 5D,F0294: GOTO 28A........................................ printf("cvak...\r\n");0295: MOVLW CA0296: BSF 03.60297: MOVWF 0D0298: MOVLW 000299: MOVWF 0F029A: BCF 03.6029B: GOTO 0F0.................... snd_buf[2]=0x55;029C: MOVLW 55029D: MOVWF 3D.................... snd_buf[3]=0xAA;029E: MOVLW AA029F: MOVWF 3E........................................ set_timer1(0);02A0: CLRF 0F02A1: CLRF 0E.................... enable_interrupts(INT_SSP);02A2: BSF 03.502A3: BSF 0C.3.................... // enable_interrupts(INT_TIMER2);.................... enable_interrupts(GLOBAL);02A4: MOVLW C002A5: BCF 03.502A6: IORWF 0B,F........................................ while(true).................... {........................................ output_high(LED);02A7: BSF 03.502A8: BCF 09.102A9: BCF 03.502AA: BSF 09.1.................... output_low(LED);02AB: BSF 03.502AC: BCF 09.102AD: BCF 03.502AE: BCF 09.1.................... set_timer1(0);02AF: CLRF 0F02B0: CLRF 0E.................... output_high(CE);02B1: BSF 03.502B2: BCF 09.202B3: BCF 03.502B4: BSF 09.2.................... delay_ms(999);02B5: MOVLW 0902B6: MOVWF 5E02B7: MOVLW 6F02B8: MOVWF 5F02B9: CALL 0DC02BA: DECFSZ 5E,F02BB: GOTO 2B7.................... delay_us(966);02BC: MOVLW 0602BD: MOVWF 5E02BE: MOVLW A002BF: MOVWF 5F02C0: GOTO 13A02C1: DECFSZ 5E,F02C2: GOTO 2BE.................... output_low(CE);02C3: BSF 03.502C4: BCF 09.202C5: BCF 03.502C6: BCF 09.2.................... count=get_timer1();02C7: MOVF 0F,W02C8: MOVWF 7A02C9: MOVF 0E,W02CA: MOVWF 7702CB: MOVF 0F,W02CC: SUBWF 7A,W02CD: BTFSS 03.202CE: GOTO 2C702CF: MOVF 77,W02D0: MOVWF 2902D1: MOVF 7A,W02D2: MOVWF 2A........................................ printf("count: %Lu %X %X %X %X\r\n",count, buffer[0],buffer[1],buffer[2],buffer[3]);02D3: MOVLW CF02D4: BSF 03.602D5: MOVWF 0D02D6: MOVLW 0002D7: MOVWF 0F02D8: BCF 03.002D9: MOVLW 0702DA: BCF 03.602DB: MOVWF 5E02DC: GOTO 14B02DD: MOVLW 1002DE: MOVWF 0402DF: MOVF 2A,W02E0: MOVWF 5F02E1: MOVF 29,W02E2: MOVWF 5E02E3: GOTO 19E02E4: MOVLW 2002E5: BTFSS 0C.402E6: GOTO 2E502E7: MOVWF 1902E8: MOVF 4B,W02E9: MOVWF 5E02EA: MOVLW 3702EB: MOVWF 5F02EC: CALL 1F902ED: MOVLW 2002EE: BTFSS 0C.402EF: GOTO 2EE02F0: MOVWF 1902F1: MOVF 4C,W02F2: MOVWF 5E02F3: MOVLW 3702F4: MOVWF 5F02F5: CALL 1F902F6: MOVLW 2002F7: BTFSS 0C.402F8: GOTO 2F702F9: MOVWF 1902FA: MOVF 4D,W02FB: MOVWF 5E02FC: MOVLW 3702FD: MOVWF 5F02FE: CALL 1F902FF: MOVLW 200300: BTFSS 0C.40301: GOTO 3000302: MOVWF 190303: MOVF 4E,W0304: MOVWF 5E0305: MOVLW 370306: MOVWF 5F0307: CALL 1F90308: MOVLW 0D0309: BTFSS 0C.4030A: GOTO 309030B: MOVWF 19030C: MOVLW 0A030D: BTFSS 0C.4030E: GOTO 30D030F: MOVWF 19.................... }0310: GOTO 2A7.................... }0311: SLEEPConfiguration Fuses:Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUGWord 2: 3FFF NOWRT BORV40