Show Posts
Pages: [1] 2 3 4
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino network possible?? on: August 20, 2006, 08:54:23 am
Hi ! I found "serial.databits=8" in "preferences.txt" . I want to make sure that this "databit" use for bootloader or use for my  programme ?

and I can't find any other "databits" in ARDUINO/lib/targets/arduino , could you tell me where to find the "databit" use for my  programme? thank you !
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino network possible?? on: August 19, 2006, 08:29:03 am
If we can change Arduino's hardware serial port from 8 bit data to 9 bit data , we can build a Arduino network, but it need to modify the lib of Arduino, I don't know how to do it , who can give me some tutorials ?
3  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino network possible?? on: August 18, 2006, 08:03:53 am
I think we can't use I2C (Wire) library directly , the I2C in Wiring use pin0 and pin1 , but in Arduino , I2C at analog 5(SCL) and analog 4(SDA) , but we can't use these two pin .
4  Forum 2005-2010 (read only) / Troubleshooting / Re: How to use AD6 & AD7 in "Arduino Mini" on: September 17, 2006, 07:00:36 pm
kuk:
Yes , I change "ch = analogInPinToBit(pin) " to "ch = pin" , in "analogInPinToBit(pin)" , there are only return 0~5 , now you can use 0~7,  but I don't have "Arduino Mini" , so I can't test it , if it can't work , I so sorry about it.
5  Forum 2005-2010 (read only) / Troubleshooting / Re: How to use AD6 & AD7 in "Arduino Mini" on: September 17, 2006, 06:49:58 am
kuk[ch65306]
I think mellis is right , AD6 and AD7 are the number of  "CH" , it is easy to add them ,and make them work  smiley-wink . but I don't have "Arduino Mini" , so I can't test it , I will buy some M168 next week to make it sure.
the code:
Code:
int analogRead(int pin)
{
      unsigned int low, high, ch = pin;

      // the low 4 bits of ADMUX select the ADC channel
      ADMUX = (ADMUX & (unsigned int) 0xf0) | (ch & (unsigned int) 0x0f);

      // without a delay, we seem to read from the wrong channel
      delay(1);

      // start the conversion
      sbi(ADCSRA, ADSC);

      // ADSC is cleared when the conversion finishes
      while (bit_is_set(ADCSRA, ADSC));

      // we have to read ADCL first; doing so locks both ADCL
      // and ADCH until ADCH is read.  reading ADCL second would
      // cause the results of each conversion to be discarded,
      // as ADCL and ADCH would be locked when it completed.
      low = ADCL;
      high = ADCH;

      // combine the two bytes
      return (high << 8) | low;
}

6  Forum 2005-2010 (read only) / Troubleshooting / Re: How to use AD6 & AD7 in "Arduino Mini" on: September 16, 2006, 09:42:56 pm
I'm sorry , M168 have 6 PWM
7  Forum 2005-2010 (read only) / Troubleshooting / Re: How to use AD6 & AD7 in "Arduino Mini" on: September 16, 2006, 09:40:44 pm
Hi! I know M168 have 5 PWM(D/A) , and I don't know how to add the other 2 PWM in :
Code:
int analog_out_pin_to_timer_array[NUM_DIGITAL_PINS] = {
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      // on the ATmega168, digital pin 3 has pwm
#if defined(__AVR_ATmega168__)
      TIMER2B,
#else
      NOT_ON_TIMER,
#endif
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      NOT_ON_TIMER,
      TIMER1A,
      TIMER1B,
#if defined(__AVR_ATmega168__)
      TIMER2A,
#else
      TIMER2,
#endif
      NOT_ON_TIMER,
      NOT_ON_TIMER,
};

If Arduino 06 can add these new AD and DA to soft , it will be better!
8  Forum 2005-2010 (read only) / Troubleshooting / How to use AD6 & AD7 in "Arduino Mini" on: September 10, 2006, 07:42:14 am
Hi ! "ATmega8/168 AI" have two more AD pin(AD6 & AD7) , Arduino use "ATmega8 PI" , so only have 6 AD pin(0-5) .

Now I see "Arduino Mini" use "ATmega168 AI" ,and have the AD6 & AD7 , I want to make sure that could I use " analogRead(6) ;" to use AD6 ?

thank you !
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Software Serial & hardware serial at the same on: August 20, 2006, 08:44:59 am
I only read 10 times in Software Serial , if on data come, try next loop, no still wait . these code just fit my purpose .
hope it is useful.

Code:
#include <ctype.h>

#define bit9600Delay 84  
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94

int flag,i;

byte rx = 6;
byte tx = 7;
byte SWval;

void setup() {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  digitalWrite(tx,HIGH);
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint('i');
  SWprint(10); //carriage return
  beginSerial(9600);
  flag=0;
}

void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit9600Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
      digitalWrite(tx,HIGH); // send 1
    }
    else{
      digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit9600Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit9600Delay);
}

int SWread()
{
  byte val = 0;
  for(i=0;i<10;i++){

    if (digitalRead(rx) == LOW && flag==0) {
      delayMicroseconds(halfBit9600Delay);
      for (int offset = 0; offset < 8; offset++) {
        delayMicroseconds(bit9600Delay);
        val |= digitalRead(rx) << offset;
      }
      //wait for stop bit + extra
      delayMicroseconds(bit9600Delay);
      delayMicroseconds(bit9600Delay);
      flag=1;
    }
    return val;
  }
}

void loop()
{
  SWval = SWread();
  SWprint(toupper(SWval));
  delay(100);
  printString("hello!");
}
10  Forum 2005-2010 (read only) / Troubleshooting / Re: Software Serial & hardware serial at the same on: August 19, 2006, 08:21:14 am
Hi! I make them work at the same time now!  smiley-grin  the "SWread()" should add a overtime detect.
11  Forum 2005-2010 (read only) / Troubleshooting / Software Serial & hardware serial at the same time on: August 18, 2006, 06:44:48 am
Hi ! I see the Arduino Software Serial Interface , and I make it work . but when I try to use "hardware serial" and  "Software Serial"  at the same time , only "Software Serial" work , is there somebody can make them work at the same time ? or it is impossibility?

my code:

Code:
#include <ctype.h>

#define bit9600Delay 84  
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94

byte rx = 6;
byte tx = 7;
byte SWval;

void setup() {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  digitalWrite(tx,HIGH);
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint('i');
  SWprint(10); //carriage return
  beginSerial(9600);
}

void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit9600Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
     digitalWrite(tx,HIGH); // send 1
    }
    else{
     digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit9600Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit9600Delay);
}

int SWread()
{
  byte val = 0;
  while (digitalRead(rx));
  //wait for start bit
  if (digitalRead(rx) == LOW) {
    delayMicroseconds(halfBit9600Delay);
    for (int offset = 0; offset < 8; offset++) {
     delayMicroseconds(bit9600Delay);
     val |= digitalRead(rx) << offset;
    }
    //wait for stop bit + extra
    delayMicroseconds(bit9600Delay);
    delayMicroseconds(bit9600Delay);
    return val;
  }
}

void loop()
{
    SWval = SWread();
    SWprint(toupper(SWval));
    delay(100);
    printString("hello!");
}
12  Forum 2005-2010 (read only) / Bugs & Suggestions / Arduino serial network on: August 20, 2006, 03:26:11 am
If we can change Arduino's hardware serial port from 8 bit data to 9 bit data (the add one bit used to differentiate address or data), we can build a Arduino network, but it need to modify the lib of Arduino, I don't know how to do it , who can give me some tutorials ?

thank you!
13  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How to config serproxy at "com10" on: February 20, 2006, 03:08:23 pm
Thank you mellis!
I just chang the com from 10 to 8 , it can work ,
so I think it maybe a bug.
14  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How to config serproxy at "com10" on: February 19, 2006, 01:43:18 am
Thank you mellis !
But it can't work :"Failed to open comm port - connection refused"

Is it a bug ?  

and I download the source of serproxy , but I can't open it with VC++ 6.0 , it lose "*.mak" thank you!
15  Forum 2005-2010 (read only) / Frequently-Asked Questions / How to config serproxy at "com10" on: February 18, 2006, 06:06:19 pm
Hi!
my Arduino work at "com2" in one of my PC , and I can get it work with flash well, but these days , I use another PC that Arduino work at com10

then I make the .cfg like that, but it dosen't work , how to get it work , when at high com num , thank you!

# Comm ports used
comm_ports=1,2,3,10

# Default settings
comm_baud=9600
comm_databits=8
comm_stopbits=1
comm_parity=none

# Idle time out in seconds
timeout=300

# Port 1 settings (ttyS0)
net_port1=5331

# Port 2 settings (ttyS1)
net_port2=5332

# Port 3 settings (ttyS2)
net_port3=5333

# Port 4 settings (ttyS3)
net_port4=5340

Pages: [1] 2 3 4