Hello all,

I am very new to microcontroller programing so this is probably a simple question.

I am using an 18F2321 and I want to receive serial data to it using the SERIN2 command. The 18F2321 will receive a number in ASCII format at 1200 baud and I will need to convert it to decimal. I have successfully communicated with a Basic Stamp BS2 using the SERIN command. I just can't figure out why it isn't working in the 18F2321. The code compiles with no errors. My code is below. Thanks for the help.

DEFINE OSC 8
DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2
DEFINE CCP2_REG PORTC
DEFINE CCP2_BIT 1

Pin15 Con 15
Setting VAR Word
MotorState VAR Word
ValveState VAR Word

Main:
SERIN2 Pin15, 17197, 100, Main, [DEC Setting]
SELECT Case Setting
CASE Is < 255
MotorState = Setting
Case 300
ValveState = 0
Case 400
ValveState = 210
Case 500
ValveState = 255
END SELECT
HPWM 1, MotorState, 16000
HPWM 2, ValveState, 8000
Goto Main