-3

I'm completely new to Assembly programming, but unfortunately I must solve a task in a short time using Assembly and PIC16F887.

My task is to move a flashing light on a row of 4 LEDs with a potentiometer. The frequency of the flashing light should be changeable with a rotary encoder between 1Hz to 10Hz with 0,5Hz steps.

I have done a lot of research but I'm still stuck, so every kind of support is welcome.

I was trying to blink an LED, read the rotary encoder and set the blinking frequency based on the reading, then choose the LED output with the potentiometer. I'm not sure if this is right, and the only thing I managed to turn into code was blinking an LED.

Wolf
  • 1
  • 3
  • 4
    if you've `done a lot of research` then please show what you've found and what you've tried – phuclv Jun 22 '18 at 03:39
  • 1
    If you could show me your code I would like to have a look at. If you are looking for some PIC basics maybe www.sprut.de could help – Mike Jun 22 '18 at 05:34

1 Answers1

0

Here are some of the basics that can help you getting started:

  • Be able to read out a rotary encoder (look for a rotary encoder datasheet and learn how it creates it's signals)
  • Create a counter that overflows with the desired frequency.
  • Create a state machine with 4 states and switch states every time the counter overflows. There are other ways to do this.

Have a look here: Youtube or simple assembly or other forum

I do understand that is might seem hard to do but try and break down your problem in stages and do it step by step.

  • Set up your programming environment (MPLAB X)
  • Program the PIC
  • Get every light working
  • Read the rotary encoder
  • Create the timer and just blink the leds for verification
  • Bring it all together
Mike
  • 4,041
  • 6
  • 20
  • 37