Hi
I've got a Arduino Due and an GRATTEN ATF20B+ function generator. My goal is that i can control the function generator over RS232 with the Arduino Due. I've already implemented a levelshifter from 3,3 to RS232 levels. But im struggeling. It seems that the transmission format for the function generator is special and cannot handled by a simple Serial.write();
According to datasheet of the function generator:
"Each transmission frame consists of 11 bits: 1 start bit (logic "0"), 8 data bits (ASCII code), 1 index bit (address logic ="1", data logic ="0"), 1 stop bit (logic "1")."
I tired with this code:
byte cData[100];
int nBytesAvail = 0;
int nBytes = 0;
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
Serial.println("start");
}
void loop(){
if ((nBytesAvail = Serial1.available())>0)
{
nBytes = Serial1.readBytes(cData, nBytesAvail);
Serial.write(cData, nBytes);
}
if ((nBytesAvail = Serial.available())>0)
{
nBytes = Serial.readBytes(cData, nBytesAvail);
Serial1.write(cData, nBytes);
}
}
Unfortunately it doesn't work. I need to send a special command over RS232 to enter full access of the function generator. Here the link to the function generator datasheet. I set the function generator to adress 1 and set it to 115200baud. then sending with the code above 1RS232 command to enter the full RS232 mode. But nothing happens.
In my understanding now i need to access a bit level instead of a byte level so i can set the bits right.
It would me make very happy if you could assist me in this.
ATF20B_User_Manual.pdf (668 KB)