A bit more information needed. What chip? ADCON settings? HSERIN/OUT settings?
Is this what you mean (Renamed slightly for clarity in MCS)
GOSUB LCD probably wants to be at end of PROG as first run will show no values.
Code:
A VAR BYTE
B VAR BYTE
C VAR BYTE
D VAR BYTE
E VAR BYTE
X VAR BYTE
PAUSE 900
lcdout $FE,1,"P1 P2 P3 P4"
PROG:
GOSUB LCD
ADCIN 0,A
ADCIN 1,B
ADCIN 2,C
ADCIN 3,D
ADCIN 4,E:X=(E+20)
PAUSEUS 50
hserout ["PC",A,B,C,D,X]
GOTO PROG
LCD:
lcdout $FE,$C0,dec3 A," ",dec3 B," ",dec3 C," ",DEC D," "
pause 200
RETURN
;-------------------------------------------------------------------------
;Wireless receiver
A1 VAR BYTE
B1 VAR BYTE
C1 VAR BYTE
D1 VAR BYTE
E1 VAR BYTE
PROG1:
hSerIn [WAIT("PC"),A1,B1,C1,D1,E1]
if (A1>160) THEN FRE
IF (A1<100) THEN TRA
IF (B1>160) THEN DIR
IF (B1<100) THEN ESQ
pulsout PORTB.0,E1 'SERVO MOTOR
PORTC.0 = 0
PORTC.1 = 0
PORTC.2 = 0
PORTC.3 = 0
PORTC.5 = 0
GOTO PROG1
FRE:
PORTC.0 = 1
PORTC.1 = 0
PORTC.2 = 0
PORTC.3 = 1
PORTC.5 = 1
GOTO PROG1
TRA:
PORTC.0 = 0
PORTC.1 = 1
PORTC.2 = 1
PORTC.3 = 0
PORTC.5 = 1
GOTO PROG1
DIR:
PORTC.0 = 1
PORTC.1 = 0
PORTC.2 = 1
PORTC.3 = 0
PORTC.5 = 1
GOTO PROG1
ESQ:
PORTC.0 = 0
PORTC.1 = 1
PORTC.2 = 0
PORTC.3 = 1
PORTC.5 = 1
GOTO PROG1
Bookmarks