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 !
|
|
|
|
|
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  . 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: 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; }
|
|
|
|
|
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 : 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!
|
|
|
|
|
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. #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!"); }
|
|
|
|
|
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: #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!
|
|
|
|
|
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
|
|
|
|
|