Show Posts
Pages: 1 ... 404 405 [406] 407 408 ... 585
6076  General Category / General Discussion / Re: Dual Core 168 Arduino on: August 21, 2011, 08:05:10 pm
Quote
The Dual design overcome by the Mega1280 apparently.
Yeah, that's where I was heading, just use a larger processor.

______
Rob
6077  Using Arduino / LEDs and Multiplexing / Re: Interference in a multiplexer on: August 21, 2011, 07:54:33 pm
Quote
any time a single inputs gets voltage and is read, at least four or five other pins show voltage.
By a volt meter or the ADC?

If volt meter I don't know. If ADC I think it's just a case of the resistor being too large and/or you are reading the inputs too rapidly. Either way I suspect the internal capacitor is not getting enough time to discharge.

Try smaller resistors or longer delays between readings.

______
Rob
6078  General Category / General Discussion / Re: Dual Core 168 Arduino on: August 21, 2011, 07:31:39 pm
Interesting, not sure about sharing the crystal but if it works...

What do you need this for?

______
Rob
6079  Using Arduino / LEDs and Multiplexing / Re: Interference in a multiplexer on: August 21, 2011, 11:51:46 am
Quote
All pins are connected to the ground.
Then how are you measuring a voltage? smiley-confuse

______
Rob
6080  Development / Other Hardware Development / Re: Opposing prongs of tactile switches on: August 20, 2011, 06:38:34 pm
AFIAK the legs are connected internally, there's no reason to connect them externally as well accept in some high-reliability situation where you were worried about a dry joint on one of the legs or something. (in which case you wouldn't use those switches anyway smiley)

______
Rob
6081  Using Arduino / LEDs and Multiplexing / Re: How to do an I/O bus? on: August 20, 2011, 09:25:22 am
It would be quite easy, but all the shields in question would have to have appropriate hardware and at present none do.

______
Rob
6082  Using Arduino / Programming Questions / Re: UART/USART setting the logic to start at LOW instead of HIGH on: August 19, 2011, 10:30:15 am
Quote
0 data bits
0n1, an easy way to generate a square wave at the baud rate /2 smiley

______
Rob
6083  Development / Other Software Development / Re: Using AVR STudio to build Arduino projects on: August 19, 2011, 09:15:25 am
Quote
What do you use for a serial monitor?
Any one of a dozen terminal programs, I like Tera Term.

_______
Rob
6084  Using Arduino / Programming Questions / Re: UART/USART setting the logic to start at LOW instead of HIGH on: August 19, 2011, 09:12:25 am
Quote
if the line is in the 0 state for too long that would be a framing error
AKA a "break" condition.

______
Rob
6085  Using Arduino / Programming Questions / Re: Here's a very simple way of randomly seeding rand() on: August 19, 2011, 09:06:57 am
We had a long thread about this recently and I posted diagrams that looked very much like yours.

But I found quit obvious banding in the data.

I'll see if I can find the thread.

______
Rob
6086  Using Arduino / Programming Questions / Re: How do I detect if I'm receiving serial data. on: August 19, 2011, 08:58:31 am
Quote
tell me HOW I could detect an edge on the RX pin (how would I wire it up) and how to attach an interrupt handler method.
You can wire one of the INT pins to RXD and use attachInterrupt(). 

______
Rob
6087  Using Arduino / Project Guidance / Re: Weather Station command protocol on: August 18, 2011, 08:34:42 pm
Posts crossed.

Sorry, I though they were all the same length. No matter though because you have the packet length so you can either fill an array then have sendCommand() read from the array. Or always have the max number of parms to sendCommand() but only send what you need. I'm inclined to the first approach, something like this


Code:
#define PCK_OFFSET_LENGTH 3
#define PCK_OFFSET_NODE 4
#define PCK_OFFSET_TYPE 5
#define PCK_OFFSET_D0 6
#define PCK_OFFSET_D1 7
#define PCK_OFFSET_D2 8
#define PCK_OFFSET_D3 9

#define PCK_TYPE_READ 0xa1
#define PCK_TYPE_LEDOFF 0xa2
#define PCK_TYPE_CALSPEED 0xa3


uint8_t default_packet [] = {'+', 'w', 's', 0, 0, 0xEB, 0, 0, 0, 0};   
uint8_t packet [sizeof(default_packet)];   
 
void setup() {

  pinMode(DD,OUTPUT);
  digitalWrite(DD, recv);

  RS485.begin(9600);

  initPacket (4, PCK_TYPE_READ);
  sendCommand();
 
  initPacket (7, PCK_TYPE_LEDOFF);
  sendCommand();
 
  initPacket (6, PCK_TYPE_CALSPEED);
  packet[PCK_OFFSET_D0] = 100;
  packet[PCK_OFFSET_D1] = 2;
  sendCommand();
 
}

void initPacket (uint8_t length, uint8_t type) {
memcpy (packet, default_packet, sizeof(default_packet));
packet[PCK_OFFSET_LENGTH] = length;
packet[PCK_OFFSET_TYPE] = type;
 }

void sendCommand () {
uint8_t chksum = 0;

for (int i = 0; i < sizeof(default_packet); i++) {
    RS485.write(packet[i]);
chksum += packet[i];
}
RS485.write(chksum);
}

______
Rob
6088  Using Arduino / Project Guidance / Re: Weather Station command protocol on: August 18, 2011, 08:24:46 pm
Yes, but if va_arg can return a value into a variable is can also return it as the argument of a function call, no need to temp store it in a variable.

RS485.write(va_arg(argp, int)); 

Unless there's something funky about va_arg I've forgotten about (which is possible, I haven't used it for about 15 years smiley)

______
Rob
6089  Using Arduino / Project Guidance / Re: Weather Station command protocol on: August 18, 2011, 07:25:22 pm
Quote
Is there an easier/more elegant way to handle these variable length commands
I'd be inclined to make them NOT variable length, eg

Code:

  sendCommand(head, 7, 0, 0xeb, 0xa1,4,0,0,0); // read all the data
  sendCommand(head, 7, 0, 0xeb, 0xa2,0,0,0,0); // turn off the LEDS
  sendCommand(head, 6, 0, 0xeb, 0xa3, 100, 2,0,0); // set the speed cal to 100

______
Rob
6090  Using Arduino / Project Guidance / Re: Weather Station command protocol on: August 18, 2011, 07:22:35 pm
You don't need all those local variables in sendCommand().

Code:
  case 0xa4:
    _direction = va_arg(argp, int);
    RS485.write(_direction); 
    break;
can be
Code:
  case 0xa4:
   RS485.write(va_arg(argp, int)); 
    break;

Also
Code:
case 0xa3:
    _speed = va_arg(argp, int);
    RS485.write(_speed);
    while (_count > 0) {
      RS485.write(0x00);
      _count--; 
    }
    break;

count is not initialised.

______
Rob
Pages: 1 ... 404 405 [406] 407 408 ... 585