My code:

INCLUDE "modedefs.bas" 'include serout defines
DEFINE OSC 4

TRISB =%00000001 'port b=output except pin 1 (RX) is input
TRISC = %10111000 ' set output for pwm portc.2

RX var word
RY var word
RZ var word
temp var word

CCP1CON = %00001111 'turns PWM mode on, clears lowest two bits of duty cycle

high PORTB.2

main:
PIE1.5 = 1
INTCON = %11000000
ON INTERRUPT GoTo handler

'-------- interrupt start --------'

disable
handler:
serin PORTB.0, T2400, RX, RY, RZ 'Receive menu number
if (RX != "1") AND (RY != "2") and (RZ!= "7") then error
RX = RX - $30
RY = RY - $30
RZ = RZ - $30
temp=(RX*100)+(RY*10)+(RZ*1)
gosub speed

speed: pwm PORTC.1,temp,100
serout PORTB.1,T2400,[#temp,100]
resume
enable

ERROR: RX = RX - $30
RY = RY - $30
RZ = RZ - $30
temp=(RX*100)+(RY*10)+(RZ*1)
clear
gosub speed