Hi there,
i have written the following code for a joystick 16f84 rf remote control for my bot, and i am having so trouble! I DO NOT KNOW WHY THIS ISN'T COMPILING?
Here is the code, please reply if you can help me out.
;"SmartBot Joystick Transmitter Program - Written By Daniel"
;This program allows the Smartbot to be controlled remotely
;through the use of a computer joystick and a RF Transmitter Module.
;
;The joystick's x-axis and y-axis pot's are connected to port b pins
;as shown on the pin outline diagram below.
;The pins are connected to the variable resistor and then from there,
;to a capacitor and finally ground.
;
;Pin A.1 is connected to the input pin of a transmitter module. Where
;the position data is sent to the reciever.
;
;PIN OUTLINE FOR I/O PORT B
;
;PORTB.0 - Joystick X-axis Input
;PORTA.1 - Position output to Transmitter Module
;PORTB.2 - Joystick Y-axis Input
LIST P=16F84, R=DEC ; 16F84 Runs at 4 MHz
errorlevel 0,-305
INCLUDE "p16f84.inc"
MOVLW TRISB ;port b all pins input
CLRF TRISA ;port a all outputs
CLRF PORTA
#DEFINE IN1 PORTB,0
#DEFINE OUT1 PORTA,1
#DEFINE IN2 PORTB,2
start:
POT IN1,50,8H
POT IN2,50,9H
Y = 8H * 5
X = 9H * 5
if Y < 100
goto fy
if Y > 150
goto by
if X < 100
goto rx
if X > 150
goto lx
serout A1,n9600,(5)
goto start
fy:
serout A1,n9600,(2)
goto start
by:
serout A1,n9600,(1)
goto start
lx:
serout A1,n9600,(3)
goto start
rx:
serout A1,n9600,(4)
goto start
end