PDA

View Full Version : HSERIN with a WAIT



mel4853
- 28th January 2013, 00:37
Trying to get 3 different HSERIN to work. The 3 different ones come in at different times & will never effect the other.If I put the wait statements in there nothing happens, take the first one out & I pull in all 9 DEC4. Am I using this wrong?Using a PIC16F690


define OSC 4
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
include "ReEnterPBP.bas"
@ ERRORLEVEL -306 ; turn off crossing page boundary message

'-----------------------Enable EUSART------------------------------------
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 51 ' 4800 Baud @ 4MHz, 0.17%
SPBRGH = 0
BAUDCTL.3 = 1 ' Enable 16 bit baudrate generator
'-----------------------REGISTERS----------------------------------------

TRISA=%001000 ' RA0,RA3,RA4,RA5 inputs
ANSEL=%00000000 ' All digital
TRISC=%00000000 ' RC5 input
CMCON0=%111 ' Shut off comparators
OPTION_REG.7=0
WPUA=%001000 ' Weak Pull Ups Enabled

rottime var word[10]
rot1time var rottime[0]
rot2time var rottime[1]
rot3time var rottime[2]
rot4time var rottime[3]
rot5time var rottime[4]
rot6time var rottime[5]
rot7time var rottime[6]
rot8time var rottime[7]
rot9time var rottime[8]
rot10time var rottime[9]
runtim var word [2]
runtime var runtim[0]
runbacktime var runtim[1]
time var word
RE var byte
i var word
DE_RE var PORTC.3

'Interrupt---------------------------------------------------------------------
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Receive, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor

INT_ENABLE RX_INT ; enable external (INT) interrupts
ENDASM

Main:
high PORTC.0
pause 500
low PORTC.0
pause 500
goto main

Receive:
for i=0 to 9
hserin 100,Receive2,[WAIT("&"),dec4 rottime[I]]
next
for i = 0 to 9
hserout [dec4 rottime[I],13,10]
next
hserout [dec4 rot3time]

Receive2:
for i = 0 to 1
hserin 100,Receive3,[wait(":"),dec4 runtim[i]]
next
for i = 0 to 1
hserout [dec4 runtim[i]]
next

Receive3:
hserin 100,moveon,[wait("*"),dec4 time]

Moveon:
@ INT_RETURN

aerostar
- 28th January 2013, 10:30
for i=0 to 9
hserin 100,Receive2,[WAIT("&"),dec4 rottime[I]]
next


Does each value have "&" as the character before the rottime,? if not then it will not work as you have told the program to wait for "&" prior to every rottime value.

mel4853
- 28th January 2013, 22:54
I get it now will try something different, thanks.