Show Posts
|
|
Pages: [1] 2 3
|
|
3
|
Using Arduino / Project Guidance / math or library for converting commands into bitmap array
|
on: April 20, 2013, 01:21:36 pm
|
|
Hi, I'm using a arduino and high speed adc for an oscilloscope. Problem is high speed printing. I can not use a parallel interface to the display as I'm using majority of all the other pins already. I currently use a spark fun GLCD controller. I also just bought some Digole GLCD controllers with the same issues. I used the Digole display controller with a 400 kHz i2c bus which I thought would help but did not. The problem now is the display controller and its abilities.
I can print a whole image faster then I can togglepixel / drawline through a scan cycle.Is there any code or method for creating a Bitmap array by using commands like (drawline, toggle pixel) or simple math?
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255
|
on: February 12, 2013, 02:06:16 pm
|
here is a sample of return data where the return data goes funny at the longer string: 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
|
|
|
|
|
7
|
Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255
|
on: February 12, 2013, 01:28:56 pm
|
Thanks for help so far, I made this program as you suggested. it has the same issue the data output on the longer streams is garbled #include <NewSoftSerial.h> #include <serialGLCD.h>
int mode = 0; byte b = 0; int c = 0; char a; String data1; String data2; String data3; String data4;
HardwareSerial Uart = HardwareSerial(); serialGLCD lcd;
void setup() {
Uart.begin(115200); // for display lcd.resetLCD();
pinMode(9,OUTPUT); // serial power digitalWrite(9,0); // Serial Power
}
void loop() {
// ____________________________________________________________Weight Gauge____________________________
weightGauge:
lcd.clearLCD(); NewSoftSerial two(27, 7); two.begin(19200); digitalWrite(9, 1); mode = 0;
Uart.print("turn on gauge"); // wait to start device delay(5000);
two.print("N"); // Type the capital letters NOI to start delay(10);
two.print("O"); // Type the capital letters NOI to start delay(10);
two.print("I"); // Type the capital letters NOI to start delay(10);
while (mode < 5) // loop for data gather to lcd after device ready { c = 0; mode = mode+1; delay(2000);
if (mode == 1) two.print("N"); // after data is sent device will respond
if (mode == 2) two.print("N"); // after data is sent device will respond
if (mode == 3) two.print("N"); // after data is sent device will respond
if (mode == 4) two.print("Y"); // after data is sent device will respond
while(two.available() && c <= 160) // gather data for page 1 { a = two.read(); data1 += a; c++; } while(two.available() && c <= 320) // gather data for page 2 { a = two.read(); data2 += a; c++; } while(two.available() && c <= 480) // gather data for page 3 { a = two.read(); data3 += a; c++; } while(two.available() && c <= 640) // gather data for page 4 { a = two.read(); data4 += a; c++; }
Serial.print("data1 = "); Serial.println(data1); // for trouble shooting Serial.print("data2 = "); Serial.println(data2); // for trouble shooting Serial.print("data3 = "); Serial.println(data3); // for trouble shooting Serial.print("data4 = "); Serial.println(data4); // for trouble shooting
//----------------------display serial data 1
if (data1.length() > 0) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data1); delay(3000); } //----------------------display serial data 2 if (data1.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data2); delay(3000); }
//----------------------display serial data 3 if (data2.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data3); delay(3000); }
//----------------------display serial data 4 if (data3.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data4); delay(3000); } //----------------------send serial data out
data1 = ""; // clear string data2 = ""; // clear string data3 = ""; // clear string data4 = ""; // clear string
}
}
|
|
|
|
|
9
|
Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255
|
on: February 12, 2013, 11:31:23 am
|
Sorry, my whole program is way to long to post. Can you provide an example? unsigned long time = 0; long injectorLow; long injectorHigh; long injectorMid; int curOutInputRaw; byte b = 0; int c = 0; byte d = 99; char a; String data1; String data2; String data3; String data4; char order1[] = { 'N','N','N','Y','A','N' }; long order2[] = { -17750,35586,-6672,6672 }; byte manuel = 0;
|
|
|
|
|
10
|
Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255
|
on: February 12, 2013, 11:11:51 am
|
done, same thing. while(keyPad != 34 && keyPad != 31) { c = 0;
while(two.available() && c <= 160) // gather data for page 1 { a = two.read(); data1 += a; c++; } while(two.available() && c <= 320) // gather data for page 2 { a = two.read(); data2 += a; c++; } while(two.available() && c <= 480) // gather data for page 3 { a = two.read(); data3 += a; c++; } while(two.available() && c <= 640) // gather data for page 4 { a = two.read(); data4 += a; c++; }
Serial.println(data1); // for trouble shooting Serial.println(data2); // for trouble shooting Serial.println(data3); // for trouble shooting Serial.println(data4); // for trouble shooting
keyPad = 0;
//----------------------display serial data 1
if (data1.length() > 0) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data1);
while(keyPad != 43 && data1.length() >= 160) // wait for user input { delay(50); }
keyPad = 0;
} //----------------------display serial data 2 if (data1.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data2);
while(keyPad != 43 && data2.length() >= 160) // wait for user input { delay(50); } keyPad = 0; }
//----------------------display serial data 3 if (data2.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data3);
while(keyPad != 43 && data2.length() >= 160) // wait for user input { delay(50); } keyPad = 0;
}
//----------------------display serial data 4 if (data3.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data4); }
//----------------------send serial data out
data1 = ""; // clear string data2 = ""; // clear string data3 = ""; // clear string data4 = ""; // clear string
keyPad = 0; while(keyPad == 0) // wait for user input as soon as data is sent to port it will respond { delay(50); } if (keyPad == 21) { two.print("Y"); Uart.print("Y"); } if (keyPad == 22) { two.print("N"); Uart.print("N"); } if (keyPad == 26) { two.print("A"); Uart.print("A"); } if (keyPad == 27) { two.print("B"); Uart.print("B"); } if (keyPad == 28) { two.print("C"); Uart.print("C"); } if (keyPad == 29) { two.print("D"); Uart.print("D"); } if (keyPad == 1) { two.print("1"); Uart.print("1"); } if (keyPad == 2) { two.print("2"); Uart.print("2"); } if (keyPad == 3) { two.print("3"); Uart.print("3"); } if (keyPad == 4) { two.print("4"); Uart.print("4"); } if (keyPad == 5) { two.print("5"); Uart.print("5"); } if (keyPad == 6) { two.print("6"); Uart.print("6"); } if (keyPad == 7) { two.print("7"); Uart.print("7"); } if (keyPad == 8) { two.print("8"); Uart.print("8"); } if (keyPad == 9) { two.print("9"); Uart.print("9"); } if (keyPad == 10) { two.print("10"); Uart.print("10"); } if (keyPad == 32 || keyPad == 44) { two.print("-"); Uart.print("-"); }
if (keyPad == 30) { two.print("\r"); Uart.print("enter"); } }
}
|
|
|
|
|
11
|
Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255
|
on: February 12, 2013, 11:01:28 am
|
Ok, I tried this and am still having issues. I stuff the data into strings as soon as two(my com port) is available. it seems it works better however the data after the 256 buffer starts to break up and does not receive correctly. I have tried several method unable to produce clear data after the buffer. Here is my code: while(keyPad != 34 && keyPad != 31) { c = 0;
dataGather:
while(two.available() && c <= 160) // gather data for page 1 { a = two.read(); data1 += a; c++; } while(two.available() && c <= 320) // gather data for page 2 { a = two.read(); data2 += a; c++; } while(two.available() && c <= 480) // gather data for page 3 { a = two.read(); data3 += a; c++; } while(two.available() && c <= 640) // gather data for page 4 { a = two.read(); data4 += a; c++; }
delay(20); // wait for any missed data if(two.available()) goto dataGather;
Serial.println(data1); // for trouble shooting Serial.println(data2); // for trouble shooting Serial.println(data3); // for trouble shooting Serial.println(data4); // for trouble shooting
keyPad = 0;
//----------------------display serial data 1
if (data1.length() > 0) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data1);
while(keyPad != 43 && data1.length() >= 160) // wait for user input { delay(50); }
keyPad = 0;
} //----------------------display serial data 2 if (data1.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data2);
while(keyPad != 43 && data2.length() >= 160) // wait for user input { delay(50); } keyPad = 0; }
//----------------------display serial data 3 if (data2.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data3);
while(keyPad != 43 && data2.length() >= 160) // wait for user input { delay(50); } keyPad = 0;
}
//----------------------display serial data 4 if (data3.length() >= 160) { lcd.clearLCD(); lcd.gotoPosition(0,0); Uart.print(data4); }
//----------------------send serial data out
data1 = ""; // clear string data2 = ""; // clear string data3 = ""; // clear string data4 = ""; // clear string
keyPad = 0; while(keyPad == 0) // wait for user input as soon as data is sent to port it will respond { delay(50); } if (keyPad == 21) { two.print("Y"); Uart.print("Y"); } if (keyPad == 22) { two.print("N"); Uart.print("N"); } if (keyPad == 26) { two.print("A"); Uart.print("A"); } if (keyPad == 27) { two.print("B"); Uart.print("B"); } if (keyPad == 28) { two.print("C"); Uart.print("C"); } if (keyPad == 29) { two.print("D"); Uart.print("D"); } if (keyPad == 1) { two.print("1"); Uart.print("1"); } if (keyPad == 2) { two.print("2"); Uart.print("2"); } if (keyPad == 3) { two.print("3"); Uart.print("3"); } if (keyPad == 4) { two.print("4"); Uart.print("4"); } if (keyPad == 5) { two.print("5"); Uart.print("5"); } if (keyPad == 6) { two.print("6"); Uart.print("6"); } if (keyPad == 7) { two.print("7"); Uart.print("7"); } if (keyPad == 8) { two.print("8"); Uart.print("8"); } if (keyPad == 9) { two.print("9"); Uart.print("9"); } if (keyPad == 10) { two.print("10"); Uart.print("10"); } if (keyPad == 32 || keyPad == 44) { two.print("-"); Uart.print("-"); }
if (keyPad == 30) { two.print("\r"); Uart.print("enter"); } }
my received data looks like this (after "B - DELT" is over 256): 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 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
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 - Delt a mo- ransivlae ightod -igOnt e - xtsetiresefling Foornfat culhener' Mal
|
|
|
|
|
13
|
Using Arduino / Programming Questions / New soft serial buffer maxes at 255
|
on: February 11, 2013, 05:17:21 pm
|
Hi; I’m working on a project where I need to receive more than 256 bytes in one buffer from the new soft serial library. I changed the library from the default which helped, but it maxes out at 256 even if I change the library to 512. I am running Teensyduino 2.0++ with arduino 22. I used the memfree program to verify I have lots of RAM left 1.5k Any help would be appreciated. here is the library I'm using: ifndef NewSoftSerial_h #define NewSoftSerial_h
#include <inttypes.h> #include "Print.h"
/****************************************************************************** * Definitions ******************************************************************************/
#define _NewSS_MAX_RX_BUFF 512 // RX buffer size #define _NewSS_VERSION 10 // software version of this library #ifndef GCC_VERSION #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif
class NewSoftSerial : public Print { private: // per object data uint8_t _receivePin; uint8_t _receiveBitMask; volatile uint8_t *_receivePortRegister; uint8_t _transmitBitMask; volatile uint8_t *_transmitPortRegister;
uint16_t _rx_delay_centering; uint16_t _rx_delay_intrabit; uint16_t _rx_delay_stopbit; uint16_t _tx_delay;
uint16_t _buffer_overflow:1; uint16_t _inverse_logic:1;
// static data static char _receive_buffer[_NewSS_MAX_RX_BUFF]; static volatile uint8_t _receive_buffer_tail; static volatile uint8_t _receive_buffer_head; static NewSoftSerial *active_object;
// private methods void recv(); bool activate(); virtual void write(uint8_t byte); uint8_t rx_pin_read(); void tx_pin_write(uint8_t pin_state); void setTX(uint8_t transmitPin); void setRX(uint8_t receivePin);
// private static method for timing static inline void tunedDelay(uint16_t delay);
public: // public methods NewSoftSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false); ~NewSoftSerial(); void begin(long speed); void end(); int read(); uint8_t available(void); bool active() { return this == active_object; } bool overflow() { bool ret = _buffer_overflow; _buffer_overflow = false; return ret; } static int library_version() { return _NewSS_VERSION; } static void enable_timer0(bool enable); void flush();
// public only for easy access by interrupt handlers static inline void handle_interrupt(); };
// Arduino 0012 workaround #undef int #undef char #undef long #undef byte #undef float #undef abs #undef round
#endif
|
|
|
|
|
14
|
Using Arduino / Programming Questions / Re: Sparkfun GLCD slow toggle pixel
|
on: June 19, 2012, 07:24:41 pm
|
|
Hey, thanks for the info, Im using the glcd display in a multi function meter (arduino powered)with several other functions. I have only 1 free digital pin. The arduino mounts onto PCB's I had made for this project already. so Controlling the display directly is out of the question. It is functional the way it is, just the scope only refreshes once a seccond depending on the wave form. So I guess i will have to live with it. Thanks for the help regardless.
|
|
|
|
|
15
|
Using Arduino / Programming Questions / Sparkfun GLCD slow toggle pixel
|
on: June 18, 2012, 09:16:34 pm
|
Hi, First off I would like to thank everyone for their excellent support provided from this forum. My problem is this; I'm using a spark fun glcderial backpack for a basic oscilloscope. It works well but I can only print one pixel at a time and I have to delay a few milliseconds or I get errors on the LCD. So when I look at a square wave the screen takes almost one second to update. Is there a way to fill some sort of buffer on the glcd backpack then print it all at once? I’m using spark fun glcd with Summoning Dark’s firmware, arduino nano. I have tried changing the baud rate on glcd, right now it is at 115200 I have tried adding a cap across the glcd power input and Rx. //___________________________________________________________________________________________scope print to lcd_______________________________
for(int f = 0; f < 113; f++) { lcd.togglePixel(f, (myArray[f]),1);
while((myArray[f] > myArray[f-1]) && ((myArray[f-1]+d)<(myArray[f])) && f > 0) { delay(5); lcd.togglePixel(f, (myArray[f]-d),1); d=d+1; } d = 0; while((myArray[f] < myArray[f-1]) && ((myArray[f-1]-d) > myArray[f] )&& f > 0) {
delay(5); lcd.togglePixel(f, (myArray[f-1]-d),1); d=d+1; } d = 0; delay(5); keyRead3 = analogRead(0); if (keyRead3 > 10 && keyRead3 < 45) { keyPad = 99; delay(500); goto scopeMenu; } }
|
|
|
|
|