View Single Post
Old 12-09-2010, 07:58 AM   #30 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
re: spaghetti wiring, the lcd connections were originally chosen to be pretty much a straight shot from the digital pins layout on an arduino while leaving the special purpose pins open (pwm/uart). Then I realized contrast could be controlled in software so I moved the contrast lcd lead over to a pwm pin. If you look at the diagram http://opengauge.googlecode.com/svn/...ino/wiring.GIF you will notice most of the lcd leads that go directly to the arduino do not cross, except the contrast lead from lcd3 to arduino 6. The other connections to the lcd are the ground "bus", 5 volts from the other side of the board, and backlight power (pwm'd via an external transistor controlled via arduino 9).

Since that side of the board was already so crowded, I started using the pins on port C for buttons/speed.

re: interrupts, Both vehicle speed and buttons are handled by the same interrupt, since ultimately they are on the same port once you decode the arduino pin wiring http://arduino.cc/en/uploads/Hacking...mega8-Pins.png. I think arduino interrupts were limited to just the two INT0 and INT1 when this was written, and arduino wrappers soak up performance and resources anyway. It is much tighter to read all the port pins into a byte with one instruction, which is especially critical in an interrupt.

//attach the vss/buttons interrupt
ISR( PCINT1_vect )
{
static byte vsspinstate = 0;
byte p = PINC;//bypassing digitalRead for interrupt performance


Also, at the time there was discussion about using a pwm to drive a piezo on pin 10 to do various "chimes" as another feedback channel:
http://www.arduino.cc/cgi-bin/yabb2/...num=1228475606
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 12-09-2010 at 08:22 AM..
  Reply With Quote