Go Down

Topic: Arduino with another low level language and IDE (Read 6073 times) previous topic - next topic

zgrkpnr

Hi everyone.

    I have been dealing with some problems with Arduino IDE lately. It is not enough for me to build projects anymore. To briefly explain ;
                  For example I wanna use interrupt driven serialports but it is impossible to do with simple Arduino codes. So I need C++ or other languages like CodeWarrior uses.

     I have been trying to use Atmel Studio 6.2 Beta with my Arduino UNO R3 board but it is more difficult to get Atmel Studio to see my UNO than programming itself. I have decided that it is impossible for me to configure Atmel Studio and now I am looking for another solution.

    Can you suggest any other IDE that I can use interrupts and other detailed methods efficiently? Thanks in advance.

retrolefty


Hi everyone.

    I have been dealing with some problems with Arduino IDE lately. It is not enough for me to build projects anymore. To briefly explain ;
                  For example I wanna use interrupt driven serialports but it is impossible to do with simple Arduino codes. So I need C++ or other languages like CodeWarrior uses.

The standard arduino serial library already uses interrupts on both incoming and outgoing characters, no need for you to anything to gain this.

     I have been trying to use Atmel Studio 6.2 Beta with my Arduino UNO R3 board but it is more difficult to get Atmel Studio to see my UNO than programming itself. I have decided that it is impossible for me to configure Atmel Studio and now I am looking for another solution.

    Can you suggest any other IDE that I can use interrupts and other detailed methods efficiently? Thanks in advance.

knut_ny

mega has several serialports...
It relativly simple to use pins 2 and 3 as interrupt-diven RX-pins.
..and then you suddenly got 3 interruptdriven receive-lines.
Ny

graynomad

Code: [Select]
if (Serial.available() > 0)
    c = Serial.read();


There we are, interrupt-driven serial port usage.

What else do you want to do?

I use AS 6.1 just fine (with the Visual Micro plugin), but really all these IDEs are just methods to enter code, the code you write is still the same unless you want to ditch the Arduino framework.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Robin2


 I have been trying to use Atmel Studio 6.2 Beta with my Arduino UNO R3 board but it is more difficult to get Atmel Studio to see my UNO than programming itself.


Seems to me you have just discovered the beauty of the Arduino system.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

zgrkpnr

So should I not try to program Arduino with C++ and keep going with Arduino IDE? And how about making RX pin an interrupt pin on UNO?

Robin2


So should I not try to program Arduino with C++ and keep going with Arduino IDE? And how about making RX pin an interrupt pin on UNO?


If you intended to include the word "not" I don't understand your question.

If the "not" should be deleted then the answer to the first part is YES.

In relation to the second part, explain what you want to achieve - there may be another way to do it.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

CrossRoads

All the Uno pins are capable of PCINT - is that enough of an interrupt for you?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

graynomad

Quote
And how about making RX pin an interrupt pin on UNO?

Pin 2 (Rx) is PCINT16, so you can set that up, I think there's a library to handle PCINTs, but you did imply you want to work more directly with the machine.

Another way is to run a wire from Rx to pins 4 or 5 and use attachInterrupt().

But as we pointed out serial is already interrupt driven, do you have a special requirement apart from receiving characters, like you need to do something on the falling edge of the start bit.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

retrolefty


So should I not try to program Arduino with C++ and keep going with Arduino IDE? And how about making RX pin an interrupt pin on UNO?


When you use the Arduino IDE you ARE using C++ to write your sketch. Don't confuse the many supplied functions the IDE provides, with it not being C++ because it already is. You do not have to utilize most of the supplied functions if you wish and write your own C++ functions that perform the same thing, but that is just reinventing what is already provided for you.

Perhaps if you could reexplain what it is you are trying to accomplish we might be able to give better advice. Again serial comm already utilizes interrupt functions as part of the standard serial library. Read the source code provide in the IDE distribution if you just need to see how the serial function utilizes interrupts already.

zgrkpnr

Alright I will try to explain what I want briefly. I am using Arduino PID library.  I am sending reference input fot motor from my own c# application And plot the results in MATLAB.  But contantly polling the serialPort is making graph very discrete looking.

   So simply I wans an ISR looks like this ;

                          ISR(USART_RX_vect)
                                      {
                                              myValue = Serial.read();
                                      }

I guess it is simple but I can't do it. So can you just please help doing this simple and short code.

Robin2

If your program isn't too long can you post all of it. There may be scope to streamline parts of it.

How often do you need to read the serial port?

I presume there are  no delay() instructions in your code?

While I can't see it being necessary have you considered connecting the Rx pin to another pin and basing your interrupt on that? However I don't think you can call Serial.read() within an ISR -  and even if you can, you shouldn't because it is relatively slow.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

graynomad

Also if you interrupt on the start bit there will be nothing to read because the byte is still in transit, and as we said the serial port is already interrupt driven, so you are not constantly polling it.

Time to show us the money code.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up