發表文章

目前顯示的是 4月, 2015的文章

[SI]Modbus 通訊協定 資料位址 五位數 和 六位數 問題(About Modbus protocol 5 digit addressing vs 6 digit addressing)

在使用modbus通訊的時候,大多的通訊位址包含了function code為五位數(40003,40123..之類的),而卻也有些設備是六位數,在此說明一下兩者有什麼差異。 在kepware的網站上面有類似的說明,意思是~~~兩者其實沒有差異,在通訊的解析上,41,401,4001,40001這些其實都是一樣的位址,也就是4x1的意思。 所以直接破解了五位數位址和六位數位址的迷思,其實modbus的通訊位址最大可以到65535,也就是465535(4xFFFF)。 給有迷思的朋友參考。 下列為kepware網址說明的原文及頁面連結。 from kepware Modbus: 5 Digit Addressing vs. 6 Digit Addressing   Problem: Although addresses are specified in the device's manual as 0xxxx, 1xxxx, 3xxxx, or 4xxxx, the address is padded with an extra zero once it is applied to the Address field of a Modbus tag. For example, "40001" becomes "400001". Solution: There is no difference between the two addresses. In a Modbus device, the same item can be represented by the following addresses: "41", "401", "4001", "40001", and "400001". Modbus drivers support the data items' full range, and will pad any address to six digits in the User Interface. This will not affect the actual add

[PHP]安裝PHP在Win7 IIS

圖片
這篇要說明如何使用IIS來架PHP的網站(雖然通常大家都用阿帕契來架,但是最近的"你欠囉"風波~~~冷  哈) 1.首先要先安裝IIS,這是廢話也是基本的,但是有個地方一定要注意必須勾選,如下圖 2.下載PHP套件: http://windows.php.net/download/ 這次我下載的是PHP 5.6.8, VC11 x64 Thread Safe (2015-Apr-16 01:46:22) 這個版本(最好是下載 Thread Safe版本 ) 3.解壓縮下載後的壓縮檔並放在  C:\PHP\ 資料夾 4.複製資料夾中的  php.ini-production   檔案,並將檔名改為 php.ini 5.用記事本開啟剛剛所複製改檔名的那個檔案php.ini,並找到下列的設定參數,移除註解(去除";"分號就代表去除註解了)並將值改同下方設定參數的值,完成後儲存設定。 memory_limit = 256M post_max_size = 128M extension_dir = "C:\PHP\ext" upload_tmp_dir = "C:\PHP\upload" upload_max_filesize = 128M max_execution_time = 600 max_input_time = 600 max_input_vars = 2000 cgi.force_redirect = 0 cgi.fix_pathinfo = 1 fastcgi.impersonate = 1 extension=php_curl.dll extension=php_mbstring.dll extension=php_exif.dll extension=php_gd2.dll extension=php_ldap.dll extension=php_mysqli.dll session.save_path = "C:\PHP\session" session.use_cookies = 1 6.建立 " upload

[CSharp]Try Catch 的錯誤字串

        習慣用vb.net在使用try and catch的時候程式碼會自動產生下列的form,其中ex的部分會承接攔截到的錯誤,並可使用ex.message來顯示錯誤訊息         Try         Catch ex As Exception         End Try 但是~~在C#的部分不會自動產生form,且catch也沒有帶Exception。所以在此紀錄一下在C#中的使用格式,如下請參考:             try             {                         }             catch(Exception ex)             {                 MessageBox.Show(ex.Message);             }             finally             {                         }

[PostgreSQL]如果資料表不存在,則建立資料表

單純的語法 CREATE TABLE IF NOT EXISTS Test_Table (SN bigserial PRIMARY KEY, KID character varying(16) NOT NULL, EID int NOT NULL, RLT bit varying NOT NULL, TS timestamp without time zone NOT NULL) 紅色字為資料表名稱,粉紅色為欄位名稱及資料型態,藍色字為判斷指令

[MSSQL、PostgreSQL]列出資料表的欄位與資料型態

圖片
[PostgreSQL] SELECT column_name , data_type from information_schema.columns where table_name = ' test_table '; 紅色字部分為資料表名稱 搜尋結果 UI設定畫面 [MSSQL] SELECT COLUMN_NAME,DATA_TYPE,COLUMN_DEFAULT from information_schema.columns where table_name = ' table_Name ';

[IIS]MS IIS 7 備份與還原(透過命令提示字元)

先將目錄切到  %windir%\system32\inetsrv 備份 在命令提示字元下,鍵入  appcmd add backup <backupname> 。如果沒有包含備份的名稱,系統會使用「日期, 時間」的格式來命名備份。 還原 在命令提示字元下,鍵入  appcmd restore backup <backupname> 參考: https://technet.microsoft.com/zh-tw/library/dd819406.aspx https://technet.microsoft.com/zh-tw/library/dd819405.aspx