ba
acprfren

UART communication(Universal Asynchronous Receiver/Transmitter)

the UART communication protocol is composed of three electric wire
Tx == transmission
Rx == Reception
GND == reference 0V
the alimentation of Tx and Rx pins is +or- equal at +12v, -12v.
For using the UART library you must install the librs232 on Angstrom
CMD: opkg install librs232
the serial link allows communication with the dsPIC. for example if
you want to move the robot, the Beagelboard send a tram towards of
dsPIC. see Communication protocol in part "5) Study" for more
information

Description of use to librs232:


initialisation
// declare and initialize the structure at null
struct rs232_port_t *p = NULL;
// initialize the serial link
p = rs232_init();
// choose the port of communication
rs232_set_device(p, "/dev/ttyS2");
// open the serial link
ret = rs232_open(p);

speed
// choose the speed
rs232_set_baud(p, RS232_BAUD_115200);

send
// write the character
ret = rs232_write_timeout(p, data, 1, &bytes, 1000);

receive
// read the character
ret = rs232_read_timeout(p, data, 1, &bytes, 1000);

close
// close the serial link
rs232_end(p);

please look the example of constructor at next address:
https://github.com/ynezz/librs232/blob/master/src/rs232_test.c

uart

 

Nous écrire :mail