Serial Port Complete - Latest Microcontroller projects
Chapter 12 internal void DataReceived( object sender, SerialDataReceivedEventArgs e ) { string newReceivedData = null; newRe ...
13 ()* , & This chapter presents a basic network that uses a primary/secondary protocol. A primary node sends comm ...
Chapter 13 Figure 13-1: The RS-485 network can use this wiring to connect the nodes. ...
An RS-485 Network USB/RS-485 converter, or an RS-232/RS-485 converter that connects to an RS-232 port. Microcontroller ports can ...
Chapter 13 Byte 2 is a command code. Additional bytes can contain data specific to the command. Some com- mands have no command- ...
An RS-485 Network The response to read_byte contains the requested byte in ASCII Hex format: A command sent to node h to read a ...
Chapter 13 - 65 The write_byte command writes a byte of data to a specified location in a sec- ondary node. The locati ...
An RS-485 Network These are the values transmitted in hexadecimal: 3a 69 0a ## $ On a PC that functions as the prim ...
Chapter 13 private void Rs485DriverEnableControl(bool driverDisable) { if (driverDisable) { myComPort.RtsEnable = false; } e ...
An RS-485 Network If softwareDriverEnable Then ' Read back what was transmitted to ensure that all of the data ' has gone out. ' ...
Chapter 13 // Uncomment one of these lines to indicate the method of controlling the RS-485 // driver-enable line. private b ...
An RS-485 Network if (response.StartsWith(":")) { if (response.Substring(1, 1) == node) { switch (command) { case "1": Console.W ...
Chapter 13 The code supports a firmware-controlled or hardware-controlled driver-enable line. If needed, the firmwar ...
An RS-485 Network ' Uncomment one of these lines. ' delay_before_responding = 0 ' No delay before responding. delay_before_respo ...
Chapter 13 byte command_index; char command_response[6]; char network_state = 'r'; char received_command[6]; byte response_index ...
An RS-485 Network loop: gosub serial_communications ' Add other tasks here. goto loop serial_communications: select case net ...
Chapter 13 while(1) { serial_communications(); // Add other tasks here. } void serial_communications(void) { switch (network ...
An RS-485 Network If delay_before_responding isn’t defined, the timer never starts and communi- cations never enter the “d” stat ...
Chapter 13 void start_response_delay_timer(void) { // This example sets a delay of around 0.5 second assuming FOSC = 4 MHz. ...
An RS-485 Network , & #"" 0 The network encodes data in ASCII Hex format. Chapter 2 show ...
«
11
12
13
14
15
16
17
18
19
20
»
Free download pdf