HDC2450 RS232

9 years 4 months ago #29525647 by daleonpz
HDC2450 RS232 was created by daleonpz
I\'ve made a code that send by RS232 the command \"!M 0 1000 r\", but my motor didn\'t move. Im using as a controller a 32-bit processor with Vout =3.3V.

here\'s my C code: RS232 has been configured at 115200,8,n,1
void Mcmd(out port TXD, char Mcmd1[], char Mcmd2[])
{
int dlay=10;
led <: 15;
for(int i=0;M[i]!=\'\';i++)
{ txByte(TXD,M[i]);
delay(dlay);
}
for(int i=0;Mcmd1[i]!=\'\';i++)
{ txByte(TXD,Mcmd1[i]);
delay(dlay);
}
txByte(TXD,\' \');
delay(dlay);
for(int i=0;Mcmd2[i]!=\'\';i++)
{ txByte(TXD,Mcmd2[i]);
delay(dlay);
}
txByte(TXD,10);
delay(dlay);
txByte(TXD,\'\\r\');
delay(dlay);

}

i do really need some help asap. By the way, i\'ve modified the 25-pin connector, i wired:
pin 1: GND
pin 2: Txout
pin 3: Rxin

and i\'ve disable the watchdog.

Please Log in or Create an account to join the conversation.

9 years 4 months ago #29525653 by cosma
Replied by cosma on topic Re:HDC2450 RS232
The delays should not be necessary.

Why are you sending a \'r\' in txByte(TXD,\'r\'); at the end?

All you need to terminate is to send a CR wich is Dec 13. You are sending 10 which is LF.

Also, make sure that your microcomputer outputs a real RS232 signal (ie. +12/-12V output, inverted) and not a non inverted TTL.

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.101 seconds