Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: PROGMEM max of 255 seperate enteries? on: January 05, 2014, 05:24:15 pm
Thanks, I moved the data into 2 strings and it worked well thank you!
2  Using Arduino / Programming Questions / Re: PROGMEM max of 255 seperate enteries? on: January 04, 2014, 10:42:12 pm
Hi, Thanks

I am using a teensy with the arduino software. I believe it uses the AT90USB1286. Does this chip support the pgm_read_byte_near (8 bit) or the pgm_read_byte_far (16 bit)?
3  Using Arduino / Programming Questions / PROGMEM max of 255 seperate enteries? on: January 04, 2014, 06:19:09 pm
Hi; Im using arduino 1.0.4. I have found that my progmem function stops working after 255 enteries. Is there some part of the library I can edit to allow more then 255 enteries?
 Thanks for any advice.

Code:
//________________________________________________________LONG STRINGS TO SAVE RAM USE PROGMEM_____________________

prog_char string_0[] PROGMEM = "CURRENT";  
prog_char string_1[] PROGMEM = "FREQ";
prog_char string_2[] PROGMEM = "DATA IN / TERMINAL";
prog_char string_3[] PROGMEM = "SIM DATA OUT";
prog_char string_4[] PROGMEM = "SCOPE";
prog_char string_5[] PROGMEM = "4800";
prog_char string_6[] PROGMEM = "9600";
prog_char string_7[] PROGMEM = "19200";
prog_char string_8[] PROGMEM = "38400";
prog_char string_9[] PROGMEM = "57600";
prog_char string_10[] PROGMEM = "WAITING ON INPUT";
prog_char string_11[] PROGMEM = "SIMULATING";
prog_char string_12[] PROGMEM = "4 CHANNELS";
prog_char string_13[] PROGMEM = "8 CHANNELS";
prog_char string_14[] PROGMEM = "12 CHANNELS";
prog_char string_15[] PROGMEM = "16 CHANNELS";
prog_char string_16[] PROGMEM = "RS 485";
prog_char string_17[] PROGMEM = "RS 232";
prog_char string_18[] PROGMEM = "2PIN MAG";
prog_char string_19[] PROGMEM = "Cal Mode";
prog_char string_20[] PROGMEM = "3PIN MAG";
prog_char string_21[] PROGMEM = "BACKLIGHT";
prog_char string_22[] PROGMEM = "Rob C"; //____________________________INSERT YOUR NAME_________________
prog_char string_23[] PROGMEM = "1.6";//_____________________________version number_____________________
prog_char string_24[] PROGMEM = " ";
prog_char string_25[] PROGMEM = "SIMULATE";
prog_char string_26[] PROGMEM = "MEASURE";
prog_char string_27[] PROGMEM = "SERIAL";
prog_char string_28[] PROGMEM = "SPECIAL";
prog_char string_29[] PROGMEM = "SETTINGS";
prog_char string_30[] PROGMEM = "BAT";
prog_char string_31[] PROGMEM = "MAX DATA";
prog_char string_32[] PROGMEM = "MORE";
prog_char string_33[] PROGMEM = "CSV";
prog_char string_34[] PROGMEM = "WITS";
prog_char string_35[] PROGMEM = "VOLTS";
prog_char string_36[] PROGMEM = "CURRENT";
prog_char string_37[] PROGMEM = "SCOPE";
prog_char string_38[] PROGMEM = "SIMULTANEOUS";
prog_char string_39[] PROGMEM = "WEIGHT GAUGE";
prog_char string_40[] PROGMEM = "VOLT SIM";
too much code deleted some here

prog_char string_285[] PROGMEM = "0114";

prog_char string_286[] PROGMEM = "RATE ";
prog_char string_287[] PROGMEM = "DEPTH ";
prog_char string_288[] PROGMEM = "WEIGH ";
prog_char string_289[] PROGMEM = "CIRC PR ";
prog_char string_290[] PROGMEM = "WEL PR ";
prog_char string_291[] PROGMEM = "RATE 1 ";
prog_char string_292[] PROGMEM = "RATE 2 ";

//_____________________________________CT vision
prog_char string_293[] PROGMEM = "0108";
prog_char string_294[] PROGMEM = "0109";
prog_char string_295[] PROGMEM = "0110";
prog_char string_296[] PROGMEM = "0112";
prog_char string_297[] PROGMEM = "0113";
prog_char string_298[] PROGMEM = "0114";
prog_char string_299[] PROGMEM = "0115";

prog_char string_300[] PROGMEM = "INJ D ";
prog_char string_301[] PROGMEM = "INJ R ";
prog_char string_302[] PROGMEM = "Weight ";
prog_char string_303[] PROGMEM = "WELL PR ";
prog_char string_304[] PROGMEM = "CIRC PR ";
prog_char string_305[] PROGMEM = "REEL D ";
prog_char string_306[] PROGMEM = "REEL S ";


PROGMEM const char *string_table[] =   // change "string_table" name to suit
{  
  string_0,   string_1,   string_2,   string_3,   string_4,   string_5,   string_6,   string_7,   string_8,   string_9,   string_10,  string_11,  string_12,  string_13,
  string_14,  string_15,  string_16,  string_17,  string_18,  string_19,  string_20,  string_21,  string_22,  string_23,  string_24,  string_25,  string_26,  string_27,
  string_28,  string_29,  string_30,  string_31,  string_32,  string_33,  string_34,  string_35,  string_36,  string_37,  string_38,  string_39,  string_40,  string_41,
  string_42,  string_43,  string_44,  string_45,  string_46,  string_47,  string_48,  string_49,  string_50,  string_51,  string_52,  string_53,  string_54,  string_55,
  string_56,  string_57,  string_58,  string_59,  string_60,  string_61,  string_62,  string_63,  string_64,  string_65,  string_66,  string_67,  string_68,  string_69,
  string_70,  string_71,  string_72,  string_73,  string_74,  string_75,  string_76,  string_77,  string_78,  string_79,  string_80,  string_81,  string_82,  string_83,
  string_84,  string_85,  string_86,  string_87,  string_88,  string_89,  string_90,  string_91,  string_92,  string_93,  string_94,  string_95,  string_96,  string_97,
  string_98,  string_99,  string_100, string_101, string_102, string_103, string_104, string_105, string_106, string_107, string_108, string_109, string_110, string_111,
  string_112, string_113, string_114, string_115, string_116, string_117, string_118, string_119, string_120, string_121, string_122, string_123, string_124, string_125,
  string_126, string_127, string_128, string_129, string_130, string_131, string_132, string_133, string_134, string_135, string_136, string_137, string_138, string_139,
  string_140, string_141, string_142, string_143, string_144, string_145, string_146, string_147, string_148, string_149, string_150, string_151, string_152, string_153,
  string_154, string_155, string_156, string_157, string_158, string_159, string_160, string_161, string_162, string_163, string_164, string_165, string_166, string_167,
  string_168, string_169, string_170, string_171, string_172, string_173, string_174, string_175, string_176, string_177, string_178, string_179, string_180, string_181,
  string_182, string_183, string_184, string_185, string_186, string_187, string_188, string_189, string_190, string_191, string_192, string_193, string_194, string_195,
  string_196, string_197, string_198, string_199, string_200, string_201, string_202, string_203, string_204, string_205, string_206, string_207, string_208, string_209,
  string_210, string_211, string_212, string_213, string_214, string_215, string_216, string_217, string_218, string_219, string_220, string_221, string_222, string_223,
  string_224, string_225, string_226, string_227, string_228, string_229, string_230, string_231, string_232, string_233, string_234, string_235, string_236, string_237,
  string_238, string_239, string_240, string_241, string_242, string_243, string_244, string_245, string_246, string_247, string_248, string_249, string_250,  

  //_________for wits ID'D

  string_251, string_252, string_253, string_254, string_255, string_256, string_257, string_258, string_259, string_260, string_261, string_262, string_263, string_264,
  string_265, string_266, string_267, string_268, string_269, string_270, string_271, string_272, string_273, string_274, string_275, string_276, string_277, string_278,
  string_279, string_280, string_281, string_282, string_283, string_284, string_285, string_286, string_287, string_288, string_289, string_290, string_291, string_292,
  string_293, string_294, string_295, string_296, string_297, string_298, string_299, string_300, string_301, string_302, string_303, string_304, string_305, string_306
};
4  Using Arduino / Programming Questions / Re: any conflict with using avr/pgmspace.h and EEPROM.h in same sketch? on: April 21, 2013, 10:05:20 am
Thanks
5  Using Arduino / Programming Questions / any conflict with using avr/pgmspace.h and EEPROM.h in same sketch? on: April 21, 2013, 09:41:45 am
Hi, Just wondering if there would be any conflict running both these libraries. They both use EEPROM and seem to have there own addressing system. Is there a possibility of overlap? I am using both right now and it does not seem to be an issue. I want to be 100% sure for future expansion ect.

Thanks,
6  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?
7  Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255 on: February 12, 2013, 02:31:00 pm
changed from strings to char array and works good THANKS!
8  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:

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

9  Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255 on: February 12, 2013, 02:00:05 pm
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...
10  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

Code:
#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

  }

}   




11  Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255 on: February 12, 2013, 12:32:27 pm
hey, i made a small sketch that does not use keypad. still has same issue i'm going to post it shortly. 31 and 34 are the exit keys. your last question i will post the complete sketch demonstrating this issue shortly
12  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?

Code:
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;
13  Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255 on: February 12, 2013, 11:11:51 am
done, same thing.

Code:
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"); 
          }
       
      }





    }   
14  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:


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):
Quote
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
15  Using Arduino / Programming Questions / Re: New soft serial buffer maxes at 255 on: February 11, 2013, 05:40:24 pm
Its bieng displayed on a lcd and is manipulated by several aspects of the program and user interface. I guess i could try stuffing it all into a string. I was hoping i could make some small changes to the library to get it to work.
Pages: [1] 2 3