Show Posts
Pages: [1] 2
1  Development / Suggestions for the Arduino Project / Re: dead keys not working in IDE on: April 30, 2012, 12:53:16 pm
I finally managed to figure out a work around. In KDE the keyboard configuration can be set in:

- System Settings
- Keyboard Settings
- Layout
- Select 'Show indicator'
- Select 'Per window'
- Add
- Select a variant without 'dead keys', eg. "English (US, with Euro on 5)"

After applying these settings, I select the window for input focus and I click the indicator in the system tray when I want to switch the keyboard configuration.
The keyboard setting needs only be set once per window and is rememberd over program restarts.
2  Development / Suggestions for the Arduino Project / dead keys not working in IDE on: April 30, 2012, 12:00:45 pm
On Arduino IDE 0022 and 1.0 on (k)ubuntu x86_64, the dead keys (eg. for using ' " ^ ) cannot be entered in the main window. The serial monitor works just fine.

Anyone aware of a solution, work around, bug report? Can / should I file a new bug report and if yes: Where?
3  Using Arduino / Programming Questions / Re: Addressing ATmega registers by number on: April 29, 2012, 10:53:31 am
Code:
_SFR_IO8( regNum ) = ( _SFR_IO8( regNum ) & maskAnd ) ^ maskEor;

Code:
(*(volatile uint8_t *)((regNum) + 0x20)) = ( (*(volatile uint8_t *)((regNum) + 0x20)) & maskAnd ) ^ maskEor;

Cool! This little work instruction is useful information for troubleshooting and future reference smiley
4  Using Arduino / Programming Questions / Re: Addressing ATmega registers by number on: April 29, 2012, 10:30:16 am
@Grumpy_Mike: Compiles too! I was searching the source codes for what _SFR_IO8 exactly does, possibly it just does your little trick.

Thnx.
5  Using Arduino / Programming Questions / Re: Addressing ATmega registers by number on: April 29, 2012, 10:24:29 am
Code:
void testje() {
  byte maskAnd = 0x00;
  byte maskEor = 0x73;
  byte regNum = 0x04;
  _SFR_IO8( regNum ) = ( _SFR_IO8( regNum ) & maskAnd ) ^ maskEor;
}
Compiles, I can test a bit with it smiley

Thnx
6  Using Arduino / Programming Questions / Re: Addressing ATmega registers by number on: April 29, 2012, 10:01:00 am
Point taken about the + 0x20, but a line like:

0x24 = ....

will never compile. I need some way to tell the compiler to access the AVR's register, not the number. Any idea where I can find the DDRx macro? Maybe I can figure it out from the source codes.
7  Using Arduino / Programming Questions / Re: Addressing ATmega registers by number on: April 29, 2012, 09:29:48 am
@Grumpy_Mike: How would I rewrite this:

Code:
  byte maskAnd = 0x07;
  byte maskEor = 0x73;
  DDRB = ( DDRB & maskAnd ) ^ maskEor;
  0x04 = ( 0x04 & maskAnd ) ^ maskEor;

Line 3 compiles just fine; Line 4 will not compile and would mean something entirely different than to manipulate controller registers.

@Graynomad: I want to be able to send an instruction from my PC to Arduino, saying "what is the current value of DDRB?" If I have to program all registers in an 'if' or 'case' statement, I will probably make many errors and the program will grow really quick in size.

If you check the datasheet of ATmega1280, you'll see DDRB is a register at I/O port 0x04. If you examine the disassembled machine code that is sent to the controller while programming it, you'll see writing to IO ports is simply reading an IO register. I do not mean pin 0x04.
8  Using Arduino / Programming Questions / Addressing ATmega registers by number on: April 29, 2012, 09:04:23 am
I am aware I can address eg. DDRB register by name, but I want to access the registers by number, essentially reading /writing directly to an I/O register (eg. port 0x04 for DDRB).

I want to do this in a loop (*and* I want to be able to initiate it from the attached PC).

How can I read or write directly from/to an AVR's I/O register by number?
9  Using Arduino / General Electronics / Re: emulate open collector on: March 04, 2012, 11:55:09 am
Today I pulled out my oscilloscope and checked the slopes with the internal pull-up trick. It is a drama, the waveform doesn't even remotely look like it is digital!
This was easily solved with an external 10k pull-up as suggested!

Thanks MarkT
10  Using Arduino / General Electronics / Re: emulate open collector on: March 03, 2012, 07:52:57 pm
The weak resistance is a good point, didn't realize the internal pull up's are that large.

My proof of concept runs on an Arduino Mega, but I eventually need it for an ATtiny, so I'm fiddling with direct registers anyway smiley
11  Using Arduino / General Electronics / Re: emulate open collector on: March 03, 2012, 07:15:18 pm
That's a smart option too!

But I was hoping to reduce the number of external components as much as possible because I haven't got a PCB, ... The only thing I'm worried about with my option is if the slopes will stay well defined during the time that the pin is switched from output to input and ........ enabling the pull up. That'd be solved with yours.

Thnx!
12  General Category / General Discussion / Re: avrsh: make program on: March 03, 2012, 07:04:06 pm
I switched to an Arduino Mega and http://bitlash.net/ because I have the impression it has a bit more support for scripting.

I did use the ArduinoISP idea though, be it to program an ATtiny for my mouseWiggler smiley

Thanks for helping me discover the world of Arduino a little further!
13  Using Arduino / General Electronics / emulate open collector on: March 03, 2012, 06:56:21 pm
With the need to drive some electronics with open collector / open drain outputs from Arduino, I just realized that it may just be possible to emulate open collectors with a bit of smart programming. Maybe I'm not the first to come up with this idead, maybe someone has tried it before and has good or bad experience with this method.

The idea is to use the ATmega's internal pull up resistor when in HIGH state as follows:
- To emulate an open collecter / open drain output LOW:
=> pinMode( n , OUTPUT ); digitalWrite( n , LOW );

- To emulate an open collector / open drain output HIGH:
=> pinMode( n , INPUT ); digitalWrite( n , HIGH );

If this works, it'd save an external resistor, transistor and the programmed logic does not need to be inverted.

Thoughts anyone? Anyone tried it before? Caveats? ...
14  Using Arduino / Interfacing w/ Software on the Computer / Skipping NUL bytes sent by Arduino after boot on: March 03, 2012, 04:39:06 am
The idea is that I program my Arduino to continuously spit out data with "Serial.println( ... )". Then in PERL on Linux, I want to capture the data stream and do something fancy with it.

The problem I'm facing is that during boot of the Arduino, it starts sending a varying number of NUL-bytes and these NUL bytes mess up my post processing. So I want to skip these bytes in my PERL script: http://wirespeed.xs4all.nl/mediawiki/index.php/Cat_ttyUSB0
Also there is a hexdump at the bottom of that wiki article that shows the exact problem.

I don't want to use handshaking in the data stream so I can use the same script for other devices than Arduino. Basically what my script needs is:

Code:
if ( next-byte-in-receive-buffer == NUL ) {
   drop-the-byte;
} else {
   leave-the-byte-in-receive-buffer;
}

print $received-byte;

Anyone know how I can peek at the next byte in the serial receive buffer?
15  General Category / General Discussion / Re: avrsh: make program on: November 26, 2011, 04:35:24 am
Thnx for your clear elaboration. I can Google a bit more from here.
Pages: [1] 2