HSERIN with a WAIT


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    60

    Default HSERIN with a WAIT

    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
    Code:
    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

  2. #2

    Default Re: HSERIN with a WAIT

    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    60

    Default Re: HSERIN with a WAIT

    I get it now will try something different, thanks.

Similar Threads

  1. wait for a string
    By sahin5002 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd April 2009, 23:27
  2. HSERIN WAIT parameter
    By tishri in forum mel PIC BASIC
    Replies: 2
    Last Post: - 9th December 2008, 10:23
  3. Serin2 multi wait?
    By cburtis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th November 2007, 19:08
  4. SerIn & wait
    By Lotondo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th May 2006, 14:56
  5. Pic16f84 and wait byte
    By irmus in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 4th November 2004, 23:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts