Arduino VDIP problem


       i have make program allows me convert analogic ekg signal board digital signal using arduino duemilanove atmega168 , send memory usb stick in numeric format in *.txt file vdip module.i need write pretty fast arduino vdip,in order accurate numbers in *.txt file(i think 800 bytes per second).i measure ekg signal 1 channel.
       i think key of problem rts , cts pins.i found software how use rts , cts,but i'm not @ software.maybe can me how modify need.thx in advance


code: [select]
// rx tx
#include

newsoftserial usb(2, 3);

int rtspin = 5;
int ctspin = 4;

void setup() {
pinmode(rtspin, input);
pinmode(ctspin, output);

usb.begin(9600);
//usb.begin(57600); // can modify default speed of vdip1 firmware updates 57600 through newsoftserial.
digitalwrite(ctspin, low); // set cts low , keep there.
serial.begin(9600); // opens serial port, sets data rate 9600 bps

serial.print("starting");

usb.print("ipa"); // set ascii mode.
usb.print(13, byte);
}

char usbrx;
byte charin;

void sendtousb(char val) {
while (digitalread(rtspin) == high) { }
usb.print(val);
digitalwrite(ctspin, low);
}

void sendtousbtermcmd() {
while (digitalread(rtspin) == high) { }
usb.print(13, byte);
digitalwrite(ctspin, low);

}

void loop() {
// disable sending on usb device if have filled more 50% of buffer (64 bytes default)
if (usb.available() > 32) {
digitalwrite(ctspin, high);
} else {
digitalwrite(ctspin, low);
}
if (usb.available() > 0) { // read incoming byte
usbrx = usb.read();
if (usbrx == 0x0d) {
serial.println();
} else {
serial.print(usbrx);
}
}
if (serial.available() > 0) { // read incoming byte
if (serial.read() == (byte)'~') {
charin = 0;
while (charin != (byte)'~') { // wait header byte again
if (serial.available() > 0) {
charin = serial.read();
serial.print(charin, hex);
if (charin == (byte)'~') {
serial.println("breaking");
break;
}
sendtousb(charin);
}
}
sendtousbtermcmd();
}
}
}

i found http://www.arduino.cc/cgi-bin/yabb2/yabb.pl?num=1243370818/5


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Arduino VDIP problem


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums