Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Draw the following codes in proteus and include hardware connection maps: There is 2 codes Draw first code with its recused devices in proteus knowing

Draw the following codes in proteus and include hardware connection maps:
There is 2 codes
Draw first code with its recused devices in proteus knowing that it's a code for controlling dc motor speed with LCD display using 16+4221 microcontroller and easy7pic development bored and if you have any adjustments for the code write me the new code with its proteus drawing and also show the hardware connection with the
First code: easy7pic development board .. do the same for the second code knowing it's dc speed control code with 7 segment display draw the proteus and include the hardware connection thank you so much
#include "Icd.h"
sbit LCD_RS at RBO_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB2_bit; sbit LCD_D5 at RB3_bit; sbit LCD_D6 at RB4_bit; sbit LCD_D7 at RB5_bit;
sbit LCD_RS_Direction at TRISBO_bit; sbit LCD_EN_Direction at TRISB1_bit; sbit LCD_D4_Direction at TRISB2_bit; sbit LCD_D5_Direction at TRISB3_bit; sbit LCD_D6_Direction at TRISB4_bit; sbit LCD_D7_Direction at TRISB5_bit;
unsigned int duty_cycle =0;?? PWM duty cycle char txt[16]; // Text buffer for LCD
void setup(){
TRISC =0;?? Set PORTC as output for PWM
TRISD =0FF; // Set PORTD as input for buttons
PORTC =0;
PORTD =0;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"DC Motor Control");
PWM1_Init(5000); // Initialize PWM module at 5kHz
PWM1_Start(); // Start PWM
PWM1_Set_Duty(duty_cycle); // Set initial duty cycle }
void main(){
setup();
while (1){
if (Button(&PORTD, 0,1,1)) Increase speed button duty_cycle +=10; if (duty_cycle >255) duty_cycle =255;
}
if (Button(&PORTD, 1,1,1)){// Decrease speed button duty_cycle -=10; if (duty_cycle 0) duty_cycle =0;
}
if (Button(&PORTD, 2,1,1)){// Change direction button
PORTC.FO =
PORTC.FO; ??? Toggle direction
}
PWM1_Set_Duty(duty_cycle); // Update duty cycle
IntToStr(duty_cycle, txt);
Lcd_Out(2,1, "Speed:");
Lcd_Out(2,7, txt);
if (
PORTC.FO){
Lcd_Out(2,12, "Rev");
} else {
Lcd_Out(2,12,"Fwd");
}
Delay_ms(100);
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started