procedure in interrupt

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
zuran
Posts: 29
Joined: 19 Oct 2007 08:15
Location: Belgium

procedure in interrupt

#1 Post by zuran » 04 Nov 2007 19:51

How do you call a procedure within the interrupt ?

Code: Select all

sub procedure Usart1_Interrupt   org URXCaddr
    CLI
  ptr^= UDR         ' reading received data
  ptr = ptr + 1       ' increment address of pointer
  inc(index)
  if index = END_INDEX then    ' if is it get the end of array
       ptr   = @receive_array   ' start from begin
      index = 0
              usart1_write_char(receive_array[0])
              usart1_write_char(receive_array[1])
              usart1_write_char(receive_array[2])
              if (receive_array[0] = "R") then
          if (receive_array[1] = "T") then
              printtemp(receive_array[2]

            end if
        end if
  end if
  SEI
end sub

Code: Select all

sub procedure printtemp(dim tempt as integer)
    IntToStr(t[tempt],text)
    Usart1_Write_char(text[0])
    Usart1_Write_char(text[1])
    Usart1_Write_text(".")
    IntToStr(t1[tempt],text)
    Usart1_Write_char(text[0])
    Usart1_Write_char(176)  ' "degree" character
    usart1_write_char("C")
end sub

Post Reply

Return to “mikroBasic for AVR General”