Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for a PIC18F1220. Please use assembly language for this microprocessor.

ID: 2085458 • Letter: T

Question

This is for a PIC18F1220. Please use assembly language for this microprocessor.

You've been hired to implement a PIC-based system for controlling a fish tank. The tank has 2 sensors: one for LOW temperature (connected to pin 17) and one for HIGH temperature (connected to pin 8). It has 4 buttons connected to PORTA which fish can use to request different types of food, along with 4 FOOD DISPENSER mechanisms connected to PORTA The feeding logic works as follows: - when PORTA =1, you should set PORTA to 1 - when P0RTA =1, you should set PORTA to 1 - when PORTA =l, you should set PORTA to 1 - when P0RTA =1, you should set PORTA to 1 (if an input is 0, set the corresponding output to 0) The tank also has a HEATER, which is connected to pin 10. If you output a 1 to the heater, the tank will get warmer: outputting 0 turns the heater off. Your main loop should monitor PORTA and set PORTA accordingly, repeatedly. Additionally, if at any time the LOW temperature sensor outputs 1, you should turn the heater on: if the HIGH temperature sensor outputs 1, you should turn the heater off. This must be done via interrupts. Show complete code for this PIC system, including all initialization, interrupt setup, etc.

Explanation / Answer

sbit LCD_D7 at RB2_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D4 at RB5_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_RS at RB7_bit;

sbit LCD_D7_Direction at TRISB2_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_RS_Direction at TRISB7_bit;
//************************temperature variables****************
int temp;
char temper[7];
//**************************************************************

void READ_temp(void)
{
temp = ADC_Read(0);
temp = temp * 5/1023; temp = temp * 100;

}
void data_converstion(void)
{

inttostr(temp,temper);
}
void display1(void)
{
lcd_out(1,1,"TEMPERATURE=");
lcd_out(1,13, Ltrim(temper));
Lcd_Chr_Cp(0xdf);
Lcd_Chr_Cp('C');
Lcd_Chr_Cp(' ');

}

void main()
{
ADC_Init();
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
lcd_cmd(_LCD_CURSOR_OFF);
lcd_out(1,4,"DIGITAL TEMPERATURE");
lcd_out(2,6,"SENSOR");
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR); // Clear display

while(1)
{

READ_temp();
data_converstion();
display1();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote