Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q2(a) You have been asked to develop a PIC MCU assembly-level program for an embedded system using 16F877A to regulate glucose levels in the body
Q2(a) You have been asked to develop a PIC MCU assembly-level program for an embedded system using 16F877A to regulate glucose levels in the body of someone with diabetes by continuously measuring the level of glucose and dispensing doses of insulin based on those measurements. The chemical glucose sensor generates 8-bit digital signal which is read by PORTB of 16F877A. The insulin pump is controlled by a PORTD bit 0. The pump is to be controlled as follows: If the value is greater than or equal to 240 turn on the insulin pump for 5 seconds and then turn off the pump. You can use the delay subroutine below for generating the time delay av seco ; Clock frequency 8 MHz ; Actual delay 5 seconds 10000000 cycles Error-0 % Delay 5sec 9999995 cycles movlw 0x5A movwfd! movlw 0xCD movwfd2 movlw 0x16 movwfd3 Delay.0 decfsz di, f goto $+2 decfsz d2, f goto +2 decfsz d3, f goto Delay 0 5 cycles to $+1 go goto $+1 nop return (a) Construct a flowchart to demonstrate the operation of such a system? (10 marks) (b) Design an assembly language program to implement this system. (10 marks) Q2(a) You have been asked to develop a PIC MCU assembly-level program for an embedded system using 16F877A to regulate glucose levels in the body of someone with diabetes by continuously measuring the level of glucose and dispensing doses of insulin based on those measurements. The chemical glucose sensor generates 8-bit digital signal which is read by PORTB of 16F877A. The insulin pump is controlled by a PORTD bit 0. The pump is to be controlled as follows: If the value is greater than or equal to 240 turn on the insulin pump for 5 seconds and then turn off the pump. You can use the delay subroutine below for generating the time delay av seco ; Clock frequency 8 MHz ; Actual delay 5 seconds 10000000 cycles Error-0 % Delay 5sec 9999995 cycles movlw 0x5A movwfd! movlw 0xCD movwfd2 movlw 0x16 movwfd3 Delay.0 decfsz di, f goto $+2 decfsz d2, f goto +2 decfsz d3, f goto Delay 0 5 cycles to $+1 go goto $+1 nop return (a) Construct a flowchart to demonstrate the operation of such a system? (10 marks) (b) Design an assembly language program to implement this system. (10 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started