User Tools

Site Tools


how_tos:serial_port_programming

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
how_tos:serial_port_programming [2017/03/31 13:10]
jeff
how_tos:serial_port_programming [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======Serial Port Programming====== ======Serial Port Programming======
  
-WattmonPRO comes with an RS-232 serial interface on pins 7 and 8 and an RS-485 port on an RJ45 connector.  The device is configured by default for RS-232 voltage levels and by using a simple DB9 cable can be connected to any serial device.  For specific devices that require TTL levels, a jumper setting inside the device can bypass the level converter IC and it can thus be used to interface with sensors or other devices at 3.3V DC.+[[hardware:wattmons:WattmonPRO]] and [[hardware:wattmons:WattmonMEGA]] come with an RS-232 serial interface on pins 7 and 8 and an RS-485 port on an RJ45 connector.  The device is configured by default for RS-232 voltage levels and by using a simple DB9 cable can be connected to any serial device.  For specific devices that require TTL levels, a jumper setting inside the device can bypass the level converter IC and it can thus be used to interface with sensors or other devices at 3.3V DC.
  
 =====Using the RS-232 Serial Port===== =====Using the RS-232 Serial Port=====
  
-To open the serial port, use the [[.functions:fseropen()]] function.  +To open the serial port, use the [[uphp:functions:fseropen()]] function.  
-The serial port is treated like a file after opening and standard file functions such as [[.functions:fread()]], [[.functions:fwrite()]], [[.functions:fgets()]] and [[.functions:filesize()]] apply.+The serial port is treated like a file after opening and standard file functions such as [[uphp:functions:fread()]], [[uphp:functions:fwrite()]], [[uphp:functions:fgets()]] and [[uphp:functions:filesize()]] apply.
  
 An example of using the serial port is shown below: An example of using the serial port is shown below:
Line 27: Line 27:
 ====Jumper Settings Inside Wattmon==== ====Jumper Settings Inside Wattmon====
  
-{{:wiki:rs232_mode.png?250|}} < //Settings For RS-232 Mode   //{{:wiki:ttl_mode.png?250|}} < //Settings for TTL Mode//+{{20170318_rs232_mode.png?250|Settings for RS-232 Mode}} < //Settings for RS-232 Mode   //{{20170318_ttl_mode.png?250|Settings for TTL Mode}} < //Settings for TTL Mode//
  
 ====RS-232 Cable Connection==== ====RS-232 Cable Connection====
  
 In order to connect to a device you will need to procure a DB9 cable (male or female) and connect it up as shown in the following diagram: In order to connect to a device you will need to procure a DB9 cable (male or female) and connect it up as shown in the following diagram:
-{{:wiki:wattmonpro_rs232.png?300|}}+{{20170318_wattmonpro_rs232.png?300|RS-232 DB9 Connection to Wattmon}}
  
 =====Using the RS-485 Serial Port===== =====Using the RS-485 Serial Port=====
Line 38: Line 38:
 In order to use the RS-485 port, you need to disable modbus polling.  This is done from the Devices > Options > Edit Communication Settings as shown here: In order to use the RS-485 port, you need to disable modbus polling.  This is done from the Devices > Options > Edit Communication Settings as shown here:
  
-{{:wiki:modbus_polling_setting.png?600|}}+{{20170318_modbus_polling_setting.png?600|Disable Modbus Polling}}
  
-To open the RS-485 port, use the [[.functions:f485open()]] function.  +To open the RS-485 port, use the [[uphp:functions:f485open()]] function.  
-The RS-485 serial port is treated like a file after opening and standard file functions such as [[.functions:fread()]], [[.functions:fwrite()]], [[.functions:fgets()]] and [[.functions:filesize()]] apply.+The RS-485 serial port is treated like a file after opening and standard file functions such as [[uphp:functions:fread()]], [[uphp:functions:fwrite()]], [[uphp:functions:fgets()]] and [[uphp:functions:filesize()]] apply.
  
 An example of using the RS-485 serial port is shown below: An example of using the RS-485 serial port is shown below:
Line 62: Line 62:
 ====RS-485 Cable Connection==== ====RS-485 Cable Connection====
  
-Use a standard RJ-45 cable and cut it to connect your RS-485 device to WattmonPRO.  +Use a standard RJ-45 cable and cut it to connect your RS-485 device to [[hardware:wattmons:WattmonPRO]] or [[hardware:wattmons:WattmonMEGA]].  
 ^ PIN      ^ Color      ^ Description    ^ ^ PIN      ^ Color      ^ Description    ^
 | 1,2      | Orange     | GND            | | 1,2      | Orange     | GND            |
Line 68: Line 68:
 | 5        | White-Blue | D- / B         | | 5        | White-Blue | D- / B         |
  
-{{:wiki:rj45_connector_pinout.png|}}+{{20170318_rj45_connector_pinout.png?450|RJ45 Connection Pinout}}
how_tos/serial_port_programming.1490965813.txt.gz · Last modified: 2021/09/13 05:56 (external edit)