Show Posts
Pages: [1]
1  International / Français / Précision sortie 3V3 on: August 02, 2013, 10:09:15 am
Bonjour !
J'ai besoin d'une source de tension régulée de 3V3 pour alimenter une sonde PT100.
J'ai envisagé dans un premier temps d'utiliser un régulateur genre L78L33, mais la précision annoncée de 5% ne m'emballe pas trop.
Je me demande alors pourquoi ne pas utiliser la sortie 3V3 de l'Arduino (une Ethernet, en l'occurance)... sauf que je n'ai pas trouvé d'information relative à la précision de cette source de tension.
Quelqu'un saurait-il m'aider pour trouver cette information ?
D'avance merci !
2  Using Arduino / Programming Questions / Re: system hangs while uploading on: October 12, 2012, 11:37:20 am
Sorry if I did !!! And I really hope that this message will appear correctly, even if I wrote the forbidden three characters, shame on me, I am certainly not a human bean to do such strange things...
3  Using Arduino / Programming Questions / Re: system hangs while uploading on: October 12, 2012, 11:28:32 am
...This effectively solves my problem... but it looks a bit crazy to me, isn't it ?
Any good reason for such a problem ? How can I crash the system by simply writing some text ? Where can I find some resources describing these strange traps, so I can escape from them ?

Thank You for Your help !
4  Using Arduino / Programming Questions / system hangs while uploading on: October 12, 2012, 11:18:06 am
Something quite strange is happening to me : the code hereunder makes the system hang (see attached picture) when I try to upload it on a Mega2560.
The code compiles ok.

Code:
bool rdmOn;
int txEnabledPin = 7;
int ledPin = 2;
uint8_t msg[32];
uint8_t nbrOct_msg;
uint8_t pos_msg;

uint8_t cmd[32];
uint8_t nbrOct_cmd;

unsigned long timeDeb;
unsigned long timeFin;

unsigned short measure[20];
int posRDM,nbrRDM;

void setup()
{
  pinMode(ledPin,OUTPUT);
 
  Serial.begin(9600); //57600);
  rdmOn=false;

  pinMode(txEnabledPin,OUTPUT);
  digitalWrite(txEnabledPin,LOW);
 
  nbrOct_msg = 0;
  pos_msg = 0;
 
  nbrRDM = 2;
  posRDM = 0;
}

void loop()
{
  posRDM++; if (posRDM == nbrRDM) posRDM = 0;

  while (Serial.available())
  {
    if (nbrOct_msg == 0)
    {
      nbrOct_msg = (uint8_t)Serial.read();
      pos_msg = 0;
    }
    else
    {
       msg[pos_msg] = (uint8_t)Serial.read();
       pos_msg++;
    }
  }
 
  if (nbrOct_msg == 0)
    return;
  if (pos_msg < nbrOct_msg)
    return; 
 
  nbrOct_cmd = nbrOct_msg + 2; // CRC
  for (uint8_t i=0; i<nbrOct_msg; i++)
    cmd[i] = msg[i];

  Serial.print("???");
  for (uint8_t i=0; i<nbrOct_cmd; i++)
    Serial.write(cmd[i]);
  Serial.print("!!!");

  nbrOct_msg = 0;
}

Note that other codes can be uploaded without any problem (as the one hereunder), so I cannot beleive the Mega2560 is crashed :
Code:
int indexRelai;
bool relaiOn;

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  indexRelai=3;
  relaiOn=false;
  pinMode(7,OUTPUT);
  digitalWrite(7,HIGH); // pour forcer sortie à zéro...
  //pinMode(14,OUTPUT);
  //digitalWrite(14,LOW);
  Serial3.begin(9600);
  pinMode(4,OUTPUT);
}

void loop() {
  indexRelai++;
  if (indexRelai==4)
  {
    indexRelai = 0;
    relaiOn=(!relaiOn);
  }
  uint8_t msg[8];
  msg[0]='#';msg[1]='0';msg[2]='1'; msg[3]='1';
  msg[4]='0'+indexRelai;
  msg[5]='0';
  if (relaiOn) msg[6]='1'; else msg[6]='0';
  msg[7]=13;
  digitalWrite(7,HIGH);
  delay(10);
  for (int i=0; i<8; i++)
  {
    Serial3.write(msg[i]);
    //delay(5);
  }
  //Serial3.write(msg,8);
  delay(10);
  digitalWrite(7,LOW);
  Serial.write(msg,8);
 
  if (relaiOn)
    digitalWrite(2,HIGH);
  else
    digitalWrite(2,LOW);
  delay(1000);
}

I tried to reduce the amount of memory used by global variables... no effect.

Does anyone have any idea ?
When such troubles appear, where can I find some resource to help me (discussions on the way the code is generated, maybe ?).

Thank you very much in advance !
5  Using Arduino / Programming Questions / Re: Assembler error, SoftwareSerial, add even parity bit on: October 08, 2012, 06:51:45 am
I could see effectively that, at the beginning and end of function "recv", there are some "push/pop" for registers under certain circumstances :
Code:
#if GCC_VERSION < 40302
// Work-around for avr-gcc 4.3.0 OSX version bug
// Preserve the registers that the compiler misses
// (courtesy of Arduino forum user *etracer*)
  asm volatile(
    "push r18 \n\t"
    "push r19 \n\t"
    "push r20 \n\t"
    "push r21 \n\t"
    "push r22 \n\t"
    "push r23 \n\t"
    "push r26 \n\t"
    "push r27 \n\t"
    ::);
#endif 

But I am running MS-Windows 7 Pro (not Mac OSX). Are they some known bugs in such a situation too ?
Anywya, I don't care, I just want things to work. How can I solve this ?

Thank You in advance for Your precious help !
6  Using Arduino / Programming Questions / Assembler error, SoftwareSerial, add even parity bit on: October 08, 2012, 04:40:49 am
Using serial communication on a Mega2560 board, I need to talk to devices with which "even" parity is required (no way to select "no" parity on those devices).
Then, when sending data, I have to add one bit ("0" if not inverted, because I have 8 data bits) between data bits and stop bit, and when receiving data, I have to read one bit between data bits and stop bit.
I created "ParitySoftwareSerial" library, based on "SoftwareSerial".
If I just modify function "write" by adding :
Code:
  //...
  if (_inverse_logic)
  {
    for (byte mask = 0x01; mask; mask <<= 1)
    {
        //...
    }
    // write the even parity bit : we sent 8 bits, so we send "1" :
    tx_pin_write(HIGH);
    tunedDelay(_tx_delay);
    //...
  }
  else
  {
    for (byte mask = 0x01; mask; mask <<= 1)
    {
        //...
    }
    // write the even parity bit : we sent 8 bits, so we send "0" :
    tx_pin_write(LOW);
    tunedDelay(_tx_delay);
    //...
  }
  //...
...when I recompile my sketch using the libray, it works.

But when I modify "recv" by adding :
Code:
    //...
    // Read each of the 8 bits
    for (uint8_t i=0x1; i; i <<= 1)
    {
        //...
    }
    // skip the parity bit
    tunedDelay(_rx_delay_stopbit); // I use delay defined for stop bit...
    DebugPulse(_DEBUG_PIN2, 1);
    // skip the stop bit
    //...
I receive a compiler error :
Code:
Assembler messages:
C:\Users\Alytech\AppData\Local\Temp/cczbUxov.s:227: Error: register r24, r26, r28 or r30 required

And if I just commentthe two added lines (by adding "//" in front of them), compiling is ok.

Does anyone have an idea or can show me where to search to get an answer to my problem ?

Thank you very much in advance !
Pages: [1]