PIC Microcontrollers: Q1 & Q2 Solutions

  • Thread starter Frisky90
  • Start date
In summary, the conversation discusses using a PIC Microcontroller to control 8 LEDs and generate binary-equivalent numbers, as well as using a switch to switch odd numbered LEDs. The speaker also asks for help with the syntax for reading and writing from ports using C and if it is possible to specify decimal or Hexadecimal numbers in C.
  • #1
Frisky90
19
0
My question is related to PIC Microcontrollers.

Q 1
I have to use port D of the PIC16F917A as an output port and write a simple program to control 8 LEDS to generate the binary-equivalent of the following decimal numbers:

119, 76, 14, 55 & 99

I know how to convert the numbers, but I am not that familiar with the C language.

Q 2
Use a switch as an input to read the status of bit 0 of port A, write a program to switch all odd numbered LEDs (the most right hand LED is number 0) connected to port D, upon detecting the switch closure.
 
Physics news on Phys.org
  • #2
Frisky90 said:
My question is related to PIC Microcontrollers.

Q 1
I have to use port D of the PIC16F917A as an output port and write a simple program to control 8 LEDS to generate the binary-equivalent of the following decimal numbers:

119, 76, 14, 55 & 99

I know how to convert the numbers, but I am not that familiar with the C language.

Q 2
Use a switch as an input to read the status of bit 0 of port A, write a program to switch all odd numbered LEDs (the most right hand LED is number 0) connected to port D, upon detecting the switch closure.

Could you show the syntax for reading and writing from those ports via C for the PIC?

Also, in C, you can specify if the number is decimal or Hexidecimal? Can you check your C book to see if you can find the syntax to use for the two different base designations?
 

What are PIC microcontrollers?

PIC microcontrollers are small electronic devices that are used to control and monitor various systems, such as appliances, electronics, and industrial equipment. They are programmable and can be customized to perform specific tasks.

What are the advantages of using PIC microcontrollers?

Some advantages of using PIC microcontrollers include their low cost, small size, low power consumption, and high processing speed. They also have a wide range of applications and can be easily programmed and reprogrammed for different tasks.

What are the main features of a PIC microcontroller?

The main features of a PIC microcontroller include a central processing unit (CPU), memory, input/output ports, timers, and analog-to-digital converters. They also have built-in features such as serial communication, pulse width modulation, and interrupt handling.

How do I program a PIC microcontroller?

To program a PIC microcontroller, you will need a computer, a PIC programmer, and a programming software. The programming software allows you to write and compile code, which is then transferred to the microcontroller using the programmer. There are also various resources available online to help you learn and program PIC microcontrollers.

What are some common applications of PIC microcontrollers?

PIC microcontrollers are commonly used in a wide range of applications, including consumer electronics, automotive systems, medical devices, industrial control systems, and home automation. They are also popular in educational settings for teaching basic programming and electronics concepts.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Electrical Engineering
Replies
6
Views
1K
  • Electrical Engineering
Replies
10
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
5K
  • Sticky
  • Programming and Computer Science
Replies
13
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
1K
  • Linear and Abstract Algebra
Replies
1
Views
2K
  • Linear and Abstract Algebra
Replies
11
Views
4K
Back
Top