Pages: 1 [2]   Go Down
Author Topic: New soft serial buffer maxes at 255  (Read 915 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
HardwareSerial Uart = HardwareSerial();
There is already an instance of the HardwareSerial class, called Serial. Why are you creating a new one? This isn't even the proper way of doing it.

We seem to have gotten away from the thread topic. Is the point of this thread to illustrate how many ways you can do things wrong?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this was used by an example on PJRC website on how to use the teencyduino serial port. This drives the on board serial port which I use for the LCD.

http://www.pjrc.com/teensy/td_uart.html

I have no formal training in programming and do not do it at a professional level, so yes there will be a lot of mistakes...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here is a sample of return data where the return data goes funny at the longer string:

Quote
data1 =
Do you want to download updated firmware?

data2 =
data3 =
data4 =
data1 =
Do you want to select or change the operating mode of the unit?

data2 =
data3 =
data4 =
data1 =
Do you want to change the Dial Face of the unit?

data2 =
data3 =
data4 =
data1 = This utility allows a technican to describe the dial face to the meter.
The meter uses these values to determine the correct needle placement.
The OUTER set
data2 = of numbers on the dial is the MAIN scale (#1)
The INNER set of numbers on the dial is the DELTA, WOB or 2nd scale
The Main scale is always used in NORMAL MODE
data3 =
What is the second scale function? [Pick one letter from the list]
    A - Normal mode w/ alternate calibration eg: #of lines or English/Metric
    B - Del
data4 = m - Etrenivelveigmo
   C eg OitdeEr seit rrsefti
Fmoreinman suthwns ual

Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12577
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
String data1;
String data2;
String data3;
String data4;

The String class is currently not safe to use; it can cause memory corruption leading to erratic behaviour. Since you're experiencing erratic behaviour, removing all use of String should be your first step.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One final question, before I bow out of this thread. Are you testing this code only on a non-Arduino? The Teensy is NOT an Arduino. It can be programmed using the Arduino IDE but there are differences in the hardware and the software serial handling.

If your problems are strictly limited to the Teensy, you should be on the prjc forum, not here.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

changed from strings to char array and works good THANKS!
Logged

Pages: 1 [2]   Go Up
Jump to: