PIC Microcontrollers: Q1 & Q2 Solutions

  • Thread starter Thread starter Frisky90
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Frisky90
Messages
18
Reaction score
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
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?