Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.59 KB | None | 0 0
  1. pwm_output_set macro output, indfreg, value
  2. if PWM_BYTES == 1        ; shortcut for 8 outputs
  3. if value == 0
  4.     BCF pwm_state, output ; just clear the output
  5. else
  6.     BSF pwm_state, output ; just set the output
  7. endif ; value == 0
  8. else
  9.     MOVLW pwm_state                 ; load pwm_state address into W
  10.     ADDLW output / 8                ; add offset into the array to W
  11.     MOVWF FSR#v(indfreg)            ; load W into FSRx
  12. if value == 0
  13.     BCF INDF#v(indfreg), output & 7 ; clear bit in pwm_state array
  14. else
  15.     BSF INDF#v(indfreg), output & 7 ; set bit in pwm_state array
  16. endif ; value == 0
  17. endif
  18.     endm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement