Posts

Showing posts from April, 2021

Delta PLC Read/Write internal relay M in C#

Image
Delta PLC provides Modbus communication library DMT, which can be used in C# ​​to communicate with Delta PLC over RS485 (Modbus). First of all to use DMT with your application following functions should be imported from kernel32.dll and DMT.dll: using System.Reflection; [DllImport( "kernel32.dll" , CharSet = CharSet.Auto)] static extern IntPtr LoadLibrary ( string dllPath ) ; [DllImport( "kernel32.dll" , CharSet = CharSet.Auto)] static extern bool FreeLibrary ( IntPtr hDll ) ; // Serial Communication [DllImport( "DMT.dll" , CharSet = CharSet.Auto)] static extern int OpenModbusSerial ( int conn_num, int baud_rate, int data_len, char parity, int stop_bits, int modbus_mode ) ; [DllImport( "DMT.dll" , CharSet = CharSet.Auto)] static extern void CloseSerial ( int conn_num ) ; // MODBUS Address Calculation [DllImport( "DMT.dll" , CharSet = CharSet.Auto)] static extern int DevToAddrW ( string seri

Secure Instant Messaging

Image
    Install  Secure Instant Messaging has following features: Secure IP Messaging with private\public keys RSA decryption/encryption Generate key pair and save keys as files

3DES File Encryption (C#)

Image
In cryptography, Triple DES (3DES or TDES) is a symmetric-key block cipher, which applies the DES cipher algorithm three times to each data block.   https://en.wikipedia.org/w/index.php?title=Triple_DES&oldid=995820064  To use 3DES functionality first off all we need to include “System.Security.Cryptography”. using System.Security.Cryptography;   Then we should create and adjust an object which will do encryption: var tdese = TripleDES.Create(); tdese.Mode = CipherMode.ECB; tdese.Padding = PaddingMode.PKCS7; tdese.Key = ConvertHexStringToByteArray( "AABBCCDDEE11223344556677889900FF" ); var encryptor = tdese.CreateEncryptor();  “ConvertHexStringToByteArray” function to convert hex string to byte array: public static byte [] ConvertHexStringToByteArray ( string hexString ) { if (hexString.Length % 2 != 0 ) { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number

Arduino Wifi Setup

Image
A IoT device programmed with Arduino need connect to WiFi at start of device to use internet for data transfer etc. First of all we need to include header file “WiFiClient” to our sketch. # include <WiFiClient.h> With code below we will let user enter WiFi credentials over serial communication. we should add this code to our setup() part of our Arduino sketch. Serial . write ( "Please enter name of your wifi network\n" ); while ( Serial . available () == 0 ){}; String Uid= Serial . readStringUntil ( '\n' ); Serial . write ( "Please enter password of your wifi network\n" ); while ( Serial . available () == 0 ){}; String pass= Serial . readStringUntil ( '\n' ); If you want give user a tool to setup WiFi over serial you can download a free serial communication tool “Vengito Serial Tool”. With this tool user can connect IoT device easily and enter WiFi credentials. Download "Vengito Serial Tool"   For more software tools   Af

How to do Simulations with Scilab Xcos Tutorial Video _ Part 1

Image
    In this video i will give 4 simple examples of using Scilab Xcos for simulation.  Examples:  Display a simple sine wave  Algebraic loop example  Example for lookup table  Example for derivative of time dependent function (derivative of x²: 2x)

LabVIEW Example Videos _ Part 1

Image
    In this video i will give 4 simple examples of using LabVIEW.  Examples:  Display a simple sine wave  Algebraic loop example  Get value of array element  Build array with for loop