Menu

Convert C Codes Assembly Language Using Atmel Studio 7 Const Int Flowsensor 2 Flow Rate Se Q43889284

Convert these C++ codes into assembly language using Atmel Studio 7
const int flowSensor = 2; // Flow rate sensor pinconst int oneB = 7; // OR-Gate IC pinsconst int oneA = 8;const int oneY = 9;const int tempSensor = A3; // Temperature sensor pinvolatile int flowFrequency = 0; // Flow pulseunsigned int flowRate = 0; // Variable for flow rate(L/Hour)unsigned int flowThreshold = 191; // Maximum safe flowrateunsigned long currentTime = 0; // Time since UNO is ONunsigned long cloopTime = 0;bool type = true; // true = Temperature, false = Flowbool output = false; // Output variable for OR-Gate ICint tempVoltage = 0; // Output variable for temperaturesensordouble tempCelcius = 0; // Variable for temperature(degC)double tempThreshold = 28.70; // Maximum safetemperaturevoid flow() {flowFrequency++;} // Interrupt functionvoid temperature() {tempVoltage = analogRead(tempSensor);tempCelcius = tempVoltage * 5; // 5VtempCelcius = tempCelcius / 1024; // 1024 bitstempCelcius = tempCelcius – 0.5; // OffsettempCelcius = tempCelcius * 100; // Temperature value(degC)Serial.print(tempCelcius);Serial.println(” degC”);}void waterFlow() {currentTime = millis();if (currentTime >= (cloopTime + 1000)) {cloopTime = currentTime; // Update cloopTime// Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min.(Results in +/- 3% range)// (Pulse frequency x 60 min) / 7.5Q = flow rate inL/hourflowRate = ((flowFrequency * 60) / 7.5);flowFrequency = 0; // Reset pulse counterSerial.print(flowRate, DEC);Serial.println(” L/hour”);}}void setup() {pinMode(tempSensor, INPUT);pinMode(flowSensor, INPUT);pinMode(oneA, OUTPUT);pinMode(oneB, OUTPUT);Serial.begin(9600); // Begin serial monitorattachInterrupt(0, flow, RISING); // Setup interruptsei(); // Enable interrupt (Set I bit)currentTime = millis(); // Input time since UNO is ONcloopTime = currentTime;}// Parameter check function for temperature and flowrate// Check type: true = temperature, false = flow ratevoid parameterCheck(bool type, double data, double threshold){// Compares the current parameter data with its correspondingthresholdbool parameterExceed = (data >= threshold);if (parameterExceed) {if (type) { // Temperature exceededdigitalWrite(oneB, HIGH);Serial.println(“TEMPERATURE: HIGH”);} else { // Flow rate exceededdigitalWrite(oneA, HIGH);Serial.println(“FLOW : HIGH”);}} else {if (type) { // Normal temperaturedigitalWrite(oneB, LOW);Serial.println(“TEMPERATURE: LOW”);} else { // Normal flow ratedigitalWrite(oneA, LOW);Serial.println(“FLOW : LOW”);}}}void loop() {temperature(); // Input and calculate temperaturewaterFlow(); // Input and calculate flow rateparameterCheck(true, tempCelcius, tempThreshold); // ChecktemperatureparameterCheck(false, flowRate, flowThreshold); // Check flowrateoutput = digitalRead(oneY); // Warning dataif (output) Serial.println(“WARNING”); // (Temperature OR flowrate) = HIGHelse Serial.println(“NORMAL”); // (Temperature OR flow rate) =LOWSerial.println(” “); // Print a blank linedelay(5000); // Next-batch-input delay time}

Expert Answer


Answer to Convert these C++ codes into assembly language using Atmel Studio 7const int flowSensor = 2; // Flow rate sensor pincons…

OR