UartBuffer2 module for Firewing 32

Share code examples with other users

UartBuffer2 module for Firewing 32

Postby Coccoliso » Thu Oct 19, 2017 9:30 am

Hi,

here
UartBuffer2-32.zip
UartBuffer2-PIC32
(2.07 KiB) Downloaded 817 times
the Firewing 32 version of UartBuffer2.BAS module
Download the compressed file and, with Firewing IDE opened, dragged it on editor window.. this copy the module in your "UserLibrary\MCU32" folder

EXAMPLE :

Code: Select all
imports UartBuffer2
imports Uart2
imports Tick

' this event handler is triggered when data is received - it gives
' the program the opportunity to accept or reject the incoming byte
' or modify the data in some way - this example changes all space
' characters to underscore...
Sub OnData(ByRef Data As Byte, ByRef Accept As Boolean) Handles RX2.OnData
   Dim DataIn As Byte = Data
   If DataIn = cbyte(" ") Then
      Data = "_"
   End If
End Sub

' this event is fired if the RX buffer overruns...
Sub OnOverrun () Handles RX2.OnOverrun
End Sub

' main program...
Sub Main()
   dim mTickPrev As uinteger = 0
   UART2.SetBaudrate(UART2.Baudrate.Is9600) ' set baudrate
   pps.enableRX2()
   pps.enableTX2()
   
   RX2.Start()                              ' start buffering data

   ' loop forever to prevent program
   ' from terminating...
   mTickPrev = tick.Time()
   While True
      If RX2.DataAvailable() Then      ' if data is available
         Console.Write(RX2.ReadByte()) ' then echo back
      End If
   End While
End Sub
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Return to Code Examples

Who is online

Users browsing this forum: No registered users and 2 guests

x