Problem with comparison.
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.c |
---|
0,0 → 1,150 |
#include "main.h" |
#include <string.h> |
#define LED PIN_E1 |
#define CE PIN_E2 |
#define SEL0 PIN_E0 // external counter division ratio |
#define SEL1 PIN_E1 // external counter division ratio |
#define MR PIN_E2 // external counter master reset |
#define CLKI PIN_C0 // internal counter input |
#define BEEP PIN_C3 // buzzer |
unsigned int32 count; |
int8 buffer[0x10]; // I2C buffer |
int8 address; |
unsigned int16 of=0; // count of overflow |
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(); |
if(state < 0x80) //Master is sending data |
{ |
incoming = i2c_read(); |
if(state == 1) //First received byte is address |
{ |
address = incoming; |
if (incoming == 2) |
{ |
buffer[0]=make8(count,0); |
buffer[1]=make8(count,1); |
buffer[2]=make8(count,2); |
buffer[3]=make8(count,3); |
} |
} |
if(state == 2) //Second received byte is data |
buffer[address] = incoming; |
} |
if(state == 0x80) //Master is requesting data |
{ |
i2c_write(buffer[address]); |
} |
} |
#int_EXT // Interrupt from 1PPS |
void EXT_isr(void) |
{ |
unsigned int16 countH; |
unsigned int8 countL; |
char countS[10], a[4], b[4], c[4]; // strings for printing results |
countL=0; |
countH=get_timer1(); // read internal counter |
output_low(SEL0); |
output_low(SEL1); |
countL=input(CLKI); // read bit 0 of external counter |
output_high(SEL0); |
output_low(SEL1); |
countL|=input(CLKI)<<1; // read bit 1 of external counter |
output_low(SEL0); |
output_high(SEL1); |
countL|=input(CLKI)<<2; // read bit 2 of external counter |
output_high(SEL0); |
output_high(SEL1); |
countL|=input(CLKI)<<3; // read bit 3 of external counter |
output_low(MR); // External counter Master Reset |
output_high(MR); |
set_timer1(0); // Internal counter reset |
count=((unsigned int32)of<<20)+((unsigned int32)countH<<4)+(unsigned int32)countL; // concatenate |
sprintf(countS,"%09Lu", count); // engeneering values conversion |
strncpy(a, countS, 3); a[3]='\0'; |
strncpy(b, &countS[3], 3); b[3]='\0'; |
strncpy(c, &countS[6], 3); c[3]='\0'; |
printf("%s\r\n", countS); // output to RS232 |
output_toggle(BEEP); // cvak... |
of=0; // reset overflow counter |
} |
#int_TIMER1 // Interrupf from overflow |
void TIMER1_isr(void) |
{ |
of++; |
} |
/*#int_TIMER2 // every 10 ms |
void TIMER2_isr(void) |
{ |
output_low(CE); |
count=get_timer1(); |
set_timer1(0); |
output_high(CE); |
}*/ |
void main() |
{ |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_OFF); |
setup_spi(SPI_SS_DISABLED); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
// setup_wdt(WDT_144MS); |
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); |
setup_timer_2(T2_DIV_BY_16,196,16); |
setup_ccp1(CCP_OFF); |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
delay_ms(1000); |
int n; |
for (n=0;n<40;n++) putc(cmd[n]); // setup GPS |
printf("cvak...\r\n"); |
ext_int_edge( L_TO_H ); // set 1PPS active edge |
enable_interrupts(INT_TIMER1); |
enable_interrupts(INT_EXT); |
enable_interrupts(INT_SSP); |
// enable_interrupts(INT_TIMER2); |
enable_interrupts(GLOBAL); |
while(true) |
{ |
/* output_high(LED); |
delay_ms(999); |
output_low(LED); |
delay_ms(999); |
printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]); |
*/ |
} |
} |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.cof |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.err |
---|
0,0 → 1,3 |
>>> Warning 202 "Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main.h" Line 19(5,8): Variable never used: rs232_errors |
Memory usage: ROM=12% RAM=12% - 26% |
0 Errors, 1 Warnings. |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.esym |
---|
0,0 → 1,588 |
C L "MAIN" 0 20 5 "FUNCTION" |
D G "__PCM__" 0 152 ""4.106"" |
D G "__DEVICE__" 0 152 "887" |
D G "__DATE__" 0 152 ""04-II-14"" |
D G "__TIME__" 0 152 ""11:45:16"" "Standard Header file for the PIC16F887 device ////////////////" |
d G "PIN_A0" 2 20 "40" |
d G "PIN_A1" 2 21 "41" |
d G "PIN_A2" 2 22 "42" |
d G "PIN_A3" 2 23 "43" |
d G "PIN_A4" 2 24 "44" |
d G "PIN_A5" 2 25 "45" |
d G "PIN_A6" 2 26 "46" |
d G "PIN_A7" 2 27 "47" |
d G "PIN_B0" 2 29 "48" |
d G "PIN_B1" 2 30 "49" |
d G "PIN_B2" 2 31 "50" |
d G "PIN_B3" 2 32 "51" |
d G "PIN_B4" 2 33 "52" |
d G "PIN_B5" 2 34 "53" |
d G "PIN_B6" 2 35 "54" |
d G "PIN_B7" 2 36 "55" |
d G "PIN_C0" 2 38 "56" |
d G "PIN_C1" 2 39 "57" |
d G "PIN_C2" 2 40 "58" |
d G "PIN_C3" 2 41 "59" |
d G "PIN_C4" 2 42 "60" |
d G "PIN_C5" 2 43 "61" |
d G "PIN_C6" 2 44 "62" |
d G "PIN_C7" 2 45 "63" |
d G "PIN_D0" 2 47 "64" |
d G "PIN_D1" 2 48 "65" |
d G "PIN_D2" 2 49 "66" |
d G "PIN_D3" 2 50 "67" |
d G "PIN_D4" 2 51 "68" |
d G "PIN_D5" 2 52 "69" |
d G "PIN_D6" 2 53 "70" |
d G "PIN_D7" 2 54 "71" |
d G "PIN_E0" 2 56 "72" |
d G "PIN_E1" 2 57 "73" |
d G "PIN_E2" 2 58 "74" |
d G "PIN_E3" 2 59 "75" |
d G "FALSE" 2 62 "0" |
d G "TRUE" 2 63 "1" |
d G "BYTE" 2 65 "int8" |
d G "BOOLEAN" 2 66 "int1" |
d G "getc" 2 68 "getch" |
d G "fgetc" 2 69 "getch" |
d G "getchar" 2 70 "getch" |
d G "putc" 2 71 "putchar" |
d G "fputc" 2 72 "putchar" |
d G "fgets" 2 73 "gets" |
d G "fputs" 2 74 "puts" |
d G "WDT_FROM_SLEEP" 2 79 "3" |
d G "WDT_TIMEOUT" 2 80 "11" |
d G "MCLR_FROM_SLEEP" 2 81 "19" |
d G "MCLR_FROM_RUN" 2 82 "27" |
d G "NORMAL_POWER_UP" 2 83 "25" |
d G "BROWNOUT_RESTART" 2 84 "26" |
d G "T0_INTERNAL" 2 91 "0" |
d G "T0_EXT_L_TO_H" 2 92 "32" |
d G "T0_EXT_H_TO_L" 2 93 "48" |
d G "T0_DIV_1" 2 95 "8" |
d G "T0_DIV_2" 2 96 "0" |
d G "T0_DIV_4" 2 97 "1" |
d G "T0_DIV_8" 2 98 "2" |
d G "T0_DIV_16" 2 99 "3" |
d G "T0_DIV_32" 2 100 "4" |
d G "T0_DIV_64" 2 101 "5" |
d G "T0_DIV_128" 2 102 "6" |
d G "T0_DIV_256" 2 103 "7" |
d G "T0_8_BIT" 2 106 "0" |
d G "RTCC_INTERNAL" 2 108 "0" "The following are provided for compatibility" |
d G "RTCC_EXT_L_TO_H" 2 109 "32" "with older compiler versions" |
d G "RTCC_EXT_H_TO_L" 2 110 "48" |
d G "RTCC_DIV_1" 2 111 "8" |
d G "RTCC_DIV_2" 2 112 "0" |
d G "RTCC_DIV_4" 2 113 "1" |
d G "RTCC_DIV_8" 2 114 "2" |
d G "RTCC_DIV_16" 2 115 "3" |
d G "RTCC_DIV_32" 2 116 "4" |
d G "RTCC_DIV_64" 2 117 "5" |
d G "RTCC_DIV_128" 2 118 "6" |
d G "RTCC_DIV_256" 2 119 "7" |
d G "RTCC_8_BIT" 2 120 "0" |
d G "WDT_18MS" 2 132 "8" |
d G "WDT_36MS" 2 133 "9" |
d G "WDT_72MS" 2 134 "10" |
d G "WDT_144MS" 2 135 "11" |
d G "WDT_288MS" 2 136 "12" |
d G "WDT_576MS" 2 137 "13" |
d G "WDT_1152MS" 2 138 "14" |
d G "WDT_2304MS" 2 139 "15" |
d G "WDT_ON" 2 143 "0x4100" |
d G "WDT_OFF" 2 144 "0" |
d G "WDT_DIV_16" 2 145 "0x100" |
d G "WDT_DIV_8" 2 146 "0x300" |
d G "WDT_DIV_4" 2 147 "0x500" |
d G "WDT_DIV_2" 2 148 "0x700" |
d G "WDT_TIMES_1" 2 149 "0x900" "Default" |
d G "WDT_TIMES_2" 2 150 "0xB00" |
d G "WDT_TIMES_4" 2 151 "0xD00" |
d G "WDT_TIMES_8" 2 152 "0xF00" |
d G "WDT_TIMES_16" 2 153 "0x1100" |
d G "WDT_TIMES_32" 2 154 "0x1300" |
d G "WDT_TIMES_64" 2 155 "0x1500" |
d G "WDT_TIMES_128" 2 156 "0x1700" |
d G "T1_DISABLED" 2 162 "0" |
d G "T1_INTERNAL" 2 163 "5" |
d G "T1_EXTERNAL" 2 164 "7" |
d G "T1_EXTERNAL_SYNC" 2 165 "3" |
d G "T1_CLK_OUT" 2 167 "8" |
d G "T1_DIV_BY_1" 2 169 "0" |
d G "T1_DIV_BY_2" 2 170 "0x10" |
d G "T1_DIV_BY_4" 2 171 "0x20" |
d G "T1_DIV_BY_8" 2 172 "0x30" |
d G "T1_GATE" 2 174 "0x40" |
d G "T1_GATE_INVERTED" 2 175 "0xC0" |
d G "T2_DISABLED" 2 180 "0" |
d G "T2_DIV_BY_1" 2 181 "4" |
d G "T2_DIV_BY_4" 2 182 "5" |
d G "T2_DIV_BY_16" 2 183 "6" |
d G "CCP_OFF" 2 189 "0" |
d G "CCP_CAPTURE_FE" 2 190 "4" |
d G "CCP_CAPTURE_RE" 2 191 "5" |
d G "CCP_CAPTURE_DIV_4" 2 192 "6" |
d G "CCP_CAPTURE_DIV_16" 2 193 "7" |
d G "CCP_COMPARE_SET_ON_MATCH" 2 194 "8" |
d G "CCP_COMPARE_CLR_ON_MATCH" 2 195 "9" |
d G "CCP_COMPARE_INT" 2 196 "0xA" |
d G "CCP_COMPARE_RESET_TIMER" 2 197 "0xB" |
d G "CCP_PWM" 2 198 "0xC" |
d G "CCP_PWM_PLUS_1" 2 199 "0x1c" |
d G "CCP_PWM_PLUS_2" 2 200 "0x2c" |
d G "CCP_PWM_PLUS_3" 2 201 "0x3c" |
d G "CCP_PWM_H_H" 2 206 "0x0c" |
d G "CCP_PWM_H_L" 2 207 "0x0d" |
d G "CCP_PWM_L_H" 2 208 "0x0e" |
d G "CCP_PWM_L_L" 2 209 "0x0f" |
d G "CCP_PWM_FULL_BRIDGE" 2 211 "0x40" |
d G "CCP_PWM_FULL_BRIDGE_REV" 2 212 "0xC0" |
d G "CCP_PWM_HALF_BRIDGE" 2 213 "0x80" |
d G "CCP_SHUTDOWN_ON_COMP1" 2 215 "0x100000" |
d G "CCP_SHUTDOWN_ON_COMP2" 2 216 "0x200000" |
d G "CCP_SHUTDOWN_ON_COMP" 2 217 "0x300000" |
d G "CCP_SHUTDOWN_ON_INT0" 2 218 "0x400000" |
d G "CCP_SHUTDOWN_ON_COMP1_INT0" 2 219 "0x500000" |
d G "CCP_SHUTDOWN_ON_COMP2_INT0" 2 220 "0x600000" |
d G "CCP_SHUTDOWN_ON_COMP_INT0" 2 221 "0x700000" |
d G "CCP_SHUTDOWN_AC_L" 2 223 "0x000000" |
d G "CCP_SHUTDOWN_AC_H" 2 224 "0x040000" |
d G "CCP_SHUTDOWN_AC_F" 2 225 "0x080000" |
d G "CCP_SHUTDOWN_BD_L" 2 227 "0x000000" |
d G "CCP_SHUTDOWN_BD_H" 2 228 "0x010000" |
d G "CCP_SHUTDOWN_BD_F" 2 229 "0x020000" |
d G "CCP_SHUTDOWN_RESTART" 2 231 "0x80000000" |
d G "CCP_PULSE_STEERING_A" 2 233 "0x01000000" |
d G "CCP_PULSE_STEERING_B" 2 234 "0x02000000" |
d G "CCP_PULSE_STEERING_C" 2 235 "0x04000000" |
d G "CCP_PULSE_STEERING_D" 2 236 "0x08000000" |
d G "CCP_PULSE_STEERING_SYNC" 2 237 "0x10000000" |
d G "SPI_MASTER" 2 245 "0x20" |
d G "SPI_SLAVE" 2 246 "0x24" |
d G "SPI_L_TO_H" 2 247 "0" |
d G "SPI_H_TO_L" 2 248 "0x10" |
d G "SPI_CLK_DIV_4" 2 249 "0" |
d G "SPI_CLK_DIV_16" 2 250 "1" |
d G "SPI_CLK_DIV_64" 2 251 "2" |
d G "SPI_CLK_T2" 2 252 "3" |
d G "SPI_SS_DISABLED" 2 253 "1" |
d G "SPI_SAMPLE_AT_END" 2 255 "0x8000" |
d G "SPI_XMIT_L_TO_H" 2 256 "0x4000" |
d G "UART_ADDRESS" 2 262 "2" |
d G "UART_DATA" 2 263 "4" |
d G "UART_AUTODETECT" 2 264 "8" |
d G "UART_AUTODETECT_NOWAIT" 2 265 "9" |
d G "UART_WAKEUP_ON_RDA" 2 266 "10" |
d G "UART_SEND_BREAK" 2 267 "13" |
d G "NC_NC_NC_NC" 2 273 "0x00" |
d G "NC_NC" 2 274 "0x00" |
d G "CP1_A0_A3" 2 277 "0x00090080" |
d G "CP1_A1_A3" 2 278 "0x000A0081" |
d G "CP1_B3_A3" 2 279 "0x00880082" |
d G "CP1_B1_A3" 2 280 "0x00280083" |
d G "CP1_A0_VREF" 2 281 "0x00010084" |
d G "CP1_A1_VREF" 2 282 "0x00020085" |
d G "CP1_B3_VREF" 2 283 "0x00800086" |
d G "CP1_B1_VREF" 2 284 "0x00200087" |
d G "CP1_OUT_ON_A4" 2 286 "0x00000020" |
d G "CP1_INVERT" 2 287 "0x00000010" |
d G "CP1_ABSOLUTE_VREF" 2 288 "0x20000000" |
d G "CP2_A0_A2" 2 291 "0x00058000" |
d G "CP2_A1_A2" 2 292 "0x00068100" |
d G "CP2_B3_A2" 2 293 "0x00848200" |
d G "CP2_B1_A2" 2 294 "0x00248300" |
d G "CP2_A0_VREF" 2 295 "0x00018400" |
d G "CP2_A1_VREF" 2 296 "0x00028500" |
d G "CP2_B3_VREF" 2 297 "0x00808600" |
d G "CP2_B1_VREF" 2 298 "0x00208700" |
d G "CP2_OUT_ON_A5" 2 300 "0x00002000" |
d G "CP2_INVERT" 2 301 "0x00001000" |
d G "CP2_ABSOLUTE_VREF" 2 302 "0x10000000" |
d G "CP2_T1_SYNC" 2 305 "0x01000000" |
d G "CP2_T1_GATE" 2 306 "0x02000000" |
d G "VREF_LOW" 2 315 "0xa0" |
d G "VREF_HIGH" 2 316 "0x80" |
d G "OSC_31KHZ" 2 322 "1" |
d G "OSC_125KHZ" 2 323 "0x11" |
d G "OSC_250KHZ" 2 324 "0x21" |
d G "OSC_500KHZ" 2 325 "0x31" |
d G "OSC_1MHZ" 2 326 "0x41" |
d G "OSC_2MHZ" 2 327 "0x51" |
d G "OSC_4MHZ" 2 328 "0x61" |
d G "OSC_8MHZ" 2 329 "0x71" |
d G "OSC_INTRC" 2 330 "1" |
d G "OSC_NORMAL" 2 331 "0" |
d G "OSC_STATE_STABLE" 2 333 "4" |
d G "OSC_31KHZ_STABLE" 2 334 "2" |
d G "ADC_OFF" 2 342 "0" "ADC Off" |
d G "ADC_CLOCK_DIV_2" 2 343 "0x100" |
d G "ADC_CLOCK_DIV_8" 2 344 "0x40" |
d G "ADC_CLOCK_DIV_32" 2 345 "0x80" |
d G "ADC_CLOCK_INTERNAL" 2 346 "0xc0" "Internal 2-6us" |
d G "sAN0" 2 350 "1" "| A0" |
d G "sAN1" 2 351 "2" "| A1" |
d G "sAN2" 2 352 "4" "| A2" |
d G "sAN3" 2 353 "8" "| A3" |
d G "sAN4" 2 354 "16" "| A5" |
d G "sAN5" 2 355 "32" "| E0" |
d G "sAN6" 2 356 "64" "| E1" |
d G "sAN7" 2 357 "128" "| E2" |
d G "sAN8" 2 358 "0x10000" "| B2" |
d G "sAN9" 2 359 "0x20000" "| B3" |
d G "sAN10" 2 360 "0x40000" "| B1" |
d G "sAN11" 2 361 "0x80000" "| B4" |
d G "sAN12" 2 362 "0x100000" "| B0" |
d G "sAN13" 2 363 "0x200000" "| B5" |
d G "NO_ANALOGS" 2 364 "0" "None" |
d G "ALL_ANALOG" 2 365 "0x1F00FF" "A0 A1 A2 A3 A5 E0 E1 E2 B0 B1 B2 B3 B4 B5" |
d G "VSS_VDD" 2 368 "0x0000" "| Range 0-Vdd" |
d G "VSS_VREF" 2 369 "0x1000" "| Range 0-Vref" |
d G "VREF_VREF" 2 370 "0x3000" "| Range Vref-Vref" |
d G "VREF_VDD" 2 371 "0x2000" "| Range Vref-Vdd" |
d G "ADC_START_AND_READ" 2 375 "7" "This is the default if nothing is specified" |
d G "ADC_START_ONLY" 2 376 "1" |
d G "ADC_READ_ONLY" 2 377 "6" |
d G "L_TO_H" 2 389 "0x40" |
d G "H_TO_L" 2 390 "0" |
d G "GLOBAL" 2 392 "0x0BC0" |
d G "INT_RTCC" 2 393 "0x000B20" |
d G "INT_RB" 2 394 "0x01FF0B08" |
d G "INT_EXT_L2H" 2 395 "0x50000B10" |
d G "INT_EXT_H2L" 2 396 "0x60000B10" |
d G "INT_EXT" 2 397 "0x000B10" |
d G "INT_AD" 2 398 "0x008C40" |
d G "INT_TBE" 2 399 "0x008C10" |
d G "INT_RDA" 2 400 "0x008C20" |
d G "INT_TIMER1" 2 401 "0x008C01" |
d G "INT_TIMER2" 2 402 "0x008C02" |
d G "INT_CCP1" 2 403 "0x008C04" |
d G "INT_CCP2" 2 404 "0x008D01" |
d G "INT_SSP" 2 405 "0x008C08" |
d G "INT_BUSCOL" 2 406 "0x008D08" |
d G "INT_EEPROM" 2 407 "0x008D10" |
d G "INT_TIMER0" 2 408 "0x000B20" |
d G "INT_OSC_FAIL" 2 409 "0x008D80" |
d G "INT_COMP" 2 410 "0x008D20" |
d G "INT_COMP2" 2 411 "0x008D40" |
d G "INT_ULPWU" 2 412 "0x008D04" |
d G "INT_RB0" 2 413 "0x0010B08" |
d G "INT_RB1" 2 414 "0x0020B08" |
d G "INT_RB2" 2 415 "0x0040B08" |
d G "INT_RB3" 2 416 "0x0080B08" |
d G "INT_RB4" 2 417 "0x0100B08" |
d G "INT_RB5" 2 418 "0x0200B08" |
d G "INT_RB6" 2 419 "0x0400B08" |
d G "INT_RB7" 2 420 "0x0800B08" |
D G "_STRING" 3 12 "" |
D G "_STDDEF" 4 13 "" |
D G "ptrdiff_t" 4 18 "unsigned int16" |
D G "size_t" 4 21 "unsigned int8" |
D G "wchar_t" 4 22 "char" |
D G "NULL" 4 23 "0" |
D G "offsetof" 4 25 "(s,f) (offsetofbit(s,f)/8)" |
D G "_CTYPE" 5 12 "" |
D G "islower" 5 14 "(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")" |
D G "isupper" 5 15 "(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")" |
D G "isalnum" 5 16 "(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")" |
D G "isalpha" 5 17 "(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")" |
D G "isdigit" 5 18 "(x) isamong(x,"0123456789")" |
D G "isspace" 5 19 "(x) ((x)==' ')" |
D G "isxdigit" 5 20 "(x) isamong(x,"0123456789ABCDEFabcdef")" |
D G "iscntrl" 5 21 "(x) ((x)<' ')" |
D G "isprint" 5 22 "(x) ((x)>=' ')" |
D G "isgraph" 5 23 "(x) ((x)>' ')" |
D G "ispunct" 5 24 "(x) (((x)>' ')&&!isalnum(x))" |
C L "memmove" 3 19 10 "FUNCTION" |
F G "memmove" 3 34 "*int8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 34 "*int8" |
V L "s2" 3 34 "*int8" |
V L "n" 3 34 "int8" |
V L "sc1" 3 36 "*int8" |
V L "sc2" 3 37 "*int8" |
D G "strcopy" 3 54 "strcpy" |
C L "strncpy" 3 19 4 "FUNCTION" |
F G "strncpy" 3 61 "*int8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 61 "*int8" |
V L "s2" 3 61 "*int8" |
V L "n" 3 61 "int8" |
V L "s" 3 63 "*int8" |
C L "strcat" 3 19 3 "FUNCTION" |
F G "strcat" 3 78 "*int8(*int8 s1,*int8 s2)" |
V L "s1" 3 78 "*int8" |
V L "s2" 3 78 "*int8" |
V L "s" 3 80 "*int8" |
C L "strncat" 3 19 2 "FUNCTION" |
F G "strncat" 3 96 "*int8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 96 "*int8" |
V L "s2" 3 96 "*int8" |
V L "n" 3 96 "int8" |
V L "s" 3 98 "*int8" |
C L "memcmp" 3 19 3 "FUNCTION" |
F G "memcmp" 3 120 "sint8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 120 "*int8" |
V L "s2" 3 120 "*int8" |
V L "n" 3 120 "int8" |
V L "su1" 3 122 "*int8" |
V L "su2" 3 122 "*int8" |
C L "strcmp" 3 19 2 "FUNCTION" |
F G "strcmp" 3 134 "sint8(*int8 s1,*int8 s2)" |
V L "s1" 3 134 "*int8" |
V L "s2" 3 134 "*int8" |
C L "strcoll" 3 19 2 "FUNCTION" |
F G "strcoll" 3 144 "sint8(*int8 s1,*int8 s2)" |
V L "s1" 3 144 "*int8" |
V L "s2" 3 144 "*int8" |
C L "strncmp" 3 19 4 "FUNCTION" |
F G "strncmp" 3 157 "sint8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 157 "*int8" |
V L "s2" 3 157 "*int8" |
V L "n" 3 157 "int8" |
C L "strxfrm" 3 19 3 "FUNCTION" |
F G "strxfrm" 3 169 "int8(*int8 s1,*int8 s2,int8 n)" |
V L "s1" 3 169 "*int8" |
V L "s2" 3 169 "*int8" |
V L "n" 3 169 "int8" |
V L "s" 3 171 "*int8" |
V L "n1" 3 172 "int8" |
C L "memchr" 3 19 3 "FUNCTION" |
F G "memchr" 3 191 "*int8(*int8 s,int8 c,int8 n)" |
V L "s" 3 191 "*int8" |
V L "c" 3 191 "int8" |
V L "n" 3 191 "int8" |
V L "uc" 3 193 "int8" |
V L "su" 3 194 "*int8" |
C L "strchr" 3 19 2 "FUNCTION" |
F G "strchr" 3 205 "*int8(*int8 s,int8 c)" |
V L "s" 3 205 "*int8" |
V L "c" 3 205 "int8" |
C L "strcspn" 3 19 4 "FUNCTION" |
F G "strcspn" 3 217 "int8(*int8 s1,*int8 s2)" |
V L "s1" 3 217 "*int8" |
V L "s2" 3 217 "*int8" |
V L "sc1" 3 219 "*int8" |
V L "sc2" 3 219 "*int8" |
C L "strpbrk" 3 19 4 "FUNCTION" |
F G "strpbrk" 3 232 "*int8(*int8 s1,*int8 s2)" |
V L "s1" 3 232 "*int8" |
V L "s2" 3 232 "*int8" |
V L "sc1" 3 234 "*int8" |
V L "sc2" 3 234 "*int8" |
C L "strrchr" 3 19 2 "FUNCTION" |
F G "strrchr" 3 247 "*int8(*int8 s,int8 c)" |
V L "s" 3 247 "*int8" |
V L "c" 3 247 "int8" |
V L "p" 3 249 "*int8" |
C L "strspn" 3 19 2 "FUNCTION" |
F G "strspn" 3 262 "int8(*int8 s1,*int8 s2)" |
V L "s1" 3 262 "*int8" |
V L "s2" 3 262 "*int8" |
V L "sc1" 3 264 "*int8" |
V L "sc2" 3 264 "*int8" |
C L "strstr" 3 19 6 "FUNCTION" |
F G "strstr" 3 281 "*int8(*int8 s1,*int8 s2)" |
V L "s1" 3 281 "*int8" |
V L "s2" 3 281 "*int8" |
V L "s" 3 283 "*int8" |
V L "t" 3 283 "*int8" |
C L "strtok" 3 19 13 "FUNCTION" |
F G "strtok" 3 320 "*int8(*int8 s1,*int8 s2)" |
V L "s1" 3 320 "*int8" |
V L "s2" 3 320 "*int8" |
V L "beg" 3 322 "*int8" |
V L "end" 3 322 "*int8" |
V L "save" 3 323 "*int8" |
C L "strlen" 3 19 6 "FUNCTION" |
F G "strlen" 3 369 "int8(*int8 s)" |
V L "s" 3 369 "*int8" |
V L "sc" 3 371 "*int8" |
C L "stricmp" 3 19 2 "FUNCTION" |
F G "stricmp" 3 380 "sint8(*int8 s1,*int8 s2)" |
V L "s1" 3 380 "*int8" |
V L "s2" 3 380 "*int8" |
C L "strlwr" 3 19 3 "FUNCTION" |
F G "strlwr" 3 394 "*int8(*int8 s)" |
V L "s" 3 394 "*int8" |
V L "p" 3 396 "*int8" |
D G "LED" 0 5 "PIN_E1" |
D G "CE" 0 6 "PIN_E2" |
D G "SEL0" 0 8 "PIN_E0" "external counter division ratio" |
D G "SEL1" 0 9 "PIN_E1" "external counter division ratio" |
D G "MR" 0 10 "PIN_E2" "external counter master reset" |
D G "CLKI" 0 11 "PIN_C0" "internal counter input" |
D G "BEEP" 0 12 "PIN_C3" "buzzer" |
V G "count" 0 14 "int32" |
V G "buffer" 0 17 "int8[16]" "I2C buffer" |
V G "address" 0 18 "int8" |
V G "of" 0 20 "int16" |
V G "cmd" 0 22 "int8[40]" |
F G "ssp_interupt" 0 25 "void()" |
V L "incoming" 0 27 "int8" |
V L "state" 0 27 "int8" |
C L "ssp_interupt" 0 20 1 "FUNCTION" |
C L "ssp_interupt" 0 20 1 "FUNCTION" |
C L "ssp_interupt" 0 20 1 "FUNCTION" |
C L "ssp_interupt" 0 20 1 "FUNCTION" |
F G "EXT_isr" 0 58 "void()" |
V L "countH" 0 60 "int16" |
V L "countL" 0 61 "int8" |
V L "countS" 0 62 "int8[10]" |
V L "a" 0 62 "int8[4]" |
V L "b" 0 62 "int8[4]" |
V L "c" 0 62 "int8[4]" "strings for printing results" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
C L "EXT_isr" 0 20 1 "FUNCTION" |
F G "TIMER1_isr" 0 99 "void()" |
C L "MAIN" 0 20 7 "FUNCTION" |
F G "MAIN" 0 115 "void()" |
C L "MAIN" 0 20 1 "FUNCTION" |
V L "n" 0 129 "int8" |
C L "MAIN" 0 20 1 "FUNCTION" |
C L "MAIN" 0 20 1 "FUNCTION" |
C L "MAIN" 0 20 1 "FUNCTION" |
F B "reset_cpu" 0 0 |
F B "abs" 1 0 |
F B "sleep_ulpwu" 1 0 |
F B "sleep" 0 0 |
F B "delay_cycles" 1 0 |
F B "read_bank" 2 0 |
F B "write_bank" 3 0 |
F B "shift_left" 2 2 |
F B "shift_right" 2 2 |
F B "rotate_left" 2 0 |
F B "rotate_right" 2 0 |
F B "_mul" 2 0 |
F B "memset" 3 0 |
F B "isamoung" 2 0 |
F B "isamong" 2 0 |
F B "bit_set" 2 0 |
F B "bit_clear" 2 0 |
F B "bit_test" 2 0 |
F B "toupper" 1 0 |
F B "tolower" 1 0 |
F B "swap" 1 0 |
F B "printf" 1 255 |
F B "fprintf" 1 255 |
F B "sprintf" 1 255 |
F B "make8" 2 0 |
F B "make16" 2 0 |
F B "make32" 1 255 |
F B "label_address" 1 1 |
F B "goto_address" 1 0 |
F B "_va_arg" 1 0 |
F B "offsetofbit" 2 2 |
F B "enable_interrupts" 1 0 |
F B "disable_interrupts" 1 0 |
F B "interrupt_active" 1 0 |
F B "clear_interrupt" 1 0 |
F B "jump_to_isr" 1 0 |
F B "ext_int_edge" 1 2 |
F B "read_eeprom" 1 0 |
F B "write_eeprom" 2 0 |
F B "read_program_eeprom" 1 0 |
F B "write_program_eeprom" 2 0 |
F B "write_program_memory" 4 0 |
F B "write_program_memory8" 4 0 |
F B "read_program_memory" 4 0 |
F B "read_program_memory8" 4 0 |
F B "erase_program_eeprom" 1 0 |
F B "strcpy" 2 0 |
F B "memcpy" 3 0 |
F B "strstr100" 2 0 |
F B "output_high" 1 0 |
F B "output_low" 1 0 |
F B "input" 1 0 |
F B "input_state" 1 0 |
F B "output_float" 1 0 |
F B "output_drive" 1 0 |
F B "output_bit" 1 1 |
F B "output_toggle" 1 0 |
F B "output_a" 1 0 |
F B "output_b" 1 0 |
F B "output_c" 1 0 |
F B "output_d" 1 0 |
F B "output_e" 1 0 |
F B "input_a" 0 0 |
F B "input_b" 0 0 |
F B "input_c" 0 0 |
F B "input_d" 0 0 |
F B "input_e" 0 0 |
F B "set_tris_a" 1 0 |
F B "set_tris_b" 1 0 |
F B "set_tris_c" 1 0 |
F B "set_tris_d" 1 0 |
F B "set_tris_e" 1 0 |
F B "get_tris_a" 0 0 |
F B "get_tris_b" 0 0 |
F B "get_tris_c" 0 0 |
F B "get_tris_d" 0 0 |
F B "get_tris_e" 0 0 |
F B "input_change_a" 0 0 |
F B "input_change_b" 0 0 |
F B "input_change_c" 0 0 |
F B "input_change_d" 0 0 |
F B "input_change_e" 0 0 |
F B "port_b_pullups" 1 0 |
F B "setup_counters" 2 0 |
F B "setup_wdt" 1 0 |
F B "restart_cause" 0 0 |
F B "restart_wdt" 0 0 |
F B "get_rtcc" 0 0 |
F B "set_rtcc" 1 0 |
F B "get_timer0" 0 0 |
F B "set_timer0" 1 0 |
F B "setup_comparator" 1 0 |
F B "setup_port_a" 1 0 |
F B "setup_adc_ports" 1 0 |
F B "setup_adc" 1 0 |
F B "set_adc_channel" 1 0 |
F B "read_adc" 0 1 |
F B "adc_done" 0 0 |
F B "setup_timer_0" 1 0 |
F B "setup_vref" 1 0 |
F B "setup_timer_1" 1 0 |
F B "get_timer1" 0 0 |
F B "set_timer1" 1 0 |
F B "setup_timer_2" 3 0 |
F B "get_timer2" 0 0 |
F B "set_timer2" 1 0 |
F B "setup_ccp1" 1 2 |
F B "set_pwm1_duty" 1 0 |
F B "setup_ccp2" 1 0 |
F B "set_pwm2_duty" 1 0 |
F B "setup_oscillator" 1 2 |
F B "setup_spi" 1 0 |
F B "spi_read" 0 1 |
F B "spi_write" 1 0 |
F B "spi_data_is_in" 0 0 |
F B "setup_spi2" 1 0 |
F B "spi_read2" 0 1 |
F B "spi_write2" 1 0 |
F B "spi_data_is_in2" 0 0 |
F B "brownout_enable" 1 0 |
F B "delay_ms" 1 0 |
F B "delay_us" 1 0 |
F B "putchar" 1 2 |
F B "puts" 1 2 |
F B "getch" 0 1 |
F B "gets" 1 3 |
F B "kbhit" 0 1 |
F B "set_uart_speed" 1 3 |
F B "setup_uart" 1 3 |
F B "i2c_read" 0 2 |
F B "i2c_write" 1 2 |
F B "i2c_start" 0 2 |
F B "i2c_stop" 0 1 |
F B "i2c_isr_state" 0 1 |
F B "i2c_slaveaddr" 1 2 |
F B "i2c_poll" 0 1 |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.hex |
---|
0,0 → 1,127 |
:1000000003308A00322B0000FF00030E8301A100A1 |
:100010000A08A0008A010408A2007708A300780853 |
:10002000A4007908A5007A08A600831383120B1E8A |
:100030001B288B1838288C308400001C21280C18B1 |
:100040003B288C308400801D27288C193E282208EC |
:1000500084002308F7002408F8002508F900260882 |
:10006000FA0020088A00210E8300FF0E7F0E09008F |
:100070008A110A1245298A110A12C62A8A110A12FD |
:100080006D280A108A100A118207B53462340634CA |
:10009000313420340034003400340034003432343D |
:1000A000003400340034803484341E340034E034AE |
:1000B000C83410340034403442340F340034A03497 |
:1000C0008634013400340034003400340034F73412 |
:1000D000003400340034123403348316941A782820 |
:1000E0008312C2018316141D78288312C217831647 |
:1000F00083124208C20ACA004A087F3C031CA02897 |
:1001000014138C1D812813081416C9004A0B962855 |
:100110004908BF004908023C031D96282B08AF0080 |
:100120002C08B0002D08B1002E08B2004A08023C8D |
:10013000031DA0282F303F07840083134908800047 |
:100140004A08803C031DB7282F303F0784008313E3 |
:100150000008CB004B08CC004C08930014168C11FF |
:1001600083161418B128F8018312141AF80A8C1196 |
:100170008A110A122728F701F801F901FA018316FA |
:10018000A001A101A201A301750874047304720403 |
:100190000319FC282030A40003108312EE0DEF0D8C |
:1001A000F00DF10D8316A00DA10DA20DA30D750884 |
:1001B0002302031DE52874082202031DE5287308A5 |
:1001C0002102031DE52872082002031CF62872088C |
:1001D000A0027308031C730FA1027408031C740FA0 |
:1001E000A2027508031C750FA3020314F70DF80D86 |
:1001F000F90DFA0DA40BCC28A030840083138312D0 |
:1002000008006308E8006208E700E60803193029DF |
:100210006508FA006408840083137A18831780083D |
:10022000031930296808FA006708E70A0319E80A81 |
:10023000E9007A08EA006508FA006408E40A03198C |
:10024000E50A840083137A1883170008EB00690815 |
:10025000840083136A1883176B088000E60305295E |
:10026000E608031940296808FA006708E70A031935 |
:10027000E80A840083137A1883178001E603302983 |
:100280006208F8006308F9000800CB010F08FA00C3 |
:100290000E08F7000F087A02031D46297708C900E7 |
:1002A0007A08CA0083160910831209108316891070 |
:1002B0008312891028142808831687008312CB0123 |
:1002C0000718CB0A831609108312091483168910A4 |
:1002D000831289102814280883168700003083129F |
:1002E00007180130F7000310F70D7708CB048316C9 |
:1002F0000910831209108316891083128914281497 |
:100300002808831687000030831207180130F70091 |
:10031000F70DF70DFC30F7057708CB0483160910AD |
:10032000831209148316891083128914281428084B |
:10033000831687000030831207180130F700F70D8D |
:10034000F70DF70DF830F7057708CB048316091180 |
:100350008312091183160911831209158F018E0169 |
:10036000E501E4014108E3004008E2004108E5003E |
:100370004008E400E201E301E40DE50DE40DE50DC4 |
:10038000E40DE50DE40DE50DF030E405EA01E901C9 |
:10039000490DF7004A0DF800690DF9006A0DFA00E1 |
:1003A000F70DF80DF90DFA0DF70DF80DF90DFA0D21 |
:1003B000F70DF80DF90DFA0DF030F7057708E207A3 |
:1003C00078080318780FE30779080318790FE40712 |
:1003D0007A0803187A0FE507F801F901FA014B08CA |
:1003E0006207AB006308AC0078080318780FAC070D |
:1003F0006408AD0079080318790FAD076508AE00F1 |
:100400007A0803187A0FAE07C4014C30C300493094 |
:1004100084002E08E5002D08E4002C08E3002B08DA |
:10042000E2000408E6003B30ED009A30EC00CA30F0 |
:10043000EB00EA010A30E8006508F1006408F0000A |
:100440006308EF006208EE006D08F5006C08F40028 |
:100450006B08F3006A08F200BB2078080008E2008D |
:10046000840A0008E300840A0008E400840A000803 |
:10047000E500FD308407F708031D512A6808013A9A |
:100480000319512A66080319522A0F396802031901 |
:100490004B2A0318622AE61B622A661B522A203066 |
:1004A000532AE6013030F7077708EE00430884004E |
:1004B0008313441883176E088000840A8001C30ADE |
:1004C0000319C40A6D08F1006C08F0006B08EF0016 |
:1004D0006A08EE00F501F401F3010A30F200BB20D6 |
:1004E0007A08ED007908EC007808EB007708EA005C |
:1004F000E80B1C2AE3015630E200E5014C30E40031 |
:100500000330E6000121D901E3015A30E200E501A0 |
:100510004F30E4000330E6000121DD01E3015E30ED |
:10052000E200E5015230E4000330E6000121E10180 |
:100530004C308400831380080319B12AE3010408B6 |
:10054000E2006310831B631400080C1EA52A9900A7 |
:1005500062088400831363188317840A0319850AC9 |
:100560009B2A0D300C1EB22A99000A300C1EB62AA6 |
:100570009900A8112808831687000830831287067F |
:10058000C101C0018B108A110A122728C00A031961 |
:10059000C10A0C108A110A122728633BE1352E1775 |
:1005A000AE060A0047308400831300080319E52AC9 |
:1005B0000630F800F701F70BDB2AF80BDA2A7B305C |
:1005C000F700F70BE12A800BD82A8A110A12B72B01 |
:1005D000831603178C170C140000000083120C08FC |
:1005E0007F3903192E2B0313C60003170D080313BD |
:1005F000C70003170F080313C80046080C1EFE2A85 |
:100600009900470803178D000313480803178F004C |
:1006100083168C170C140000000083120C0D0E0DB5 |
:100620007F3903192E2B0313C60003170D0803137C |
:10063000C70003170F080313C80046080C1E1E2B23 |
:100640009900470803178D000313480803178F000C |
:100650008D0A03198F0A0313E82A031703138A115B |
:100660000A12CC2B840183131F30830583160317D2 |
:10067000871508300313990002309A00A6309800BD |
:10068000903083129800A8152808831687008312DB |
:100690002816280883168700A0309300363083126E |
:1006A0009400C101C001831603170908C0398900ED |
:1006B00003131F129F120030031788008312870153 |
:1006C000880189010313A701FF30A800A901AA012D |
:1006D0000330C200C301C401831603170908C039DF |
:1006E000890003131F129F12003003178800831222 |
:1006F00003131F109412A812280883168700831270 |
:1007000028162808831687008312A8112808831644 |
:100710008700013083129400003083169400010892 |
:10072000C739083881000730831290007830F8000C |
:1007300006389200C43083169200831228152808C8 |
:10074000831687008312970183169B019C01013059 |
:100750009D00831203178701880189018316031303 |
:10076000970104308312C600FA30C700D22AC60BA4 |
:10077000B42BC5014508273C031CC52B4508412067 |
:100780000C1EC02B9900C50ABA2BCD3003178D0063 |
:1007900002308F000313E82A831601170C1483120A |
:1007A0000B1683168C15C03083128B04D62B630076 |
:04400E00F22CFF3F52 |
:00000001FF |
;PIC16F887 |
;CRC=9B3A CREATED="04-II-14 11:45" |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.lst |
---|
0,0 → 1,1327 |
CCS PCM C Compiler, Version 4.106, 47914 04-II-14 11:45 |
Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main.lst |
ROM used: 984 words (12%) |
Largest free fragment is 2048 |
RAM used: 43 (12%) at main() level |
96 (26%) worst case |
Stack: 3 worst case (1 in main + 2 for interrupts) |
* |
0000: MOVLW 03 |
0001: MOVWF 0A |
0002: GOTO 332 |
0003: NOP |
0004: MOVWF 7F |
0005: SWAPF 03,W |
0006: CLRF 03 |
0007: MOVWF 21 |
0008: MOVF 0A,W |
0009: MOVWF 20 |
000A: CLRF 0A |
000B: MOVF 04,W |
000C: MOVWF 22 |
000D: MOVF 77,W |
000E: MOVWF 23 |
000F: MOVF 78,W |
0010: MOVWF 24 |
0011: MOVF 79,W |
0012: MOVWF 25 |
0013: MOVF 7A,W |
0014: MOVWF 26 |
0015: BCF 03.7 |
0016: BCF 03.5 |
0017: BTFSS 0B.4 |
0018: GOTO 01B |
0019: BTFSC 0B.1 |
001A: GOTO 038 |
001B: MOVLW 8C |
001C: MOVWF 04 |
001D: BTFSS 00.0 |
001E: GOTO 021 |
001F: BTFSC 0C.0 |
0020: GOTO 03B |
0021: MOVLW 8C |
0022: MOVWF 04 |
0023: BTFSS 00.3 |
0024: GOTO 027 |
0025: BTFSC 0C.3 |
0026: GOTO 03E |
0027: MOVF 22,W |
0028: MOVWF 04 |
0029: MOVF 23,W |
002A: MOVWF 77 |
002B: MOVF 24,W |
002C: MOVWF 78 |
002D: MOVF 25,W |
002E: MOVWF 79 |
002F: MOVF 26,W |
0030: MOVWF 7A |
0031: MOVF 20,W |
0032: MOVWF 0A |
0033: SWAPF 21,W |
0034: MOVWF 03 |
0035: SWAPF 7F,F |
0036: SWAPF 7F,W |
0037: RETFIE |
0038: BCF 0A.3 |
0039: BCF 0A.4 |
003A: GOTO 145 |
003B: BCF 0A.3 |
003C: BCF 0A.4 |
003D: GOTO 2C6 |
003E: BCF 0A.3 |
003F: BCF 0A.4 |
0040: GOTO 06D |
.................... #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) |
* |
02D2: MOVLW 47 |
02D3: MOVWF 04 |
02D4: BCF 03.7 |
02D5: MOVF 00,W |
02D6: BTFSC 03.2 |
02D7: GOTO 2E5 |
02D8: MOVLW 06 |
02D9: MOVWF 78 |
02DA: CLRF 77 |
02DB: DECFSZ 77,F |
02DC: GOTO 2DB |
02DD: DECFSZ 78,F |
02DE: GOTO 2DA |
02DF: MOVLW 7B |
02E0: MOVWF 77 |
02E1: DECFSZ 77,F |
02E2: GOTO 2E1 |
02E3: DECFSZ 00,F |
02E4: GOTO 2D8 |
02E5: BCF 0A.3 |
02E6: BCF 0A.4 |
02E7: GOTO 3B7 (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) |
* |
00AC: MOVF 4C,W |
00AD: MOVWF 13 |
00AE: BSF 14.4 |
00AF: BCF 0C.3 |
00B0: BSF 03.5 |
00B1: BTFSC 14.0 |
00B2: GOTO 0B1 |
00B3: CLRF 78 |
00B4: BCF 03.5 |
00B5: BTFSC 14.4 |
00B6: INCF 78,F |
.................... |
.................... |
.................... |
.................... #include <string.h> |
.................... //////////////////////////////////////////////////////////////////////////// |
.................... //// (C) Copyright 1996,2008 Custom Computer Services //// |
.................... //// This source code may only be used by licensed users of the CCS C //// |
.................... //// compiler. This source code may only be distributed to other //// |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
.................... //// or distribution is permitted without written permission. //// |
.................... //// Derivative programs created using this software in object code //// |
.................... //// form are not restricted in any way. //// |
.................... //////////////////////////////////////////////////////////////////////////// |
.................... |
.................... #ifndef _STRING |
.................... #define _STRING |
.................... #include <stddef.h> |
.................... /////////////////////////////////////////////////////////////////////////// |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
.................... //// This source code may only be used by licensed users of the CCS C //// |
.................... //// compiler. This source code may only be distributed to other //// |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
.................... //// or distribution is permitted without written permission. //// |
.................... //// Derivative programs created using this software in object code //// |
.................... //// form are not restricted in any way. //// |
.................... /////////////////////////////////////////////////////////////////////////// |
.................... |
.................... #ifndef _STDDEF |
.................... |
.................... #define _STDDEF |
.................... |
.................... #if sizeof(unsigned int8 *)==1 |
.................... #define ptrdiff_t unsigned int8 |
.................... #else |
.................... #define ptrdiff_t unsigned int16 |
.................... #endif |
.................... |
.................... #define size_t unsigned int8 |
.................... #define wchar_t char |
.................... #define NULL 0 |
.................... |
.................... #define offsetof(s,f) (offsetofbit(s,f)/8) |
.................... |
.................... #endif |
.................... |
.................... #include <ctype.h> |
.................... //////////////////////////////////////////////////////////////////////////// |
.................... //// (C) Copyright 1996,2003 Custom Computer Services //// |
.................... //// This source code may only be used by licensed users of the CCS C //// |
.................... //// compiler. This source code may only be distributed to other //// |
.................... //// licensed users of the CCS C compiler. No other use, reproduction //// |
.................... //// or distribution is permitted without written permission. //// |
.................... //// Derivative programs created using this software in object code //// |
.................... //// form are not restricted in any way. //// |
.................... //////////////////////////////////////////////////////////////////////////// |
.................... |
.................... #ifndef _CTYPE |
.................... #define _CTYPE |
.................... |
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz") |
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ") |
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") |
.................... #define isdigit(x) isamong(x,"0123456789") |
.................... #define isspace(x) ((x)==' ') |
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef") |
.................... #define iscntrl(x) ((x)<' ') |
.................... #define isprint(x) ((x)>=' ') |
.................... #define isgraph(x) ((x)>' ') |
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x)) |
.................... |
.................... #endif |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... ////////////////////////////////////////////// |
.................... //// Uncomment the following define to //// |
.................... //// allow some functions to use a //// |
.................... //// quicker algorithm, but use more ROM //// |
.................... //// //// |
.................... //// #define FASTER_BUT_MORE_ROM //// |
.................... ////////////////////////////////////////////// |
.................... |
.................... |
.................... |
.................... /*Copying functions*/ |
.................... /* standard template: |
.................... void *memmove(void *s1, void *s2, size_t n). |
.................... Copies max of n characters safely (not following ending '\0') |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
.................... |
.................... char *memmove(void *s1,char *s2,size_t n) |
.................... { |
.................... char *sc1; |
.................... char *sc2; |
.................... sc1=s1; |
.................... sc2=s2; |
.................... if(sc2<sc1 && sc1 <sc2 +n) |
.................... for(sc1+=n,sc2+=n;0<n;--n) |
.................... *--sc1=*--sc2; |
.................... else |
.................... for(;0<n;--n) |
.................... *sc1++=*sc2++; |
.................... return s1; |
.................... } |
.................... |
.................... /* Standard template: char *strcpy(char *s1, const char *s2) |
.................... copies the string s2 including the null character to s1. |
.................... This is a compiler built in to handle the different address |
.................... spaces */ |
.................... |
.................... #define strcopy strcpy |
.................... |
.................... /* standard template: |
.................... char *strncpy(char *s1, const char *s2, size_t n). |
.................... Copies max of n characters (not following ending '\0') |
.................... from s2 in s1; if s2 has less than n characters, appends 0 */ |
.................... |
.................... char *strncpy(char *s1, char *s2, size_t n) |
.................... { |
.................... char *s; |
.................... |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
* |
0101: MOVF 63,W |
0102: MOVWF 68 |
0103: MOVF 62,W |
0104: MOVWF 67 |
0105: MOVF 66,F |
0106: BTFSC 03.2 |
0107: GOTO 130 |
0108: MOVF 65,W |
0109: MOVWF 7A |
010A: MOVF 64,W |
010B: MOVWF 04 |
010C: BCF 03.7 |
010D: BTFSC 7A.0 |
010E: BSF 03.7 |
010F: MOVF 00,F |
0110: BTFSC 03.2 |
0111: GOTO 130 |
.................... *s++ = *s2++; |
0112: MOVF 68,W |
0113: MOVWF 7A |
0114: MOVF 67,W |
0115: INCF 67,F |
0116: BTFSC 03.2 |
0117: INCF 68,F |
0118: MOVWF 69 |
0119: MOVF 7A,W |
011A: MOVWF 6A |
011B: MOVF 65,W |
011C: MOVWF 7A |
011D: MOVF 64,W |
011E: INCF 64,F |
011F: BTFSC 03.2 |
0120: INCF 65,F |
0121: MOVWF 04 |
0122: BCF 03.7 |
0123: BTFSC 7A.0 |
0124: BSF 03.7 |
0125: MOVF 00,W |
0126: MOVWF 6B |
0127: MOVF 69,W |
0128: MOVWF 04 |
0129: BCF 03.7 |
012A: BTFSC 6A.0 |
012B: BSF 03.7 |
012C: MOVF 6B,W |
012D: MOVWF 00 |
012E: DECF 66,F |
012F: GOTO 105 |
.................... for (; n > 0; n--) |
0130: MOVF 66,F |
0131: BTFSC 03.2 |
0132: GOTO 140 |
.................... *s++ = '\0'; |
0133: MOVF 68,W |
0134: MOVWF 7A |
0135: MOVF 67,W |
0136: INCF 67,F |
0137: BTFSC 03.2 |
0138: INCF 68,F |
0139: MOVWF 04 |
013A: BCF 03.7 |
013B: BTFSC 7A.0 |
013C: BSF 03.7 |
013D: CLRF 00 |
013E: DECF 66,F |
013F: GOTO 130 |
.................... |
.................... return(s1); |
0140: MOVF 62,W |
0141: MOVWF 78 |
0142: MOVF 63,W |
0143: MOVWF 79 |
.................... } |
0144: RETURN |
.................... /***********************************************************/ |
.................... |
.................... /*concatenation functions*/ |
.................... /* standard template: char *strcat(char *s1, const char *s2) |
.................... appends s2 to s1*/ |
.................... |
.................... char *strcat(char *s1, char *s2) |
.................... { |
.................... char *s; |
.................... |
.................... for (s = s1; *s != '\0'; ++s); |
.................... while(*s2 != '\0') |
.................... { |
.................... *s = *s2; |
.................... ++s; |
.................... ++s2; |
.................... } |
.................... |
.................... *s = '\0'; |
.................... return(s1); |
.................... } |
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n) |
.................... appends not more than n characters from s2 to s1*/ |
.................... |
.................... char *strncat(char *s1, char *s2, size_t n) |
.................... { |
.................... char *s; |
.................... |
.................... for (s = s1; *s != '\0'; ++s); |
.................... while(*s2 != '\0' && 0<n) |
.................... { |
.................... *s = *s2; |
.................... ++s; |
.................... ++s2; |
.................... --n; |
.................... } |
.................... |
.................... *s = '\0'; |
.................... return(s1); |
.................... } |
.................... |
.................... /***********************************************************/ |
.................... |
.................... |
.................... /*comparison functions*/ |
.................... /* standard template: signed int memcmp(void *s1, void *s2). |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
.................... |
.................... signed int8 memcmp(void * s1,char *s2,size_t n) |
.................... { |
.................... char *su1, *su2; |
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n) |
.................... { |
.................... if(*su1!=*su2) |
.................... return ((*su1<*su2)?-1:+1); |
.................... } |
.................... return 0; |
.................... } |
.................... |
.................... /* standard template: int strcmp(const char *s1, const char *s2). |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
.................... |
.................... signed int8 strcmp(char *s1, char *s2) |
.................... { |
.................... for (; *s1 == *s2; s1++, s2++) |
.................... if (*s1 == '\0') |
.................... return(0); |
.................... return((*s1 < *s2) ? -1: 1); |
.................... } |
.................... /* standard template: int strcoll(const char *s1, const char *s2). |
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */ |
.................... |
.................... signed int8 strcoll(char *s1, char *s2) |
.................... { |
.................... for (; *s1 == *s2; s1++, s2++) |
.................... if (*s1 == '\0') |
.................... return(0); |
.................... return((*s1 < *s2) ? -1: 1); |
.................... } |
.................... |
.................... /* standard template: |
.................... int strncmp(const char *s1, const char *s2, size_t n). |
.................... Compares max of n characters (not following 0) from s1 to s2; |
.................... returns same as strcmp */ |
.................... |
.................... signed int8 strncmp(char *s1, char *s2, size_t n) |
.................... { |
.................... for (; n > 0; s1++, s2++, n--) |
.................... if (*s1 != *s2) |
.................... return((*s1 <*s2) ? -1: 1); |
.................... else if (*s1 == '\0') |
.................... return(0); |
.................... return(0); |
.................... } |
.................... /* standard template: |
.................... int strxfrm(const char *s1, const char *s2, size_t n). |
.................... transforms maximum of n characters from s2 and places them into s1*/ |
.................... size_t strxfrm(char *s1, char *s2, size_t n) |
.................... { |
.................... char *s; |
.................... unsigned int8 n1; |
.................... n1=n; |
.................... for (s = s1; n > 0 && *s2 != '\0'; n--) |
.................... *s++ = *s2++; |
.................... for (; n > 0; n--) |
.................... *s++ = '\0'; |
.................... |
.................... return(n1); |
.................... } |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... /***********************************************************/ |
.................... /*Search functions*/ |
.................... /* standard template: void *memchr(const char *s, int c). |
.................... Finds first occurrence of c in n characters of s */ |
.................... |
.................... char *memchr(void *s,unsigned int8 c,size_t n) |
.................... { |
.................... char uc; |
.................... char *su; |
.................... uc=c; |
.................... for(su=s;0<n;++su,--n) |
.................... if(*su==uc) |
.................... return su; |
.................... return NULL; |
.................... } |
.................... |
.................... /* standard template: char *strchr(const char *s, int c). |
.................... Finds first occurrence of c in s */ |
.................... |
.................... char *strchr(char *s, unsigned int8 c) |
.................... { |
.................... for (; *s != c; s++) |
.................... if (*s == '\0') |
.................... return(0); |
.................... return(s); |
.................... } |
.................... /* standard template: |
.................... size_t strcspn(const char *s1, const char *s2). |
.................... Computes length of max initial segment of s1 that |
.................... consists entirely of characters NOT from s2*/ |
.................... |
.................... unsigned int8 strcspn(char *s1, char *s2) |
.................... { |
.................... char *sc1, *sc2; |
.................... |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
.................... if (*sc1 == *sc2) |
.................... return(sc1 - s1); |
.................... return(sc1 - s1); |
.................... } |
.................... /* standard template: |
.................... char *strpbrk(const char *s1, const char *s2). |
.................... Locates first occurence of any character from s2 in s1; |
.................... returns s1 if s2 is empty string */ |
.................... |
.................... char *strpbrk(char *s1, char *s2) |
.................... { |
.................... char *sc1, *sc2; |
.................... |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
.................... for (sc2 = s2; *sc2 != 0; sc2++) |
.................... if (*sc1 == *sc2) |
.................... return(sc1); |
.................... return(0); |
.................... } |
.................... |
.................... |
.................... /* standard template: char *strrchr(const char *s, int c). |
.................... Finds last occurrence of c in s */ |
.................... |
.................... char *strrchr(char *s, unsigned int8 c) |
.................... { |
.................... char *p; |
.................... |
.................... for (p = 0; ; s++) |
.................... { |
.................... if (*s == c) |
.................... p = s; |
.................... if (*s == '\0') |
.................... return(p); |
.................... } |
.................... } |
.................... /* computes length of max initial segment of s1 consisting |
.................... entirely of characters from s2 */ |
.................... |
.................... unsigned int8 strspn(char *s1, char *s2) |
.................... { |
.................... char *sc1, *sc2; |
.................... |
.................... for (sc1 = s1; *sc1 != 0; sc1++) |
.................... for (sc2 = s2; ; sc2++) |
.................... if (*sc2 == '\0') |
.................... return(sc1 - s1); |
.................... else if (*sc1 == *sc2) |
.................... break; |
.................... return(sc1 - s1); |
.................... } |
.................... /* standard template: |
.................... char *strstr(const char *s1, const char *s2); |
.................... Locates first occurence of character sequence s2 in s1; |
.................... returns 0 if s2 is empty string |
.................... |
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the |
.................... file to use the faster algorithm */ |
.................... char *strstr(char *s1, char *s2) |
.................... { |
.................... char *s, *t; |
.................... |
.................... #ifdef FASTER_BUT_MORE_ROM |
.................... if (*s2 == '\0') |
.................... return(s1); |
.................... #endif |
.................... |
.................... while (*s1) |
.................... { |
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t); |
.................... |
.................... if (*t == '\0') |
.................... return s1; |
.................... ++s1; |
.................... #ifdef FASTER_BUT_MORE_ROM |
.................... while(*s1 != '\0' && *s1 != *s2) |
.................... ++s1; |
.................... #endif |
.................... } |
.................... return 0; |
.................... } |
.................... |
.................... /* standard template: char *strtok(char *s1, const char *s2). |
.................... |
.................... Finds next token in s1 delimited by a character from separator |
.................... string s2 (which can be different from call to call). First call |
.................... starts at beginning of s1 searching for first character NOT |
.................... contained in s2; returns 0 if none is found. |
.................... If one is found, it is the start of first token (return value). |
.................... Function then searches from there for a character contained in s2. |
.................... If none is found, current token extends to end of s1, and subsequent |
.................... searches for a token will return 0. If one is found, it is |
.................... overwritten by '\0', which terminates current token. Function saves |
.................... pointer to following character from which next search will start. |
.................... Each subsequent call, with 0 as first argument, starts searching |
.................... from saved pointer */ |
.................... |
.................... char *strtok(char *s1, char *s2) |
.................... { |
.................... char *beg, *end; |
.................... static char *save; |
* |
0366: CLRF 29 |
0367: CLRF 2A |
.................... |
.................... beg = (s1)? s1: save; |
.................... beg += strspn(beg, s2); |
.................... if (*beg == '\0') |
.................... { |
.................... *save = ' '; |
.................... return(0); |
.................... } |
.................... end = strpbrk(beg, s2); |
.................... if (*end != '\0') |
.................... { |
.................... *end = '\0'; |
.................... end++; |
.................... } |
.................... save = end; |
.................... return(beg); |
.................... } |
.................... |
.................... /*****************************************************************/ |
.................... /*Miscellaneous functions*/ |
.................... /* standard template |
.................... maps error number in errnum to an error message string |
.................... Returns: Pointer to string |
.................... */ |
.................... #ifdef _ERRNO |
.................... char * strerror(unsigned int8 errnum) |
.................... { |
.................... char s[15]; |
.................... switch( errnum) |
.................... { |
.................... case 0: |
.................... strcpy(s,"no errors"); |
.................... return s; |
.................... case EDOM : |
.................... strcpy(s,"domain error"); |
.................... return s; |
.................... case ERANGE: |
.................... strcpy(s,"range error"); |
.................... return s; |
.................... } |
.................... } |
.................... #ENDIF |
.................... /* standard template: size_t strlen(const char *s). |
.................... Computes length of s1 (preceding terminating 0) */ |
.................... |
.................... unsigned int8 strlen(char *s) |
.................... { |
.................... char *sc; |
.................... |
.................... for (sc = s; *sc != 0; sc++); |
.................... return(sc - s); |
.................... } |
.................... |
.................... /* standard template: size_t stricmp(const char *s1, const char *s2). |
.................... Compares s1 to s2 ignoring case (upper vs. lower) */ |
.................... |
.................... signed int8 stricmp(char *s1, char *s2) |
.................... { |
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32)); |
.................... s1++, s2++) |
.................... if (*s1 == '\0') |
.................... return(0); |
.................... return((*s1 < *s2) ? -1: 1); |
.................... } |
.................... |
.................... |
.................... /* standard template: char *strlwr(char *s). |
.................... Replaces uppercase letters by lowercase; |
.................... returns pointer to new string s */ |
.................... |
.................... char *strlwr(char *s) |
.................... { |
.................... char *p; |
.................... |
.................... for (p = s; *p != '\0'; p++) |
.................... if (*p >= 'A' && *p <='Z') |
.................... *p += 'a' - 'A'; |
.................... return(s); |
.................... } |
.................... |
.................... |
.................... /************************************************************/ |
.................... |
.................... |
.................... #endif |
.................... |
.................... |
.................... #define LED PIN_E1 |
.................... #define CE PIN_E2 |
.................... |
.................... #define SEL0 PIN_E0 // external counter division ratio |
.................... #define SEL1 PIN_E1 // external counter division ratio |
.................... #define MR PIN_E2 // external counter master reset |
.................... #define CLKI PIN_C0 // internal counter input |
.................... #define BEEP PIN_C3 // buzzer |
.................... |
.................... unsigned int32 count; |
.................... |
.................... |
.................... int8 buffer[0x10]; // I2C buffer |
.................... int8 address; |
.................... |
.................... unsigned int16 of=0; // count of overflow |
.................... |
.................... 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(); |
* |
006D: BSF 03.5 |
006E: BTFSC 14.5 |
006F: GOTO 078 |
0070: BCF 03.5 |
0071: CLRF 42 |
0072: BSF 03.5 |
0073: BTFSS 14.2 |
0074: GOTO 078 |
0075: BCF 03.5 |
0076: BSF 42.7 |
0077: BSF 03.5 |
0078: BCF 03.5 |
0079: MOVF 42,W |
007A: INCF 42,F |
007B: MOVWF 4A |
.................... |
.................... if(state < 0x80) //Master is sending data |
007C: MOVF 4A,W |
007D: SUBLW 7F |
007E: BTFSS 03.0 |
007F: GOTO 0A0 |
.................... { |
.................... incoming = i2c_read(); |
0080: BCF 14.6 |
0081: BTFSS 0C.3 |
0082: GOTO 081 |
0083: MOVF 13,W |
0084: BSF 14.4 |
0085: MOVWF 49 |
.................... if(state == 1) //First received byte is address |
0086: DECFSZ 4A,W |
0087: GOTO 096 |
.................... { |
.................... address = incoming; |
0088: MOVF 49,W |
0089: MOVWF 3F |
.................... if (incoming == 2) |
008A: MOVF 49,W |
008B: SUBLW 02 |
008C: BTFSS 03.2 |
008D: GOTO 096 |
.................... { |
.................... buffer[0]=make8(count,0); |
008E: MOVF 2B,W |
008F: MOVWF 2F |
.................... buffer[1]=make8(count,1); |
0090: MOVF 2C,W |
0091: MOVWF 30 |
.................... buffer[2]=make8(count,2); |
0092: MOVF 2D,W |
0093: MOVWF 31 |
.................... buffer[3]=make8(count,3); |
0094: MOVF 2E,W |
0095: MOVWF 32 |
.................... } |
.................... } |
.................... if(state == 2) //Second received byte is data |
0096: MOVF 4A,W |
0097: SUBLW 02 |
0098: BTFSS 03.2 |
0099: GOTO 0A0 |
.................... buffer[address] = incoming; |
009A: MOVLW 2F |
009B: ADDWF 3F,W |
009C: MOVWF 04 |
009D: BCF 03.7 |
009E: MOVF 49,W |
009F: MOVWF 00 |
.................... |
.................... |
.................... } |
.................... if(state == 0x80) //Master is requesting data |
00A0: MOVF 4A,W |
00A1: SUBLW 80 |
00A2: BTFSS 03.2 |
00A3: GOTO 0B7 |
.................... { |
.................... i2c_write(buffer[address]); |
00A4: MOVLW 2F |
00A5: ADDWF 3F,W |
00A6: MOVWF 04 |
00A7: BCF 03.7 |
00A8: MOVF 00,W |
00A9: MOVWF 4B |
00AA: MOVF 4B,W |
00AB: MOVWF 4C |
.................... } |
.................... } |
.................... |
.................... |
* |
00B7: BCF 0C.3 |
00B8: BCF 0A.3 |
00B9: BCF 0A.4 |
00BA: GOTO 027 |
.................... #int_EXT // Interrupt from 1PPS |
.................... void EXT_isr(void) |
.................... { |
.................... unsigned int16 countH; |
.................... unsigned int8 countL; |
.................... char countS[10], a[4], b[4], c[4]; // strings for printing results |
.................... |
.................... countL=0; |
* |
0145: CLRF 4B |
.................... countH=get_timer1(); // read internal counter |
0146: MOVF 0F,W |
0147: MOVWF 7A |
0148: MOVF 0E,W |
0149: MOVWF 77 |
014A: MOVF 0F,W |
014B: SUBWF 7A,W |
014C: BTFSS 03.2 |
014D: GOTO 146 |
014E: MOVF 77,W |
014F: MOVWF 49 |
0150: MOVF 7A,W |
0151: MOVWF 4A |
.................... output_low(SEL0); |
0152: BSF 03.5 |
0153: BCF 09.0 |
0154: BCF 03.5 |
0155: BCF 09.0 |
.................... output_low(SEL1); |
0156: BSF 03.5 |
0157: BCF 09.1 |
0158: BCF 03.5 |
0159: BCF 09.1 |
.................... countL=input(CLKI); // read bit 0 of external counter |
015A: BSF 28.0 |
015B: MOVF 28,W |
015C: BSF 03.5 |
015D: MOVWF 07 |
015E: BCF 03.5 |
015F: CLRF 4B |
0160: BTFSC 07.0 |
0161: INCF 4B,F |
.................... output_high(SEL0); |
0162: BSF 03.5 |
0163: BCF 09.0 |
0164: BCF 03.5 |
0165: BSF 09.0 |
.................... output_low(SEL1); |
0166: BSF 03.5 |
0167: BCF 09.1 |
0168: BCF 03.5 |
0169: BCF 09.1 |
.................... countL|=input(CLKI)<<1; // read bit 1 of external counter |
016A: BSF 28.0 |
016B: MOVF 28,W |
016C: BSF 03.5 |
016D: MOVWF 07 |
016E: MOVLW 00 |
016F: BCF 03.5 |
0170: BTFSC 07.0 |
0171: MOVLW 01 |
0172: MOVWF 77 |
0173: BCF 03.0 |
0174: RLF 77,F |
0175: MOVF 77,W |
0176: IORWF 4B,F |
.................... output_low(SEL0); |
0177: BSF 03.5 |
0178: BCF 09.0 |
0179: BCF 03.5 |
017A: BCF 09.0 |
.................... output_high(SEL1); |
017B: BSF 03.5 |
017C: BCF 09.1 |
017D: BCF 03.5 |
017E: BSF 09.1 |
.................... countL|=input(CLKI)<<2; // read bit 2 of external counter |
017F: BSF 28.0 |
0180: MOVF 28,W |
0181: BSF 03.5 |
0182: MOVWF 07 |
0183: MOVLW 00 |
0184: BCF 03.5 |
0185: BTFSC 07.0 |
0186: MOVLW 01 |
0187: MOVWF 77 |
0188: RLF 77,F |
0189: RLF 77,F |
018A: MOVLW FC |
018B: ANDWF 77,F |
018C: MOVF 77,W |
018D: IORWF 4B,F |
.................... output_high(SEL0); |
018E: BSF 03.5 |
018F: BCF 09.0 |
0190: BCF 03.5 |
0191: BSF 09.0 |
.................... output_high(SEL1); |
0192: BSF 03.5 |
0193: BCF 09.1 |
0194: BCF 03.5 |
0195: BSF 09.1 |
.................... countL|=input(CLKI)<<3; // read bit 3 of external counter |
0196: BSF 28.0 |
0197: MOVF 28,W |
0198: BSF 03.5 |
0199: MOVWF 07 |
019A: MOVLW 00 |
019B: BCF 03.5 |
019C: BTFSC 07.0 |
019D: MOVLW 01 |
019E: MOVWF 77 |
019F: RLF 77,F |
01A0: RLF 77,F |
01A1: RLF 77,F |
01A2: MOVLW F8 |
01A3: ANDWF 77,F |
01A4: MOVF 77,W |
01A5: IORWF 4B,F |
.................... |
.................... output_low(MR); // External counter Master Reset |
01A6: BSF 03.5 |
01A7: BCF 09.2 |
01A8: BCF 03.5 |
01A9: BCF 09.2 |
.................... output_high(MR); |
01AA: BSF 03.5 |
01AB: BCF 09.2 |
01AC: BCF 03.5 |
01AD: BSF 09.2 |
.................... |
.................... set_timer1(0); // Internal counter reset |
01AE: CLRF 0F |
01AF: CLRF 0E |
.................... |
.................... count=((unsigned int32)of<<20)+((unsigned int32)countH<<4)+(unsigned int32)countL; // concatenate |
01B0: CLRF 65 |
01B1: CLRF 64 |
01B2: MOVF 41,W |
01B3: MOVWF 63 |
01B4: MOVF 40,W |
01B5: MOVWF 62 |
01B6: MOVF 41,W |
01B7: MOVWF 65 |
01B8: MOVF 40,W |
01B9: MOVWF 64 |
01BA: CLRF 62 |
01BB: CLRF 63 |
01BC: RLF 64,F |
01BD: RLF 65,F |
01BE: RLF 64,F |
01BF: RLF 65,F |
01C0: RLF 64,F |
01C1: RLF 65,F |
01C2: RLF 64,F |
01C3: RLF 65,F |
01C4: MOVLW F0 |
01C5: ANDWF 64,F |
01C6: CLRF 6A |
01C7: CLRF 69 |
01C8: RLF 49,W |
01C9: MOVWF 77 |
01CA: RLF 4A,W |
01CB: MOVWF 78 |
01CC: RLF 69,W |
01CD: MOVWF 79 |
01CE: RLF 6A,W |
01CF: MOVWF 7A |
01D0: RLF 77,F |
01D1: RLF 78,F |
01D2: RLF 79,F |
01D3: RLF 7A,F |
01D4: RLF 77,F |
01D5: RLF 78,F |
01D6: RLF 79,F |
01D7: RLF 7A,F |
01D8: RLF 77,F |
01D9: RLF 78,F |
01DA: RLF 79,F |
01DB: RLF 7A,F |
01DC: MOVLW F0 |
01DD: ANDWF 77,F |
01DE: MOVF 77,W |
01DF: ADDWF 62,F |
01E0: MOVF 78,W |
01E1: BTFSC 03.0 |
01E2: INCFSZ 78,W |
01E3: ADDWF 63,F |
01E4: MOVF 79,W |
01E5: BTFSC 03.0 |
01E6: INCFSZ 79,W |
01E7: ADDWF 64,F |
01E8: MOVF 7A,W |
01E9: BTFSC 03.0 |
01EA: INCFSZ 7A,W |
01EB: ADDWF 65,F |
01EC: CLRF 78 |
01ED: CLRF 79 |
01EE: CLRF 7A |
01EF: MOVF 4B,W |
01F0: ADDWF 62,W |
01F1: MOVWF 2B |
01F2: MOVF 63,W |
01F3: MOVWF 2C |
01F4: MOVF 78,W |
01F5: BTFSC 03.0 |
01F6: INCFSZ 78,W |
01F7: ADDWF 2C,F |
01F8: MOVF 64,W |
01F9: MOVWF 2D |
01FA: MOVF 79,W |
01FB: BTFSC 03.0 |
01FC: INCFSZ 79,W |
01FD: ADDWF 2D,F |
01FE: MOVF 65,W |
01FF: MOVWF 2E |
0200: MOVF 7A,W |
0201: BTFSC 03.0 |
0202: INCFSZ 7A,W |
0203: ADDWF 2E,F |
.................... |
.................... sprintf(countS,"%09Lu", count); // engeneering values conversion |
0204: CLRF 44 |
0205: MOVLW 4C |
0206: MOVWF 43 |
0207: MOVLW 49 |
0208: MOVWF 04 |
0209: MOVF 2E,W |
020A: MOVWF 65 |
020B: MOVF 2D,W |
020C: MOVWF 64 |
020D: MOVF 2C,W |
020E: MOVWF 63 |
020F: MOVF 2B,W |
0210: MOVWF 62 |
.................... strncpy(a, countS, 3); a[3]='\0'; |
* |
027A: CLRF 63 |
027B: MOVLW 56 |
027C: MOVWF 62 |
027D: CLRF 65 |
027E: MOVLW 4C |
027F: MOVWF 64 |
0280: MOVLW 03 |
0281: MOVWF 66 |
0282: CALL 101 |
0283: CLRF 59 |
.................... strncpy(b, &countS[3], 3); b[3]='\0'; |
0284: CLRF 63 |
0285: MOVLW 5A |
0286: MOVWF 62 |
0287: CLRF 65 |
0288: MOVLW 4F |
0289: MOVWF 64 |
028A: MOVLW 03 |
028B: MOVWF 66 |
028C: CALL 101 |
028D: CLRF 5D |
.................... strncpy(c, &countS[6], 3); c[3]='\0'; |
028E: CLRF 63 |
028F: MOVLW 5E |
0290: MOVWF 62 |
0291: CLRF 65 |
0292: MOVLW 52 |
0293: MOVWF 64 |
0294: MOVLW 03 |
0295: MOVWF 66 |
0296: CALL 101 |
0297: CLRF 61 |
.................... |
.................... printf("%s\r\n", countS); // output to RS232 |
0298: MOVLW 4C |
0299: MOVWF 04 |
029A: BCF 03.7 |
* |
02B1: MOVLW 0D |
02B2: BTFSS 0C.4 |
02B3: GOTO 2B2 |
02B4: MOVWF 19 |
02B5: MOVLW 0A |
02B6: BTFSS 0C.4 |
02B7: GOTO 2B6 |
02B8: MOVWF 19 |
.................... |
.................... output_toggle(BEEP); // cvak... |
02B9: BCF 28.3 |
02BA: MOVF 28,W |
02BB: BSF 03.5 |
02BC: MOVWF 07 |
02BD: MOVLW 08 |
02BE: BCF 03.5 |
02BF: XORWF 07,F |
.................... |
.................... of=0; // reset overflow counter |
02C0: CLRF 41 |
02C1: CLRF 40 |
.................... } |
.................... |
02C2: BCF 0B.1 |
02C3: BCF 0A.3 |
02C4: BCF 0A.4 |
02C5: GOTO 027 |
.................... #int_TIMER1 // Interrupf from overflow |
.................... void TIMER1_isr(void) |
.................... { |
.................... of++; |
02C6: INCF 40,F |
02C7: BTFSC 03.2 |
02C8: INCF 41,F |
.................... } |
.................... |
.................... |
.................... /*#int_TIMER2 // every 10 ms |
.................... void TIMER2_isr(void) |
.................... { |
.................... output_low(CE); |
.................... count=get_timer1(); |
.................... set_timer1(0); |
.................... output_high(CE); |
.................... }*/ |
.................... |
.................... |
02C9: BCF 0C.0 |
02CA: BCF 0A.3 |
02CB: BCF 0A.4 |
02CC: GOTO 027 |
.................... void main() |
.................... { |
* |
0332: CLRF 04 |
0333: BCF 03.7 |
0334: MOVLW 1F |
0335: ANDWF 03,F |
0336: BSF 03.5 |
0337: BSF 03.6 |
0338: BSF 07.3 |
0339: MOVLW 08 |
033A: BCF 03.6 |
033B: MOVWF 19 |
033C: MOVLW 02 |
033D: MOVWF 1A |
033E: MOVLW A6 |
033F: MOVWF 18 |
0340: MOVLW 90 |
0341: BCF 03.5 |
0342: MOVWF 18 |
0343: BSF 28.3 |
0344: MOVF 28,W |
0345: BSF 03.5 |
0346: MOVWF 07 |
0347: BCF 03.5 |
0348: BSF 28.4 |
0349: MOVF 28,W |
034A: BSF 03.5 |
034B: MOVWF 07 |
034C: MOVLW A0 |
034D: MOVWF 13 |
034E: MOVLW 36 |
034F: BCF 03.5 |
0350: MOVWF 14 |
0351: CLRF 41 |
0352: CLRF 40 |
0353: BSF 03.5 |
0354: BSF 03.6 |
0355: MOVF 09,W |
0356: ANDLW C0 |
0357: MOVWF 09 |
0358: BCF 03.6 |
0359: BCF 1F.4 |
035A: BCF 1F.5 |
035B: MOVLW 00 |
035C: BSF 03.6 |
035D: MOVWF 08 |
035E: BCF 03.5 |
035F: CLRF 07 |
0360: CLRF 08 |
0361: CLRF 09 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
* |
036C: BSF 03.5 |
036D: BSF 03.6 |
036E: MOVF 09,W |
036F: ANDLW C0 |
0370: MOVWF 09 |
0371: BCF 03.6 |
0372: BCF 1F.4 |
0373: BCF 1F.5 |
0374: MOVLW 00 |
0375: BSF 03.6 |
0376: MOVWF 08 |
.................... setup_adc(ADC_OFF); |
0377: BCF 03.5 |
0378: BCF 03.6 |
0379: BCF 1F.0 |
.................... setup_spi(SPI_SS_DISABLED); |
037A: BCF 14.5 |
037B: BCF 28.5 |
037C: MOVF 28,W |
037D: BSF 03.5 |
037E: MOVWF 07 |
037F: BCF 03.5 |
0380: BSF 28.4 |
0381: MOVF 28,W |
0382: BSF 03.5 |
0383: MOVWF 07 |
0384: BCF 03.5 |
0385: BCF 28.3 |
0386: MOVF 28,W |
0387: BSF 03.5 |
0388: MOVWF 07 |
0389: MOVLW 01 |
038A: BCF 03.5 |
038B: MOVWF 14 |
038C: MOVLW 00 |
038D: BSF 03.5 |
038E: MOVWF 14 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
038F: MOVF 01,W |
0390: ANDLW C7 |
0391: IORLW 08 |
0392: MOVWF 01 |
.................... // setup_wdt(WDT_144MS); |
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); |
0393: MOVLW 07 |
0394: BCF 03.5 |
0395: MOVWF 10 |
.................... setup_timer_2(T2_DIV_BY_16,196,16); |
0396: MOVLW 78 |
0397: MOVWF 78 |
0398: IORLW 06 |
0399: MOVWF 12 |
039A: MOVLW C4 |
039B: BSF 03.5 |
039C: MOVWF 12 |
.................... setup_ccp1(CCP_OFF); |
039D: BCF 03.5 |
039E: BSF 28.2 |
039F: MOVF 28,W |
03A0: BSF 03.5 |
03A1: MOVWF 07 |
03A2: BCF 03.5 |
03A3: CLRF 17 |
03A4: BSF 03.5 |
03A5: CLRF 1B |
03A6: CLRF 1C |
03A7: MOVLW 01 |
03A8: MOVWF 1D |
.................... setup_comparator(NC_NC_NC_NC); |
03A9: BCF 03.5 |
03AA: BSF 03.6 |
03AB: CLRF 07 |
03AC: CLRF 08 |
03AD: CLRF 09 |
.................... setup_vref(FALSE); |
03AE: BSF 03.5 |
03AF: BCF 03.6 |
03B0: CLRF 17 |
.................... |
.................... delay_ms(1000); |
03B1: MOVLW 04 |
03B2: BCF 03.5 |
03B3: MOVWF 46 |
03B4: MOVLW FA |
03B5: MOVWF 47 |
03B6: GOTO 2D2 |
03B7: DECFSZ 46,F |
03B8: GOTO 3B4 |
.................... int n; |
.................... for (n=0;n<40;n++) putc(cmd[n]); // setup GPS |
03B9: CLRF 45 |
03BA: MOVF 45,W |
03BB: SUBLW 27 |
03BC: BTFSS 03.0 |
03BD: GOTO 3C5 |
03BE: MOVF 45,W |
03BF: CALL 041 |
03C0: BTFSS 0C.4 |
03C1: GOTO 3C0 |
03C2: MOVWF 19 |
03C3: INCF 45,F |
03C4: GOTO 3BA |
.................... |
.................... printf("cvak...\r\n"); |
03C5: MOVLW CD |
03C6: BSF 03.6 |
03C7: MOVWF 0D |
03C8: MOVLW 02 |
03C9: MOVWF 0F |
03CA: BCF 03.6 |
03CB: GOTO 2E8 |
.................... |
.................... ext_int_edge( L_TO_H ); // set 1PPS active edge |
03CC: BSF 03.5 |
03CD: BSF 01.6 |
.................... enable_interrupts(INT_TIMER1); |
03CE: BSF 0C.0 |
.................... enable_interrupts(INT_EXT); |
03CF: BCF 03.5 |
03D0: BSF 0B.4 |
.................... enable_interrupts(INT_SSP); |
03D1: BSF 03.5 |
03D2: BSF 0C.3 |
.................... // enable_interrupts(INT_TIMER2); |
.................... enable_interrupts(GLOBAL); |
03D3: MOVLW C0 |
03D4: BCF 03.5 |
03D5: IORWF 0B,F |
.................... |
.................... while(true) |
.................... { |
.................... /* output_high(LED); |
.................... delay_ms(999); |
.................... output_low(LED); |
.................... delay_ms(999); |
.................... printf("%X %X %X %X\r\n", buffer[0],buffer[1],buffer[2],buffer[3]); |
.................... */ |
.................... } |
03D6: GOTO 3D6 |
.................... } |
03D7: SLEEP |
Configuration Fuses: |
Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
Word 2: 3FFF NOWRT BORV40 |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.sta |
---|
0,0 → 1,63 |
ROM used: 984 (12%) |
984 (12%) including unused fragments |
1 Average locations per line |
5 Average locations per statement |
RAM used: 43 (12%) at main() level |
96 (26%) worst case |
Stack used: 3 worst case (out of 8 total available) |
Lines Stmts % Files |
----- ----- --- ----- |
151 68 36 main.c |
26 0 0 main.h |
423 0 0 C:\Program Files (x86)\PICC\Devices\16F887.h |
409 121 64 C:\Program Files (x86)\PICC\Drivers\string.h |
28 0 0 C:\Program Files (x86)\PICC\Drivers\stddef.h |
28 0 0 C:\Program Files (x86)\PICC\Drivers\ctype.h |
----- ----- |
1065 189 Total |
Page ROM % RAM Vol Diff Functions: |
---- --- --- --- --- ---- ---------- |
0 22 2 1 @delay_ms1 |
Inline 1 @I2C_WRITE_1 |
0 68 7 10 318 6.5 strncpy |
0 44 4 0 @const169 |
0 78 8 4 592 4.3 ssp_interupt |
0 385 39 35 1383 5.2 EXT_isr |
Inline 1 @SPRINTF |
0 70 7 13 @DIV3232 |
Inline 12 @PRINTF_L32U_184 |
Inline 2 @PSTRINGR_9600_62_63 |
0 7 1 0 17 1.3 TIMER1_isr |
0 166 17 1 601 5.2 MAIN |
0 5 1 0 851 5.3 @const197 |
0 74 8 3 @PSTRINGC7_9600_62_63 |
Program metrics: |
Functions 6 |
Statements 189 |
Comments 262 |
Volume (V) 5169 |
Difficilty (D) 27.7 |
Effort to implement (E) 142931 |
Time to implement (T) 2 hours, 12 minutes |
Est Delivered Bugs (B) 1 |
Cyclomatic Complexity 9 |
Maintainability (MI) 43 |
Segment Used Free |
----------- ---- ---- |
00000-00003 4 0 |
00004-00040 61 0 |
00041-007FF 919 1064 |
00800-00FFF 0 2048 |
01000-017FF 0 2048 |
01800-01FFF 0 2048 |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.sym |
---|
0,0 → 1,173 |
004 @WRITE_PROGRAM_MEMORY8.P1 |
004-005 @READ_PROGRAM_MEMORY8.P2 |
015 CCP_1_LOW |
015 CCP_1 |
016 CCP_1_HIGH |
01B CCP_2 |
01B CCP_2_LOW |
01C CCP_2_HIGH |
020 @INTERRUPT_AREA |
021 @INTERRUPT_AREA |
022 @INTERRUPT_AREA |
023 @INTERRUPT_AREA |
024 @INTERRUPT_AREA |
025 @INTERRUPT_AREA |
026 @INTERRUPT_AREA |
027 rs232_errors |
028 @TRIS_C |
029-02A strtok.save |
02B-02E count |
02F-03E buffer |
03F address |
040-041 of |
042 @I2C_STATE |
043-044 @sprintf_string |
045 MAIN.n |
046 MAIN.@SCRATCH1 |
046 @PSTRINGC7_9600_62_63.@SCRATCH1 |
047 @delay_ms1.P1 |
047 @PSTRINGC7_9600_62_63.@SCRATCH2 |
048 @PSTRINGC7_9600_62_63.@SCRATCH3 |
049 ssp_interupt.incoming |
049-04A EXT_isr.countH |
04A ssp_interupt.state |
04B EXT_isr.countL |
04B ssp_interupt.@SCRATCH1 |
04C-055 EXT_isr.countS |
04C @I2C_WRITE_1.P1 |
04C ssp_interupt.@SCRATCH2 |
056-059 EXT_isr.a |
05A-05D EXT_isr.b |
05E-061 EXT_isr.c |
062-065 @PRINTF_L32U_184.P1 |
062-063 strncpy.s1 |
062 EXT_isr.@SCRATCH1 |
062 @PSTRINGR_9600_62_63.@SCRATCH1 |
063 EXT_isr.@SCRATCH2 |
063 @PSTRINGR_9600_62_63.@SCRATCH2 |
064-065 strncpy.s2 |
064 EXT_isr.@SCRATCH3 |
065 EXT_isr.@SCRATCH4 |
066 strncpy.n |
066 EXT_isr.@SCRATCH5 |
066 @PRINTF_L32U_184.@SCRATCH1 |
067-068 strncpy.s |
067 EXT_isr.@SCRATCH6 |
067 @PRINTF_L32U_184.@SCRATCH2 |
068 EXT_isr.@SCRATCH7 |
068 @PRINTF_L32U_184.@SCRATCH3 |
069 strncpy.@SCRATCH1 |
069 EXT_isr.@SCRATCH8 |
069 @PRINTF_L32U_184.@SCRATCH4 |
06A strncpy.@SCRATCH2 |
06A EXT_isr.@SCRATCH9 |
06A @PRINTF_L32U_184.@SCRATCH5 |
06B strncpy.@SCRATCH3 |
06B EXT_isr.@SCRATCH10 |
06B @PRINTF_L32U_184.@SCRATCH6 |
06C @PRINTF_L32U_184.@SCRATCH7 |
06D @PRINTF_L32U_184.@SCRATCH8 |
06E @SPRINTF.P1 |
06E-071 @DIV3232.P2 |
072-075 @DIV3232.P1 |
077 @SCRATCH |
078 @SCRATCH |
078 _RETURN_ |
079 @SCRATCH |
07A @SCRATCH |
07F @INTERRUPT_AREA |
0A0 @DIV3232.@SCRATCH1 |
0A1 @DIV3232.@SCRATCH2 |
0A2 @DIV3232.@SCRATCH3 |
0A3 @DIV3232.@SCRATCH4 |
0A4 @DIV3232.@SCRATCH5 |
0FF @INTERRUPT_AREA |
107.6 C1OUT |
108.6 C2OUT |
10D-10E @WRITE_PROGRAM_MEMORY8.P1 |
10D-10E @READ_PROGRAM_MEMORY8.P2 |
17F @INTERRUPT_AREA |
1FF @INTERRUPT_AREA |
27F @INTERRUPT_AREA |
2FF @INTERRUPT_AREA |
37F @INTERRUPT_AREA |
3FF @INTERRUPT_AREA |
47F @INTERRUPT_AREA |
4FF @INTERRUPT_AREA |
57F @INTERRUPT_AREA |
5FF @INTERRUPT_AREA |
67F @INTERRUPT_AREA |
6FF @INTERRUPT_AREA |
77F @INTERRUPT_AREA |
7FF @INTERRUPT_AREA |
87F @INTERRUPT_AREA |
8FF @INTERRUPT_AREA |
97F @INTERRUPT_AREA |
9FF @INTERRUPT_AREA |
A7F @INTERRUPT_AREA |
AFF @INTERRUPT_AREA |
B7F @INTERRUPT_AREA |
BFF @INTERRUPT_AREA |
C7F @INTERRUPT_AREA |
CFF @INTERRUPT_AREA |
D7F @INTERRUPT_AREA |
DFF @INTERRUPT_AREA |
E7F @INTERRUPT_AREA |
EFF @INTERRUPT_AREA |
F7F @INTERRUPT_AREA |
FFF @INTERRUPT_AREA |
ROM Allocation: |
02D2 @delay_ms1 |
00AC @I2C_WRITE_1 |
0101 strncpy |
0041 cmd |
006D ssp_interupt |
0145 EXT_isr |
0256 @SPRINTF |
00BB @DIV3232 |
0211 @PRINTF_L32U_184 |
029B @PSTRINGR_9600_62_63 |
02C6 TIMER1_isr |
0332 MAIN |
02CD @const197 |
02E8 @PSTRINGC7_9600_62_63 |
0332 @cinit |
User Memory space: |
User Memory space: |
Project Directory: |
Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\ |
Project Files: |
main.c |
main.h |
C:\Program Files (x86)\PICC\Devices\16F887.h |
C:\Program Files (x86)\PICC\Drivers\string.h |
C:\Program Files (x86)\PICC\Drivers\stddef.h |
C:\Program Files (x86)\PICC\Drivers\ctype.h |
Units: |
Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC16F887\main (main) |
Compiler Settings: |
Processor: PIC16F887 |
Pointer Size: 16 |
ADC Range: 0-255 |
Opt Level: 9 |
Short,Int,Long: UNSIGNED: 1,8,16 |
Float,Double: 32,32 |
Output Files: |
Errors: main.err |
Ext Symbols: main.esym |
INHX8: main.hex |
Symbols: main.sym |
List: main.lst |
Debug/COFF: main.cof |
Project: main.PJT |
Call Tree: main.tre |
Statistics: main.sta |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.tre |
---|
0,0 → 1,18 |
ÀÄmain |
ÃÄMAIN 0/166 Ram=1 |
³ ÃÄ??0?? |
³ ÃÄ@delay_ms1 0/22 Ram=1 |
³ ÃÄ@const169 0/44 Ram=0 |
³ ÀÄ@PSTRINGC7_9600_62_63 0/74 Ram=3 |
ÃÄssp_interupt 0/78 Ram=4 |
³ ÀÄ@I2C_WRITE_1 (Inline) Ram=1 |
ÃÄEXT_isr 0/385 Ram=35 |
³ ÃÄ@PRINTF_L32U_184 (Inline) Ram=12 |
³ ³ ÃÄ@DIV3232 0/70 Ram=13 |
³ ³ ÃÄ@SPRINTF (Inline) Ram=1 |
³ ³ ÀÄ@DIV3232 0/70 Ram=13 |
³ ÃÄstrncpy 0/68 Ram=10 |
³ ÃÄstrncpy 0/68 Ram=10 |
³ ÃÄstrncpy 0/68 Ram=10 |
³ ÀÄ@PSTRINGR_9600_62_63 (Inline) Ram=2 |
ÀÄTIMER1_isr 0/7 Ram=0 |
/Designs/Measuring_instruments/RMDS01C/SW/PIC16F887/main.h |
---|
0,0 → 1,25 |
#include <16F887.h> |
#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) |
#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) |
/Designs/Measuring_instruments/RMDS01C/DOC/SRC/img/Sync_prototype.JPG |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Designs/Measuring_instruments/RMDS01C/DOC/SRC/RMDS.en.tex |
---|
0,0 → 1,131 |
\documentclass[12pt,a4paper,oneside]{article} |
\usepackage[colorlinks=true]{hyperref} |
\usepackage[utf8]{inputenc} |
\usepackage[english]{babel} |
\usepackage{graphicx} |
\usepackage{pdfpages} |
\textwidth 16cm \textheight 25cm |
\topmargin -1.3cm |
\oddsidemargin 0cm |
\pagestyle{empty} |
\begin{document} |
\title{SDR meteor detector} |
\author{Jakub Kákona, kaklik@mlab.cz } |
\maketitle |
\begin{abstract} |
Construction of software defined radio meteor detector with possibility of advanced signal processing. |
\end{abstract} |
\begin{figure} [htbp] |
\begin{center} |
\includegraphics [width=80mm] {./img/meteor_detector_station.JPG} |
\end{center} |
\end{figure} |
\begin{figure} [b] |
\includegraphics [width=25mm] {./img/SDRX01B_QRcode.png} |
\end{figure} |
\newpage |
\tableofcontents |
\section{Technical parameters} |
\begin{table}[htbp] |
\begin{center} |
\begin{tabular}{|c|c|p{5cm}|} |
\hline |
\multicolumn{1}{|c|}{Parameter} & \multicolumn{1}{|c|}{Value} & \multicolumn{1}{|c|}{Note} \\ \hline |
Powering voltage for analogue part & $\pm$12V & 50mA \\ \hline |
Powering voltage for digital part & +5V & 300mA \\ \hline |
Bias of optional LNA & 9V & 500 mA maximum \footnote{Fused by 750mA on the reciver board} \\ \hline |
Frequency range & 0,5 - 200 MHz & Usually working at 143.05 MHz \\ \hline |
Gain & 90dB & Selectable by jumper and LNA configuration \\ \hline |
Self noise number & $<$ 30dB & \\ \hline |
\end{tabular} |
\end{center} |
\end{table} |
\newpage |
\section{Introduction} |
The detection of meteors by radio is most readily accomplished by a method known as "forward scatter". This technique usually exploits the existence of a VHF radio transmitter intended for some other purpose (such as historically analogue radio or TV broadcasting) and which is preferably situated some way beyond the optical horizon so that the direct signal does not desensitise the receiving equipment. The radio signal reflects mainly from the ionised meteor trail as it forms and dissipates, causing a brief signal to be heard on or close to the transmitter frequency. The trails form in the ionosphere (i.e., the upper atmosphere) at a height of about 100 $\pm$ 20 km. |
Direct reflection from the meteoroid itself is not so readily detected. Meteoroids are not necessarily reflective at radio frequencies, they are usually small (0.05 - 200mm) and they generally enter the ionosphere at supersonic velocities. Thus the direct signal is usually weak; and the initial Doppler shift is large, making it difficult to associate the signal with the transmitter. Sometimes however, a Doppler shifted signal is observed to slew onto or across the transmitter frequency at the beginning of the detection event. This is the reflection from the ball of plasma surrounding the meteoroid (as opposed to the trail left behind), and is known as the "head echo". |
The term "radar" is sometimes used to describe the forward scatter detection method. Note however, that 'radar' is an acronym for 'radio direction and ranging' and so, although distance and direction information can be extracted from data aggregated from an array of receivers, a single receiver installation does not constitute a radar system. A single receiver can only strictly report an estimate of the number of meteoroids which enter the ionosphere in the region illuminated by the chosen radio transmitter. Other interesting aspects of the meteor strike can be inferred from the recorded signals, but apparently obvious information, such as the relationship between signal strength and meteoroid mass is complicated by issues such as signal polarisation, trajectory and transmitter coverage. |
One advantage of radio detection is that it works when the sky is light or when the sky is dark but overcast. By choosing a sufficiently powerful host transmitter, it also possible to record meteors which are too faint for the human eye even in the darkest and clearest conditions. A figure of between 2 and 10 times as many meteors as can be seen by visual observation under ideal conditions is sometimes quoted; but this must depend on the transmitter power and radiation pattern. |
\section{Description of construction} |
This construction of radio meteor detector uses France GRAVES space-surveillance radar. The radar has transmitting power of several megawatts at frequency 143.05 MHz. |
\subsection{Antenna} |
The detector station usually uses modified ground plane antenna. Adjusted in angle of 30$^\circ$ to East this configuration seems to be optimal to detecting stations in the Czech Republic. |
\begin{figure} [htbp] |
\begin{center} |
\includegraphics [width=80mm] {./img/GP143MHz.JPG} |
\end{center} |
\caption{Antenna used at detection station} |
\end{figure} |
The received signal from antenna is amplified by specially constructed LNA. This step is needed for feeding the signal trough relative long (several metres) coax RG58. Construction of LNA01A is described on MLAB project site. |
\subsection{SDR receiver} |
The SDR receiver used is MLAB system SDRX01B direct sampling receiver. This receiver has ideal performance for UHF and lower band radioastronomy. So this receiver can be used even for radio meteor detection. |
\begin{figure} [htbp] |
\begin{center} |
\includegraphics [width=80mm] {./img/meteor-detector_receiver.JPG} |
\end{center} |
\caption{Example of meteor detector receiver setup} |
\end{figure} |
\begin{figure} [htbp] |
\begin{center} |
\includegraphics [width=150mm] {./img/zakladni_schema.png} |
\end{center} |
\caption{Schematic drawing of complete meteor detector} |
\end{figure} |
\subsection{Time synchronisation} |
Time synchronisation has crucial importance in any modern science measurement. There is possibility of using many synchronisation techniques. Such as NTP or GPS (see for our article at for our experiences) |
Suggested method for time synchronisation of a measuring station depends on level of desired information which would be obtained from meteor reflection event. |
For example: If we need hour count data only. We can use PC system time without any synchronisation. But if we have one more station and we would like to compare data with another stations then NTP syncing would be good choice. Highest level is trail parameters determination which need true radar signal processing and most precise time synchronisation which could be achieved by GPS receiver. |
\begin{figure}[htbp] |
\begin{center} |
\includegraphics [width=150mm] {./img/colorgram.png} |
\end{center} |
\caption{Example of measured hourly count of meteor showers} |
\end{figure} |
\section{Software setup} |
For simple PC based monitor station we are using SpectrumLab software with our configuration and detection script. |
Local oscillator of SDRX01B is a CLKGEN01B module with frequency tuning controller PIC18F4550v01A can be set up from PC or can be programmed for fixed start up frequency. If fixed start up frequency is correctly saved the only step for tuning the LO is provide power trough USB cable from PC and then press the RESET button of tuning microcomputer module. After that the LO shout be tuned on saved start up frequency. This frequency can be changed by |
\begin{thebibliography}{99} |
\bibitem{Spectrum_lab}{Spectrum Lab} |
\href{http://www.qsl.net/dl4yhf/spectra1.html}{http://www.qsl.net/dl4yhf/spectra1.html} |
\bibitem{Radio_meteor_detection}{Radio Meteor Detection} |
\href{http://www.gb2nlo.org/index.php/articles/meteordet}{http://www.gb2nlo.org/index.php/articles/meteordet} |
\bibitem{meteor_distance}{Meteor distance parameters} |
\href{http://www.amsmeteors.org/richardson/distance.html}{http://www.amsmeteors.org/richardson/distance.html} |
\end{thebibliography} |
\end{document} |
/Designs/Measuring_instruments/RMDS01C/DOC/RMDS.en.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/Designs/Measuring_instruments/RMDS01C/PrjInfo.txt |
---|
0,0 → 1,16 |
[InfoShortDescription.en] |
Radio Meteor Detection Station with GPS |
[InfoShortDescription.cs] |
Stanice pro radiovou detekci meteorů s GPS |
[InfoLongDescription.en] |
Radio meteor trail detection set. It is upgraded by GPS time and frequency synchronization to determining itner-station reflection variation and doppler shift. |
[InfoLongDescription.cs] |
Set pro radiovou detekci meteorů. Je rozšířen o časovou synchronizaci a kmitočtovou stabilizaci LO k určení variací a doplerovského posunu odrazu přijatého několika stanicemi. |
[End] |
/Designs/Measuring_instruments/RMDS01C/meteor_detector_Small.JPG |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |