Show Posts
Pages: 1 [2] 3 4 5
16  Using Arduino / Programming Questions / Serial Proxy that runs on a Arduino. Does it exist already? on: August 03, 2013, 10:30:12 pm
Hi there,

I am looking at developing firmware to extend embedded systems that communicate via Serial.

So I decided to ask before just starting.(I searched online but could not find anything related)

This is what I am looking for:

I am developing shields for GRBL(CNC software - G-Code interpreter). Currently GRBL only communicates through to the serial port of an Arduino UNO. GRBL does what it does very well, but we are running out of memory and I/O pins on an standard UNO board. So my goaI is to extend it...

I recently developed a general purpose shield that adds an extra ATMega328(info.protoneer.com/2).
With this shield I want to run GRBL on it and use the Arduino UNO as a Serial proxy.

The Serial proxy will accept commands,inspect them and forward GRBL compatible commands to the MCU with GRBL installed.
By having this extra layer we can extend the list of commands a GRBL setup can understand. This also give us the opportunity
to add extended commands that can be forwarded to I2C devices.(Huge advantage) 

Does anyone know if there is already an existing system/setup that can do the above?
17  Using Arduino / Programming Questions / Re: With a function is a char[xxx] parameter passed by ref or value on: July 25, 2013, 04:34:56 am
And don't worry if it's confusing - it took me 6 years to learn how pointers work smiley-wink

haha... I am spoiled having a day-job working with C# with almost no memory restrictions.

Thanks for the advice. I always thought you had to do the & to make it a ref type, but you are right... The Char[xxx] Parameter is pointing to the memory location and if you change the contents of the memory you are actually referencing the value. TA-DA!!!!!

Thanks again... smiley-grin
18  Using Arduino / Programming Questions / With a function is a char[xxx] parameter passed by ref or value on: July 25, 2013, 03:01:22 am
Hi.

I am on the discovery path to mastering char arrays, char pointer and strings in C++.

I was trying to pass text to a function and then return modified text back.

While testing I tried the code below and it seems to do what I want. I expected that
the "data" parameter would have been passed by value but it's acting like it's passed by reference.

Is that correct?

Code:
const int maxMsgLen = 20;

void test2(char message[maxMsgLen+1], char data[maxMsgLen+1+2])
{
  int index=0;
  int index2 = 0;
 
  data[index] = '*'; //(Char)STX;
 
  while(message[index2] != '\0')
  {
    index++;
    data[index] = (char)message[index2];
    index2++;
  }
 
  index++;
  data[index] = '*'; //(char)ETX;
  index++;
  data[index] = '\0';
}

void loop()
{
  char buffer[maxMsgLen+1] = "Message1234567890AA";
 
  char temp[maxMsgLen+1+2];
  test2(buffer,temp);
 
  Serial.println(temp);
 
  delay(1000); 
}
19  Using Arduino / General Electronics / Re: Wire Manufacturer / Supplier on: July 08, 2013, 04:57:20 am

Well spotted... thanks for that. They also have some 4 pin 100cm cables that will be perfect for stepper motors.
20  Using Arduino / General Electronics / Re: Useful Parts on: July 08, 2013, 03:58:07 am
smiley-grin I have just made a post about almost the same thing. I am looking for a manufacturer that actually does the crimped wires to spec.

I wonder how hard it is to use the crimping tool?
21  Using Arduino / General Electronics / Re: Digital I/O Router/switch - What options are available? on: July 08, 2013, 03:50:16 am
This is more an app for a crosspoint switch, you can get them in 8x8, 8x16 etc. An 8x8 is basically 8 8-way MUXes in a single chip.

Hi Rob... Do you have an example of an IC that I can go an look-up?
22  Using Arduino / General Electronics / Re: Wire Manufacturer / Supplier on: July 08, 2013, 03:47:34 am
What's special about them? Why can't you just buy them on ebay like everybody else?

The longest I could find on ebay was 30cm and those would not be long enough to reach all the ends on a small cnc router.

I bought a Ramps 1.4 3d printers board the other day and that came with 100cm cables that worked really well.
23  Using Arduino / General Electronics / Re: Digital I/O Router/switch - What options are available? on: July 08, 2013, 03:39:30 am
It's a bit different because the multiplexer handles analog inputs, but a port extender basically just outputs low or high. I suppose it depends on your definition of those words.

Thanks for pointing that out... A multiplexer will actually be more useful because like the Arduino analog pins, you can also make them act like Digital pins.
24  Using Arduino / General Electronics / Wire Manufacturer / Supplier on: July 08, 2013, 03:32:22 am
It was a bit hard to pick a forum to post this in so I picked this one. (Moderators, If its the wrong one please move me to the correct one.)

I am looking for companies that can supply custom made cables that look like these:

I have designing an Arduino CNC Shield and it needs a bunch of these cables to connect end-stops. (Need to be 100cm long as well)
http://blog.protoneer.co.nz/arduino-cnc-shield/




Not sure what you call these as the ones I have found are called jumper wires or Dupont connectors (2.54mm pitch).

Any help will be appreciated.
25  Using Arduino / General Electronics / Re: Digital I/O Router/switch - What options are available? on: July 07, 2013, 11:16:25 pm
I see. I was wondering about that.. So a port extender is then the same thing,right?
26  Using Arduino / General Electronics / Re: Digital I/O Router/switch - What options are available? on: July 07, 2013, 02:31:28 am
That's exactly what I am after... Thanks for that Nick.

Now I have a name I can do some reading up on... smiley-wink
27  Using Arduino / General Electronics / Digital I/O Router/switch - What options are available? on: July 07, 2013, 02:15:51 am
Hi...

Have been searching online but could not find anything except networking equipment.

Is there some sort of integrated circuit available that can do routing / switching of IO(Input / Output) lines?

Example, if you have 5 input and output lines I would like to be able to change how input pins are forwarded
to the output pin. A real world example of this would be like the old phone exchanges where the operators routed incoming
callers lines to specific receiver lines.

I know automated phone exchanges can do this somehow.

Any suggestions or pointing in the right direction would be appreciated.

Thanks.
28  General Category / General Discussion / Are "Solid Principles" applicable to MCU's? on: July 01, 2013, 03:50:27 am
Hi there.

Solid principles : http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)

Works really well for object orientated programming where you have plenty of resources and you are worried
about the development changes and ensuring that your code deals well with future changes and enhancements.

Does this add any benefit to embedded development or am I just making things harder than they need to be?



29  Using Arduino / Programming Questions / Re: Interesting discovery - Can you figure out what's wrong? on: July 01, 2013, 03:37:16 am
Code:
  struct position {
    int x;
    int y;
    int z;
    position(){ 0; 0; 0; }
    position(int X,int Y, int Z){ x = X; y = Y; z = Z; }
  } CurrentPosition, DefaultPosition;

  void GRBLCommand()
  {
    int XChange = CurrentPosition.x - DefaultPosition.x;
    int YChange = CurrentPosition.y - DefaultPosition.y;
    int ZChange = CurrentPosition.z - DefaultPosition.z;
   
    if(
        (XChange > 10 || XChange < -10) ||
        (YChange > 10 || YChange < -10) ||
        (ZChange > 10 || ZChange < -10)
      )
    {
      Serial.print("G1 ");
   
      // This can be shortened  to a method that takes the Change,Axis letter and returned the string.
      if(XChange < -10) Serial.print("X-1000");
      if(XChange > 10)  Serial.print("X1000");
     
      if(YChange < -10) Serial.print("Y-1000");
      if(YChange > 10)  Serial.print("Y1000");
     
      if(ZChange < -10) Serial.print("Z-1000");
      if(ZChange > 10)  Serial.print("Z1000");
     
      Serial.println("F100");
    }
    else
    {
      Serial.print("!");
    }
  }

This is my working code. My original idea was to create method that returned a string that gets printed with Serial.print();
I could not get that going because String kept on locking up my Arduino. Because I can't get strings to work properly I ended up just doing the Serial.print inside the method. (It works but I don't like it cause I am sure the code can look much simpler.)

Any ideas on how I can optimize this method and removing the dependency on Serial?

Thanks for everyone's help up to now.


30  Using Arduino / Programming Questions / Re: Interesting discovery - Can you figure out what's wrong? on: June 29, 2013, 06:40:55 pm
thanks...

Yes.. I noticed that  a lot of people was doing it like that.

If I declare a Char Temp[100] and I insert 50 characters followed by a null terminator. Does that reserve the full 100 in memory or only the bit up to the null terminator?

thanks again for all the help.
Pages: 1 [2] 3 4 5