Interrupt driven Buffered Serial Input


Results 1 to 16 of 16

Threaded View

  1. #8
    Join Date
    May 2007
    Posts
    17


    Did you find this post helpful? Yes | No

    Default

    I tried this code:

    Code:
    ReadSerial:
       DataRec var byte[5] : DataRec = 0
       KP var byte : KP = 0
       
       While CounterA <= 70
          IF index_in > (buffer_size-1) Then index_in = 0	'Reset pointer if outside of buffer
    	  HSerin [buffer[index_in]]		   ' Read USART and store character to next empty location
    
    	  if buffer(index_in) = $20 then 
             index_in = 0
             for CounterB=0 to buffer_size
                 buffer(CounterB) = 0
                 next CounterB
             KP = 1
          ENDIF
    
          if ((KP = 1) AND (index_in=4)) THEN
             SerData(CounterA)=buffer(4)
             CounterA = CounterA + 1
             KP = 1
          ENDIF
          index_in = index_in + 1
       WEND
    and it still doesn't work any ideea why.

    PS: Is it better than the old one?
    Last edited by johnmiller; - 11th May 2007 at 19:30.

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. 18F2480 asm interrupt
    By Richard Storie in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th March 2009, 19:40
  4. Serial Question + General Review
    By Freman in forum General
    Replies: 2
    Last Post: - 20th June 2008, 22:27
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 0

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