help with a project in pic16f877

Status
Not open for further replies.

Sara6451

New Member
You need to get a number and according to the received number output a square wave with a different timer
 

Attachments

  • מיקרופרוססורים - pic16f87x - datasheet - 342230 (3).pdf
    3.7 MB · Views: 262
Break the problem into parts.

1) First get the number into a variable, thru GPIO port or UART or I2C or.....
2) Setup a timer to run and toggle a gpio pin to create a square wave, confirm the timer
is running and toggling the GPIO pin. Pick the clock for the timer and set that.
Timer mode setting, triggered or continuous.....
3) Scale the number you received, its range of value, to the timer period range
4) Update timer period with 3)

So you need a variable to hold number received and one for the scaled/translated number
for the timer.

Read the timer portion of manual. How it operates, what registers you need to set
to get it to run. Read that portion at least twice. Do same for GPIO pin & port control.

Decide how you will use timer to signal changing the GPIO pin, using polling or an
interrupt.

Just a few of the steps.....


Regards, Dana.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…