VTech Alphabert s Magic Readport User Manual Page 11

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 10
BM Dept., Govt. Engg. College, Gandhinagar Page 11
Program 3: Write program to read switch connected at port pin P1.0, toggle it and send it to
port pin P1.1.
# include <reg51.h>
sbit input = P1^0; /* Define input pin P1.0*/
sbit output=P1^1; /* Define output pin P1.1*/
void main(void)
{
while(1) //Continuous infinite loop
{
output=~input; //Read input pin, toggle it and send to output
}
}
:: WORKSHEET ::
Exercise:
A. Write C language program to continuously toggle pin P1.0 without disturbing other port
pins.
B. Write C language program to perform OR operation between port pin P1.0 and P1.1.
Display result on port pin P1.2.
Page view 10
1 2 ... 6 7 8 9 10 11 12 13 14 15 16 ... 79 80

Comments to this Manuals

No comments