⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.mil

📁 Firmware that controls a sliding door via a GSM modem (Open and Close the door)
💻 MIL
📖 第 1 页 / 共 3 页
字号:
	CALL _Delay250ms
//main.c,244 :: 		data = '7';
	read_keypad_data_L0 <- 55
//main.c,245 :: 		}
L_read_keypad_51:
//main.c,246 :: 		if (row4)
	if (!PORTD) then goto L_read_keypad_52
//main.c,248 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,249 :: 		data = '*';
	read_keypad_data_L0 <- 42
//main.c,250 :: 		}
L_read_keypad_52:
//main.c,251 :: 		column1 = 0;
	PORTC <-  PORTC & -17
//main.c,252 :: 		column2 = 1;
	PORTD <-  PORTD | 8
//main.c,253 :: 		if (row1)
	if (!PORTD) then goto L_read_keypad_53
//main.c,255 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,256 :: 		data = '2';
	read_keypad_data_L0 <- 50
//main.c,257 :: 		}
L_read_keypad_53:
//main.c,258 :: 		if (row2)
	if (!PORTD) then goto L_read_keypad_54
//main.c,260 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,261 :: 		data = '5';
	read_keypad_data_L0 <- 53
//main.c,262 :: 		}
L_read_keypad_54:
//main.c,263 :: 		if (row3)
	if (!PORTD) then goto L_read_keypad_55
//main.c,265 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,266 :: 		data = '8';
	read_keypad_data_L0 <- 56
//main.c,267 :: 		}
L_read_keypad_55:
//main.c,268 :: 		if (row4)
	if (!PORTD) then goto L_read_keypad_56
//main.c,270 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,271 :: 		data = '0';
	read_keypad_data_L0 <- 48
//main.c,272 :: 		}
L_read_keypad_56:
//main.c,273 :: 		column2 = 0;
	PORTD <-  PORTD & -9
//main.c,274 :: 		column3 = 1;
	PORTC <-  PORTC | 32
//main.c,275 :: 		if (row1)
	if (!PORTD) then goto L_read_keypad_57
//main.c,277 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,278 :: 		data = '3';
	read_keypad_data_L0 <- 51
//main.c,279 :: 		}
L_read_keypad_57:
//main.c,280 :: 		if (row2)
	if (!PORTD) then goto L_read_keypad_58
//main.c,282 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,283 :: 		data = '6';
	read_keypad_data_L0 <- 54
//main.c,284 :: 		}
L_read_keypad_58:
//main.c,285 :: 		if (row3)
	if (!PORTD) then goto L_read_keypad_59
//main.c,287 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,288 :: 		return '9';
	STACK_0 <- 57
	return
//main.c,289 :: 		}
L_read_keypad_59:
//main.c,290 :: 		if (row4)
	if (!PORTD) then goto L_read_keypad_60
//main.c,292 :: 		Delay250ms();
	CALL _Delay250ms
//main.c,293 :: 		data = '#';
	read_keypad_data_L0 <- 35
//main.c,294 :: 		}
L_read_keypad_60:
//main.c,295 :: 		column3 = 0;
	PORTC <-  PORTC & -33
//main.c,296 :: 		return data;
	STACK_0 <- read_keypad_data_L0
	return
  end

_compare_codes:
  begin
//main.c,301 :: 		if (password[0] != temp_password[0])
	if ( _password = _temp_password) then goto L_compare_codes_61
//main.c,303 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,304 :: 		}
L_compare_codes_61:
//main.c,305 :: 		if (password[1] != temp_password[1])
	if ( _password+1 = _temp_password+1) then goto L_compare_codes_62
//main.c,307 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,308 :: 		}
L_compare_codes_62:
//main.c,309 :: 		if (password[2] != temp_password[2])
	if ( _password+2 = _temp_password+2) then goto L_compare_codes_63
//main.c,311 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,312 :: 		}
L_compare_codes_63:
//main.c,313 :: 		if (password[3] != temp_password[3])
	if ( _password+3 = _temp_password+3) then goto L_compare_codes_64
//main.c,315 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,316 :: 		}
L_compare_codes_64:
//main.c,317 :: 		if (password[4] != temp_password[4])
	if ( _password+4 = _temp_password+4) then goto L_compare_codes_65
//main.c,319 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,320 :: 		}
L_compare_codes_65:
//main.c,321 :: 		if (password[5] != temp_password[5])
	if ( _password+5 = _temp_password+5) then goto L_compare_codes_66
//main.c,323 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,324 :: 		}
L_compare_codes_66:
//main.c,325 :: 		return 1;
	STACK_0 <- 1
	return
  end

_compare_with_open_command:
  begin
//main.c,330 :: 		if (message_buffer[55] != '/')
	if ( _message_buffer+55 = 47) then goto L_compare_with_open_command_67
//main.c,332 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,333 :: 		}
L_compare_with_open_command_67:
//main.c,335 :: 		if (message_buffer[56] != 'O')
	if ( _message_buffer+56 = 79) then goto L_compare_with_open_command_68
//main.c,337 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,338 :: 		}
L_compare_with_open_command_68:
//main.c,339 :: 		if (message_buffer[57] != 'P')
	if ( _message_buffer+57 = 80) then goto L_compare_with_open_command_69
//main.c,341 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,342 :: 		}
L_compare_with_open_command_69:
//main.c,343 :: 		if (message_buffer[58] != 'E')
	if ( _message_buffer+58 = 69) then goto L_compare_with_open_command_70
//main.c,345 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,346 :: 		}
L_compare_with_open_command_70:
//main.c,347 :: 		if (message_buffer[59] != 'N')
	if ( _message_buffer+59 = 78) then goto L_compare_with_open_command_71
//main.c,349 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,350 :: 		}
L_compare_with_open_command_71:
//main.c,351 :: 		if (message_buffer[60] != carriage_return)
	if ( _message_buffer+60 = 13) then goto L_compare_with_open_command_72
//main.c,353 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,354 :: 		}
L_compare_with_open_command_72:
//main.c,355 :: 		if (message_buffer[61] != line_feed)
	if ( _message_buffer+61 = 10) then goto L_compare_with_open_command_73
//main.c,357 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,358 :: 		}
L_compare_with_open_command_73:
//main.c,359 :: 		return 1;
	STACK_0 <- 1
	return
  end

_compare_with_close_command:
  begin
//main.c,364 :: 		if (message_buffer[55] != '/')
	if ( _message_buffer+55 = 47) then goto L_compare_with_close_command_74
//main.c,366 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,367 :: 		}
L_compare_with_close_command_74:
//main.c,368 :: 		if (message_buffer[56] != 'C')
	if ( _message_buffer+56 = 67) then goto L_compare_with_close_command_75
//main.c,370 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,371 :: 		}
L_compare_with_close_command_75:
//main.c,372 :: 		if (message_buffer[57] != 'L')
	if ( _message_buffer+57 = 76) then goto L_compare_with_close_command_76
//main.c,374 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,375 :: 		}
L_compare_with_close_command_76:
//main.c,376 :: 		if (message_buffer[58] != 'O')
	if ( _message_buffer+58 = 79) then goto L_compare_with_close_command_77
//main.c,378 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,379 :: 		}
L_compare_with_close_command_77:
//main.c,380 :: 		if (message_buffer[59] != 'S')
	if ( _message_buffer+59 = 83) then goto L_compare_with_close_command_78
//main.c,382 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,383 :: 		}
L_compare_with_close_command_78:
//main.c,384 :: 		if (message_buffer[60] != 'E')
	if ( _message_buffer+60 = 69) then goto L_compare_with_close_command_79
//main.c,386 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,387 :: 		}
L_compare_with_close_command_79:
//main.c,388 :: 		if (message_buffer[61] != carriage_return)
	if ( _message_buffer+61 = 13) then goto L_compare_with_close_command_80
//main.c,390 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,391 :: 		}
L_compare_with_close_command_80:
//main.c,392 :: 		if (message_buffer[62] != line_feed)
	if ( _message_buffer+62 = 10) then goto L_compare_with_close_command_81
//main.c,394 :: 		return 0;
	STACK_0 <- 0
	return
//main.c,395 :: 		}
L_compare_with_close_command_81:
//main.c,396 :: 		return 1;
	STACK_0 <- 1
	return
  end

_get_imbedded_password:
  begin
//main.c,402 :: 		address = 0xF8;
	get_imbedded_password_address_L0 <- 248
//main.c,403 :: 		byte_count1 = 0;
	_byte_count1 <- 0
//main.c,404 :: 		while (byte_count1 < 6)
L_get_imbedded_password_82:
	if ( _byte_count1 >= 6) then goto L_get_imbedded_password_83
//main.c,406 :: 		password[byte_count1] = EEprom_Read(address);
	FLOC_get_imbedded_password+1 <-  0 + _byte_count1
	FARG_EEprom_read+0 <- get_imbedded_password_address_L0
	CALL _EEprom_read
	*FLOC_get_imbedded_password+1 <- STACK_0
//main.c,407 :: 		byte_count1++;
	_byte_count1 <-  _byte_count1 + 1
	_byte_count1 <- _byte_count1
//main.c,408 :: 		address++;
	get_imbedded_password_address_L0 <-  get_imbedded_password_address_L0 + 1
	get_imbedded_password_address_L0 <- get_imbedded_password_address_L0
//main.c,409 :: 		}
	goto	L_get_imbedded_password_82
L_get_imbedded_password_83:
  end

_save_password:
  begin
//main.c,415 :: 		address = 0xF8;
	save_password_address_L0 <- 248
//main.c,416 :: 		byte_count1 = 0;
	_byte_count1 <- 0
//main.c,417 :: 		while (byte_count1 < 6)
L_save_password_84:
	if ( _byte_count1 >= 6) then goto L_save_password_85
//main.c,419 :: 		EEprom_Write (address,password[byte_count1]);
	FARG_EEprom_write+0 <- save_password_address_L0
	FSR <-  0 + _byte_count1
	FARG_EEprom_write+1 <- *FSR
	FARG_EEprom_write+1 <- FARG_EEprom_write+1
	CALL _EEprom_write
//main.c,420 :: 		byte_count1++;
	_byte_count1 <-  _byte_count1 + 1
	_byte_count1 <- _byte_count1
//main.c,421 :: 		address++;
	save_password_address_L0 <-  save_password_address_L0 + 1
	save_password_address_L0 <- save_password_address_L0
//main.c,422 :: 		}
	goto	L_save_password_84
L_save_password_85:
  end

_offset_message:
  begin
//main.c,428 :: 		column = 1;
	offset_message_column_L0 <- 1
//main.c,429 :: 		while (column < 17)
L_offset_message_86:
	if ( offset_message_column_L0 >= 17) then goto L_offset_message_87
//main.c,431 :: 		buffer = EEprom_Read(location);
	FARG_EEprom_read+0 <- FARG_offset_message+1
	CALL _EEprom_read
	_buffer <- STACK_0
//main.c,432 :: 		LCD_Chr(row,column,buffer);
	FARG_Lcd_Chr+0 <- FARG_offset_message+0
	FARG_Lcd_Chr+1 <- offset_message_column_L0
	FARG_Lcd_Chr+2 <- STACK_0
	CALL _Lcd_Chr
//main.c,433 :: 		location++;
	FARG_offset_message+1 <-  FARG_offset_message+1 + 1
	FARG_offset_message+1 <- FARG_offset_message+1
//main.c,434 :: 		column++;
	offset_message_column_L0 <-  offset_message_column_L0 + 1
	offset_message_column_L0 <- offset_message_column_L0
//main.c,435 :: 		}
	goto	L_offset_message_86
L_offset_message_87:
  end

_motor_delay:
  begin
//main.c,441 :: 		Delay_ms(15);
	asm: MOVLW	20
	asm: MOVWF	STACK_11
	asm: MOVLW	255
	asm: MOVWF	STACK_10
	asm: DECFSZ	STACK_11,F
	asm: GOTO	$+2
	asm: GOTO	$+4
	asm: DECFSZ	STACK_10,F
	asm: GOTO	$-1
	asm: GOTO	$-5
	asm: MOVLW	108
	asm: MOVWF	STACK_10
	asm: DECFSZ	STACK_10,F
	asm: GOTO	$-1
	asm: nop
	asm: nop
  end

_rotate2:
  begin
//main.c,446 :: 		step_A = 1;
	PORTA <-  PORTA | 1
//main.c,447 :: 		motor_delay();
	CALL _motor_delay
//main.c,448 :: 		step_A = 0;
	PORTA <-  PORTA & -2
//main.c,449 :: 		step_B = 1;
	PORTA <-  PORTA | 2
//main.c,450 :: 		motor_delay();
	CALL _motor_delay
//main.c,451 :: 		step_B = 0;
	PORTA <-  PORTA & -3
//main.c,452 :: 		step_C = 1;
	PORTE <-  PORTE | 1
//main.c,453 :: 		motor_delay();
	CALL _motor_delay
//main.c,454 :: 		step_C = 0;
	PORTE <-  PORTE & -2
//main.c,455 :: 		step_D = 1;
	PORTE <-  PORTE | 2
//main.c,456 :: 		motor_delay();
	CALL _motor_delay
//main.c,457 :: 		step_D = 0;
	PORTE <-  PORTE & -3
  end

_rotate1:
  begin
//main.c,462 :: 		step_D = 1;
	PORTE <-  PORTE | 2
//main.c,463 :: 		motor_delay();
	CALL _motor_delay
//main.c,464 :: 		step_D = 0;
	PORTE <-  PORTE & -3
//main.c,465 :: 		step_C = 1;
	PORTE <-  PORTE | 1
//main.c,466 :: 		motor_delay();
	CALL _motor_delay
//main.c,467 :: 		step_C = 0;
	PORTE <-  PORTE & -2
//main.c,468 :: 		step_B = 1;
	PORTA <-  PORTA | 2
//main.c,469 :: 		motor_delay();
	CALL _motor_delay
//main.c,470 :: 		step_B = 0;
	PORTA <-  PORTA & -3
//main.c,471 :: 		step_A = 1;
	PORTA <-  PORTA | 1
//main.c,472 :: 		motor_delay();
	CALL _motor_delay
//main.c,473 :: 		step_A = 0;
	PORTA <-  PORTA & -2
  end

_open_door:
  begin
//main.c,479 :: 		offset_message(1,0x40);
	FARG_offset_message+0 <- 1
	FARG_offset_message+1 <- 64
	CALL _offset_message
//main.c,480 :: 		solenoid = 1;
	PORTD <-  PORTD | 2
//main.c,481 :: 		delay1s();
	CALL _Delay1s
//main.c,482 :: 		step_count = 25;
	open_door_step_count_L0 <- 25
//main.c,483 :: 		while (step_count > 0)
L_open_door_88:
	if ( open_door_step_count_L0 <= 0) then goto L_open_door_89
//main.c,485 :: 		rotate1();
	CALL _rotate1
//main.c,486 :: 		step_count--;
	open_door_step_count_L0 <-  open_door_step_count_L0 - 1
	open_door_step_count_L0 <- open_door_step_count_L0
//main.c,488 :: 		}
	goto	L_open_door_88
L_open_door_89:
//main.c,489 :: 		solenoid = 0;
	PORTD <-  PORTD & -3
//main.c,490 :: 		step_count = 150;
	open_door_step_count_L0 <- 150
//main.c,491 :: 		while (step_count > 0)
L_open_door_90:
	if ( open_door_step_count_L0 <= 0) then goto L_open_door_91
//main.c,493 :: 		rotate1();
	CALL _rotate1
//main.c,494 :: 		step_count--;
	open_door_step_count_L0 <-  open_door_step_count_L0 - 1
	open_door_step_count_L0 <- open_door_step_count_L0
//main.c,495 :: 		}
	goto	L_open_door_90
L_open_door_91:
//main.c,496 :: 		offset_message(1,0x60);
	FARG_offset_message+0 <- 1
	FARG_offset_message+1 <- 96
	CALL _offset_message
//main.c,497 :: 		Delay1s();
	CALL _Delay1s
//main.c,498 :: 		Delay1s();
	CALL _Delay1s
//main.c,499 :: 		Delay1s();
	CALL _Delay1s
  end

_close_door:
  begin
//main.c,505 :: 		offset_message(1,0x50);
	FARG_offset_message+0 <- 1
	FARG_offset_message+1 <- 80
	CALL _offset_message
//main.c,506 :: 		step_count = 150;
	close_door_step_count_L0 <- 150
//main.c,507 :: 		while (step_count > 0)
L_close_door_92:
	if ( close_door_step_count_L0 <= 0) then goto L_close_door_93
//main.c,509 :: 		rotate2();
	CALL _rotate2
//main.c,510 :: 		step_count--;
	close_door_step_count_L0 <-  close_door_step_count_L0 - 1
	close_door_step_count_L0 <- close_door_step_count_L0
//main.c,511 :: 		}
	goto	L_close_door_92
L_close_door_93:
//main.c,512 :: 		solenoid = 1;
	PORTD <-  PORTD | 2
//main.c,513 :: 		step_count = 28;
	close_door_step_count_L0 <- 28
//main.c,514 :: 		while (step_count > 0)
L_close_door_94:
	if ( close_door_step_count_L0 <= 0) then goto L_close_door_95
//main.c,516 :: 		rotate2();
	CALL _rotate2
//main.c,517 :: 		step_count--;
	close_door_step_count_L0 <-  close_door_step_count_L0 - 1
	close_door_step_count_L0 <- close_door_step_count_L0
//main.c,518 :: 		}
	goto	L_close_door_94
L_close_door_95:
//main.c,519 :: 		solenoid = 0;
	PORTD <-  PORTD & -3
//main.c,520 :: 		offset_message(1,0x70);
	FARG_offset_message+0 <- 1
	FARG_offset_message+1 <- 112
	CALL _offset_message
//main.c,521 :: 		Delay1s();
	CALL _Delay1s
//main.c,522 :: 		Delay1s();
	CALL _Delay1s
//main.c,523 :: 		Delay1s();
	CALL _Delay1s
  end

_main:
  begin
//main.c,528 :: 		TRISA = 0;
	TRISA <- 0
//main.c,529 :: 		TRISB = 0;
	TRISB <- 0
//main.c,530 :: 		TRISC = 0;
	TRISC <- 0
//main.c,531 :: 		TRISE = 0;
	TRISE <- 0
//main.c,532 :: 		TRISD = 0xf4;
	TRISD <- 244
//main.c,533 :: 		PORTA = 0;
	PORTA <- 0
//main.c,534 :: 		PORTB = 0;
	PORTB <- 0
//main.c,535 :: 		PORTC = 0;
	PORTC <- 0
//main.c,536 :: 		PORTD = 0;
	PORTD <- 0
//main.c,537 :: 		PORTE = 0;
	PORTE <- 0
//main.c,538 :: 		solenoid = 0;
	PORTD <-  PORTD & -3
//main.c,539 :: 		PIE1.RCIE = 1;
	PIE1 <-  PIE1 | 32
//main.c,540 :: 		Delay1s();
	CALL _Delay1s
//main.c,541 :: 		Delay1s();
	CALL _Delay1s
//main.c,542 :: 		Usart_Init(9600);
	SPBRG <- 25
	asm: BSF	TXSTA, BRGH
	CALL _Usart_Init
//main.c,543 :: 		LCD_Init(&PORTB);
	FARG_Lcd_Init+0 <- 0
	CALL _Lcd_Init
//main.c,544 :: 		LCD_Cmd(LCD_CLEAR);
	FARG_Lcd_Cmd+0 <- 1
	CALL _Lcd_Cmd
//main.c,545 :: 		LCD_Cmd(LCD_CURSOR_OFF);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -