

compiletoram

\ A small example for a five channel LED PWM timer tick routine

$29 constant P2OUT

8 variable led-pwm
0 variable led-timer
0 variable led-red
0 variable led-yellow
0 variable led-green
0 variable led-blue
0 variable led-uv

: tick
  push.w r10
  mov.w &led-timer r10
  inc.w r10

  cmp.w &led-pwm r10
  jlo +
  clr.w r10
l+:

  cmp.w &led-red    r10  jlo +  bic.b #%1      &p2out  jmp ++  l+: bis.b #%1     &p2out   l+:
  cmp.w &led-yellow r10  jlo +  bic.b #%10     &p2out  jmp ++  l+: bis.b #%10    &p2out   l+:
  cmp.w &led-green  r10  jlo +  bic.b #%100    &p2out  jmp ++  l+: bis.b #%100   &p2out   l+:
  cmp.w &led-blue   r10  jlo +  bic.b #%1000   &p2out  jmp ++  l+: bis.b #%1000  &p2out   l+:
  cmp.w &led-uv     r10  jlo +  bic.b #%10000  &p2out  jmp ++  l+: bis.b #%10000 &p2out   l+:

  mov.w r10 &led-timer
  pop.w r10
;

