Serial Port Complete - Latest Microcontroller projects
Chapter 13 void byte_to_ascii_hex(unsigned char value_to_convert, char converted_value[]) { char upper_nibble; char lower_ni ...
An RS-485 Network ' Convert each character code to the value it represents. select case upper_nibble case "0", "1", "2", "3", "4 ...
Chapter 13 int ascii_hex_to_byte(char upper_nibble, char lower_nibble) { // Return the byte value represented by the ASCII H ...
An RS-485 Network switch (lower_nibble) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case ' ...
Chapter 13 5 & On receiving a byte and storing it in the char variable serial_in, a node can exami ...
An RS-485 Network case COMMAND_START ' A new command has begun. ' Initialize the array that holds received bytes. received_comma ...
Chapter 13 void receive_serial_data(void) { // Process received bytes. if (DataRdyUSART()) { // The serial port has received ...
An RS-485 Network case 0x0d: { // Ignore a received CR character. break; } case COMMAND_START: { // A new command has begun. // ...
Chapter 13 5 The respond_to_command routine responds to the two commands defined earlier in this chapt ...
An RS-485 Network void respond_to_command(void) { // On receiving a valid command, call a routine to handle the specific com ...
Chapter 13 else { initialize_serial_buffers; } } On receiving an invalid command, the initialize_serial_buffers routine re-ini- ...
An RS-485 Network 3 & The routine below handles the write_byte command. The routine sets a port bit to match ...
Chapter 13 void command_write_byte(void) { int received_data; switch (received_command[3]) { case 'b': { // Get the data to ...
An RS-485 Network 5 & The function below handles the read_byte command. The function reads a port and prepares ...
Chapter 13 void command_read_byte(void) { switch (received_command[3]) { case 'b': { // Read Port B. // Store the value read ...
An RS-485 Network After the prepare_to_respond routine executes and any required delay elapses, the network is in the âtâ state. ...
Chapter 13 void transmit_serial_data(void) { if defined firmware_driver_enable driver_enable = 1; endif while(BusyUSART()); ...
14 % USB is a hardware interface with defined protocols that enable a host computer to communicate with a variety of per ...
Chapter 14 host is a PC or another computer that contains host-controller hardware and software. A device is a peripheral or oth ...
Inside USB ment USB protocols. To communicate with COM-port devices, the host must support the COM-port software interface and m ...
«
11
12
13
14
15
16
17
18
19
20
»
Free download pdf