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.
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.
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.
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.
zgrkpnr:
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.
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.
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?
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.
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.
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.
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.