I can't get this to workHoping you can help me! When I run this very simple android program with prefix I get an almost immediate error "Unfortunately, Bluetooth Example has stopped" and the program closes. I am using the Bluetooth chat example to simply display my data in the chat window. I have very limited serial communication experience. With the prefix disabled I get the data as expected, so the communication is good.
This is the Android routine where I switch between prefix or no prefix mode.
I tried a few variations here with no luckCode:Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("2") If AStream.IsInitialized = False Then AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream") ' AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStream") 'NO PREFIX MODE End If txtLog.Width = 100%x End Sub
My code on an 18F4620 with internal 8mhz osc. I assume I have the prefix correct.Code:Sub AStream_NewData (Buffer() As Byte) LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8")) ' Incoming= BytesToString(Buffer, 0, Buffer.Length, "ISO8859_1") ' LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "ISO8859_1")) End Sub
Code:define DEBUG_REG PORTC define DEBUG_BIT 6 define DEBUG_BAUD 9600 define DEBUG_MODE 0 A1 var byte A2 var byte A3 var byte A4 var byte prefix1 var byte prefix2 var byte prefix3 var byte prefix4 var byte A1=11 A2=22 A3=33 A4=44 Prefix1=23 'http://mothereff.in/byte-counter 11,22,33,44,11,22,33,44 Prefix2=0 Prefix3=0 Prefix4=0 main: pause 1000 debug Prefix1,Prefix2,Prefix3,Prefix4,dec2 A1,",",dec2 A2,",",dec2 A3,",",dec2 A4,",",dec2 A1,",",dec2 A2,",",dec2 A3,",",dec2 A4 pause 1000 goto main end


Hoping you can help me! When I run this very simple android program with prefix I get an almost immediate error "Unfortunately, Bluetooth Example has stopped" and the program closes. I am using the Bluetooth chat example to simply display my data in the chat window. I have very limited serial communication experience. With the prefix disabled I get the data as expected, so the communication is good.


)

Bookmarks