Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The diagram above shows a 4 bit thumbwheel switch connected to PortC of an PIC18 microcontroller. The wheel is used to dial up a number

image text in transcribed

The diagram above shows a 4 bit thumbwheel switch connected to PortC of an PIC18 microcontroller. The wheel is used to dial up a number 0 9 representing an angle 00 - 90 degrees which is presented to the inputs as a 4 bit binary value. You are required to write a program and subroutines/functions to initialise and operate this interface.

(i) Write a C subroutine to initialise PORTC as needed to interface with the devices.

(ii) Write a C function that checks if the push button is pressed or not, returning 1 if it is pressed or 0 if not pressed. This routine is not to wait for the press.

(iii) Write a C function that reads the thumb wheel switch, returning the angle. (Dont forget there are other pins used on this port)

(iv) Write a C subroutine that sets the LED on or off given a value of 1 or 0. (Dont forget there are other pins used on this port)

(v) Write a C main program that clears the LED, waits for the button to be pressed, sets the LED on, reads the angle set by the thumb wheel switch and saves that value in a variable called angle.

PIC 18 PORTC 4 bit binary value from PCO thumbwheel switch 0000-1001 for values 0-9 decimal Representing 00-90 degrees of PC3 angle in steps of 10. PC5 GND single LED indicator 10K 5V Normally open momentary push PC7 button switch GND

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

3. How effective is the team?

Answered: 1 week ago