The document contains questions related to microcontroller programming. Some questions involve turning on and off LEDs using ports and switches, reading and writing data to ports, controlling motors, interfacing with LCD displays, and designing temperature and pressure control systems using sensors. Programming concepts include serial transmission of data bits, stepper motor control, interrupt handling, and interfacing with keypads.
Introduction to Microcontroller PIC16F84A and how to write program for Microcontroller. The program that i use to write is MikroC. You can download this program by:http://eelibrary.wordpress.com
Introduction to Microcontroller PIC16F84A and how to write program for Microcontroller. The program that i use to write is MikroC. You can download this program by:http://eelibrary.wordpress.com
Hobby example; a microcontroller pushed to it's limits; metal lathe spindle sensor for position (accurate to 10 arc-minutes), RPM, #turns, elapsed time.
Hobby example; a microcontroller pushed to it's limits; metal lathe spindle sensor for position (accurate to 10 arc-minutes), RPM, #turns, elapsed time.
This book guides the beginner to start up with Embedded C programming using MP LAB . This Book covers all interfacing examples with pic micro controller and guides beginners to develop projects on PIC micro controller
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
22 Microcontroller Programs
1. 1. ON OFF LED through a switch?
2. ON OFF LED Sequentially with PORTB
3. Display Seven segments from 0 to 9?
4.
5. read data byte on port C and send it on port B?
6. read data byte on portc and send it on portb in inverted form?
7. out a byte of data 0xAA on portb.f0 serially one bit at a time. LSB should go first
continuously?
8. out a byte of data 0x45 on portb.f0 serially one bit at a time MSB should go first
(continuously)?
9. in byte of data on portb .f0 serially one bit a time continuously MSB Should
come first?
10. in a byte of data through Portb.f0 serially one bit at a time LSB should
come first?
11. ON OFF a 220V bulb through a switch?
12. control the direction of DCMOTOR portC through a switch on Portb?
13. move a stepper motor for 30degree?
14. Design a circuit to control the direction of stepper motor [full torque] .
15. write “ kicsit ” On LCD screen use Any port ?
16. write “kicsit” On LCD screen using port b only?
17. Design a program to of Pressure controller using pressure switch.
18. write a program to count the number of Person Entering In a gate, And display
the result on the screen (LCD);
19. Design a temperature control system for furnace. Two temperature switches are
installed in a furnace to measure the hot and cold of furnace
20. Design a interface of keypad and display on LCD.
21. design the interface of stepper motor to control the direction of stepper motor
with Key pad?
22. Design a interface of stepper motor with microcontroller Degree of circular
motion is Entered from keypad and displayed on LCD
2. Assignment No 2 Microcontroller
Page | 1
Q .1 Write a program to ON OFF LED trough a switch?
void main ()
{
trisc.f0=0;
trisb.f0=1;
portc.f0=0;
while(1)
{
if(portb.f0==1)
{
portc.f0=1;
}
else
{
portc.f0=0;
}
}
}
3. Assignment No 2 Microcontroller
Page | 2
Q .2 Write a program to ON OFF LED Sequentially with PORTB.
void main(void)
{
trisb=0x00;
portb=0x00;
while(1)
{
portb.f0=1;
Delay_ms(100);
portb.f0=0;
portb.f1=1;
Delay_ms(100);
portb.f1=0;
portb.f2=1;
Delay_ms(100);
portb.f2=0;
portb.f3=1;
Delay_ms(100);
portb.f3=0;
portb.f4=1;
Delay_ms(100);
portb.f4=0;
portb.f5=1;
Delay_ms(100);
portb.f5=0;
portb.f6=1;
Delay_ms(100);
portb.f6=0;
portb.f7=1;
Delay_ms(100);
portb.f7=0;
}
}
4. Assignment No 2 Microcontroller
Page | 3
Q. 3 write a program to Display Seven segments from 0 to 9?
void main ()
{
unsigned char n[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int i;
trisc=0;
portc=0;
while(1)
{
for(i=0;i<10;i++)
{
portc=n[i];
delay_ms(300);
}
}
}
5. Assignment No 2 Microcontroller
Page | 4
Q5. Write a program to read data byte on port C and send it on port B?
Void main()
{
TRISC=0;
TRISB=1;
While(1){
Portb=portc;
}
}
6. Assignment No 2 Microcontroller
Page | 5
Q6. Write a program to read data byte on portc and send it on portb in inverted form?
Void main()
{
TRISC=0;
TRISB=1;
While(1){
Port B= ~ port C;
}
}
7. Assignment No 2 Microcontroller
Page | 6
Q 7 Write a program to out a byte of data 0xAA on portb.f0 serially one bit at a time.
LSB should go first continuously?
void main ()
{
int i=0;
unsigned char a;
unsigned char x=0xaa;
trisb.f0=0;
portb.f0=0;
a=x;
while(1)
{
portb.f0=a;
delay_ms(200);
a=a>>1;
if(i==8)
{
a=x;
i=0;
}
i=i+1;
}}
8. Assignment No 2 Microcontroller
Page | 7
Q 8 write a program to out a byte of data 0x45 on portb.f0 serially one bit at a time
MSB should go first (continuously)?
void main ()
{
int i=7;
unsigned char a=0x45;
unsigned char x=0x45;
a=x;
trisb.f0=0;
while(1)
{
a=a>>i;
portb.f0=a;
delay_ms(200);
a=x;
i--;
if(i<0)
{
i=7;
}
}
}
Q9 write a program to in byte of data on portb .f0 serially one bit a time continuously
MSB Should come first?
Void main()
{
Unsigned char bitdata;
Int i=0;
TRISB.F0=1;
PORTB.F0=0;
While (i!=8)
{
Bitdata=PORTB.F0;
Bitdata=bitdata<<1;
I++;
}
}
Q10 .write a program to in a byte of data through Portb.f0 serially one bit at a time LSB
should come first?
Void main()
{
TRISB=1;
PORTB=0;
While(i!=8)
{
Bitdata=PORTB.F0; // Lsb come first
Bitdata=Bitdata<<1; //at the end we get inverted form
9. Assignment No 2 Microcontroller
Page | 8
I++;
}
I=0;
Unsigned char temp;
While(i!=8)
{
Temp=Bitdata;
Temp=Temp<<1;
Bitdata=Bitdata>>1;
}
}
Q 11write a program to ON OFF a 220V bulb through a switch?
void main()
{
trisc=0;
portc=0;
trisb.f0=1;
while(1)
{
if(portb.f0==1)
{
portc.f0=1;
}
else
portc.f0=0;
}
}
10. Assignment No 2 Microcontroller
Page | 9
Q 12 writes a program to control the direction of DCMOTOR portC through a switch
on Portb?
#define sw1 portb.f0
#define sw2 portb.f1
#define ON 1
#define OFF 0
void main()
{
TRISB=1;
portb=0;
TRISC=0;
while (1)
{
if(sw1==ON)
{ portc.f3=OFF;
portc.f1=OFF;
Delay_ms(10);
portc.f0=ON;
portc.f2=ON;
delay_ms(200);
}
if(sw2==ON)
{
portc.f0=OFF;
portc.f2=OFF;
delay_ms(10);
portc.f3=ON;
portc.f1=ON;
delay_ms(100);
}
}
}
C0 C1 C2 C3 DIRECTION
1 0 1 0 CLOCKWICE
0 1 0 1 ANTICLOCKWISE
11. Assignment No 2 Microcontroller
Page | 10
Q13 write a program to move a stepper motor for 30degree?
Speciation of stepper motor .1deg/step
Calculation
.1 degree = 1 step
1deg =1/.1 step
30 deg = 30/0.1step => 300 steps 300 / 4 =75
Void main ()
{
trisc=0;
portc=0;
inti,j=0;
unsigned char a[4]={0x01,0x02,0x04,0x08};
while(1)
{
for(i=0;i<75;i++)
{
for(j=0;j<4;j++)
{
portc=a[j];
delay_ms(100);
//portc=0;
}
//portc=0;
}
}
}
12. Assignment No 2 Microcontroller
Page | 11
Q14 Design a circuit to control the direction of stepper motor [full torque] .
void step(unsigned char x)
{
portc=x;
delay_ms(200);
//portc=0x00;
}
void step1(unsigned char y)
{
portc=y;
delay_ms(200);
//portc=0x00;
}
void main()
{
unsigned char n[4]= {0x01,0x02,0x04,0x08};
unsigned char u[4]= {0x08,0x04,0x02,0x01};
unsignedinti,j,k,l;
trisc=0;
portc=0;
while(1){
for(i=1; i<5; i++)
13. Assignment No 2 Microcontroller
Page | 12
{
for(j=0; j<4; j++)
{
step(n[j]);
}
}
delay_ms(100);
portc=0;
for(k=1; k<5; k++)
{
for(l=0; l<4; l++)
{
step1(u[l]);
}
}
}
}
Q15 write a program to write “ kicsit ” On LCD screen use Any port ?
#define datalineportd
#define rs portc.f0
#define e portc.f1
void command(unsigned char x)
{
e=0;
rs=0;
dataline=x;
e=1;
15. Assignment No 2 Microcontroller
Page | 14
command(0x87);
data('D');
command(0x88);
data('O');
command(0x89);
data('N');
}
}
Q 16 writes a program to write “kicsit” On LCD screen using port b only?
[We solve it through command]
void main(void)
{
TRISD=0x00;
LCD_Init(&PORTD);
Lcd_Cmd(Lcd_Clear);
Lcd_Out(1,1,"KICSIT");
While(1){
}
}
Q 17 Design a program to of Pressure controller using pressure switch.
Specification of Pressure switch
100 baar =break (OFF =0)
50 baar =Make (ON 1)
sbit LCD_RS at RD3_bit;
sbit LCD_EN at RD2_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;
// Pin direction
sbitLCD_RS_Direction at TRISD3_bit;
sbitLCD_EN_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD7_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD4_bit;
int flag=0;
void interrupt(void);
void main() {
char key;
INTCON=0x90;
//INTCON3=0x08;
INTCON2.INTEDG0=1;
17. Assignment No 2 Microcontroller
Page | 16
Q18 write a program to count the number of Person Entering In a gate, And display
the result on the screen (LCD);
sbit LCD_RS at RD3_bit;
sbit LCD_EN at RD2_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;
// Pin direction
sbitLCD_RS_Direction at TRISD3_bit;
sbitLCD_EN_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD7_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD4_bit;
int count=0;
charscount[10];
void interrupt(void);
void main() {
char key;
INTCON=0x90;
INTCON2.INTEDG0=1;
TRISB=0X0F;
//TRISC=0X00;
//trisd=0;
//TRISC=0;
Lcd_Init();
//Lcd_Out(1,4,"Well Come");
18. Assignment No 2 Microcontroller
Page | 17
while(1)
{
}
}
void interrupt(void)
{
if(INTCON.INT0IF)
{
count++;
IntToStr(count,scount);
Lcd_Out(1,1,"Count =");
Lcd_Out(2,4,scount );
INTCON.INT0IF=0;
// PORTC.F0=~PORTC.F0;
}
}
Q19 Design a temperature control system for furnace. Two temperature switches are
installed in a furnace to measure the hot and cold of furnace
HOT>100 output = 1;
Cold<35 output=1;
sbit LCD_RS at RD3_bit;
sbit LCD_EN at RD2_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;
// Pin direction
sbitLCD_RS_Direction at TRISD3_bit;
sbitLCD_EN_Direction at TRISD2_bit;
20. Assignment No 2 Microcontroller
Page | 19
Q20 Design a interface of keypad and display on LCD.
Q21 design the interface of stepper motor to control the direction of stepper
motor with Key pad?
1 > Anticlockwise
2> Clockwise
sbit LCD_RS at RD3_bit;
sbit LCD_EN at RD2_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;
// Pin direction
sbitLCD_RS_Direction at TRISD3_bit;
sbitLCD_EN_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD7_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD4_bit;
clockmotor();
void main() {
char key;
TRISB=0XF0;
TRISC=0X00;
trisd=0;
Lcd_Init();
Lcd_Out(1,4,"Well Come");
//Lcd_Out(2,1,"Press Any Key");