Ⅰ 請教procomm plus 的基本使用方法
1 串口腳本
有些串口工具(例如串口調試助手)有定時發送功能,但只能發送一條固定的命令。我需要發送幾百條命令,又懶得寫程序,就希望找一個可以執行串口腳本的工具。然後我找到了procomm plus。
procomm plus的功能很多。我只需要串口腳本功能,所以沒有執行安裝程序,解壓後直接執行Programs目錄的PW5.EXE。在菜單中選擇Options->System Options->Modem Connection...,在「Current Modem/Connection」的下拉列表中選擇要打開的串口或modem。在主窗口下方可以直接點擊、設置編碼格式、波特率。編碼格式可以選擇RAW ASCII。在主窗口可以直接敲AT命令,看到響應,和超機終端差不多。
在菜單中選擇Tools->Scripts,就可以看到腳本相關的菜單,包括執行、編譯、編輯、錄制腳本。procomm plus的腳本系統叫做ASPECT,功能看上去很強大,可以定義變數,有for、while 等流程式控制制,甚至包括接受用戶輸入的對話框。procomm plus中有完善的教程和幫助文檔。
我當然不會先看文檔。首先做的就是錄制一個腳本,看看大概是什麼樣子,然後照貓畫虎編寫自己的腳本。腳本的源文件是後綴為WAS的文件。源文件經過編譯才能運行,編譯產生的文件後綴是wax。
如果讀者也是只想用串口腳本功能,建議不要安裝procomm plus,直接運行就可以了。安裝後,每次啟動會檢測所有modem,浪費時間。
2 腳本示例
2.1 發送大量命令
我要做的一個事情就是給一個modem打補丁,要發送兩百多條命令。例如:
AT:PIB AT:Pf800,7b5d,4dc,7b5f,4de,7b59,4d8,7b5b,4da AT:Pf808,7b55,4d4,7b57,4d6,7b51,4d0,7b53,4d2 ...
modem對這些命令的響應都是"\r\nOK\r\n"。通過錄制的腳本,可以看到發送命令並等待響應的過程可以用以下語句完成:
transmit "AT:PIB^M" waitfor "K^M^J"
顯然transmit就是向串口寫。waitfor就是等待響應了。^M是回車符0D(就是\r)、^J是換行符0A(就是\n)。 waitfor語句在等待正常響應的最後3個字元。看懂這兩句後,編寫腳本的過程就是對要發送命令的簡單替換。 我常用的文本編輯器是我自己寫的cnbook。在cnbook中將行首
^
替換成
transmit "
將行尾
$
替換成
^M"\n waitfor "K^M^J"
替換時要選上「正則表達式」。將替換後的文本放到
proc main endproc
之間就可以了。完整的腳本看上去是這樣:
proc main transmit "AT:PIB^M" waitfor "K^M^J" transmit "AT:Pf800,7b5d,4dc,7b5f,4de,7b59,4d8,7b5b,4da^M" waitfor "K^M^J" transmit "AT:Pf808,7b55,4d4,7b57,4d6,7b51,4d0,7b53,4d2^M" waitfor "K^M^J" ... endproc
以後我需要打補丁,就是執行這兩百多條命令的時候,只要執行這個腳本就可以了。
2.2 自動測試
我需要通過串口敲鍵測試一台設備。我錄制了一次測試過程,然後用for循環自動測試100次。腳本看上去是這樣:
proc main integer Num ; Integer variable to increment. for Num = 0 upto 100 ; Init variable and define loop. transmit "o" waitfor "wait ..." transmit "1" waitfor "wait ..." transmit "0" waitfor "wait ..." transmit "0" waitfor "wait ..." transmit "0" waitfor "xt_connected_enter^M^J" transmit "p" waitfor "xt_idle_enter^M^J" ... endfor endproc
當然,在很多情況下,人工測試比自動測試更容易發現問題。不過,用串口腳本作自動測試也可以作為一種輔助的手段。
3 結束語
procomm plus的功能還有很多,它的腳本系統ASPECT的功能也遠遠不止於此。不過目前我只用到這些。
Ⅱ 809h打開串口的方法
rt809h可以通過在腳本數據中opendata打開串口。
然而在國外的發達國家早已經都普級化的在使用了,不管是家用還在商用或在軍工級使用。為什麼發達國家使用的這么廣泛呢?一,是因為別人的技術領先於我們,在我們的有線網線還沒有普及時他們的無線網路都已線開發的比成熟了。
於2010年九漢推出了232/485轉WIFI的串口設備H-601。基於技術和成本現階段基本上已經解決了,最要的是要使H-601能夠廣泛的應用到各種工業領域,也解決布線的困難。
232/485轉WIFI設備支持通過指定信道號的方式來進行快速聯網。在通常的無線聯網過程中,會首先對當前的所有信道自動進行一次掃描,來搜索准備連接的目的AP創建的(或Adhoc)網路。本模塊提供了設置工作信道的參數,在已知目的網路所在信道的條件下,可以直接指定模塊的工作信道,從而達到加快聯網速度的目的。
2無線漫遊:232/485轉WIFI設備支持基於802.11協議的無線漫遊功能。無線漫遊指的是為了擴大一個無線網路的覆蓋范圍,由多個AP共同創建一個具有相同的SSID/ESSID的無線網路,每個AP用來覆蓋不同的區域,接入到該網路的STA可以根據所處位置的不同選擇一個最近(即信號最強)的AP來接入,而且隨著STA的移動自動的在不同的AP之間切換。
Ⅲ 請問有什麼好用的串口調試助手嗎
推薦伏特加串口調試助手,用起來真的很方便
Ⅳ 嵌入式ARM linux系統如何設置開機啟動應用程序
其實樓主的問題很專業,之前我在周立功那邊也了解過不少。
當用戶需要EasyARM-iMX283在開機啟動後就運行指定的應用程序或指令時,可以通過vi命令編輯/etc/rc.d/init.d/start_userapp,將要執行的指令添加到裡面。若用戶有一個hellow的程序放在/home/目錄中,那麼設置hellow程序開機啟動的方法如程序清單 1.1紅色部分所示。
程序清單1.1 用戶啟動文件
#!/bin/sh
#you can add your app start_command three
/home/hellow
#start qt command,you can delete it 下面是啟動QT界面的指令,若用戶不需要啟動QT,可以直接刪除
export TSLIB_PLUGINDIR=/usrb/ts/
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_TSDEVICE=/dev/input/ts0
export TSLIB_CALIBFILE=/etc/pointercal
export QT_QWS_FONTDIR=/usrb/fonts
export QWS_MOUSE_PROTO=Tslib:/dev/input/ts0
/usr/yuan/zylauncher/start_zylauncher &
如果程序是一個阻塞程序(程序被運行後不會退出或返回),則可能會導致位於其後的指令或程序無法得到執行,並且始終佔用串口終端,造成其他程序(比如Shell)無法通過串口終端與用戶交互。對於此類應用程序,可以在其後面添加「 &」(注意:是「空格」+「&」符號)讓其在後台運行,如下所示:
/home/hellow &
Ⅳ MCGS觸摸屏的腳本程序能實現什麼功能,怎樣編寫
這個功能可太多了,數學運算、畫面切換、串口通信、數據存取、屬性修改、許可權設置、許可權管理、配方管理、配方設置等等,說不完了
編寫就在腳本里編寫就行了,可以在啟動腳本,退出腳本,循環腳本,按鈕屬性腳本,事件腳本,等等地方編寫
望採納。。。。
Ⅵ python的串口close()函數關閉不成功
用ser.isOpen()查看返回False,說明ser.close()起作用了啊。用管理員身份打開cmd,再執行腳本試試?
Ⅶ linux shell 串口
最好能將問題更准確的描述,看的費力! 腳本和串口命令以及運行結果截個圖上來看看
我估計是
參數沒有正確傳遞進去。
串口讀取從SHELL腳本傳遞進來的參數應該不是正確的。
你看一下運行串口程序的時候,是否開啟了一個新的進程,並且重新初始化了所有變數。
Ⅷ 怎麼寫個腳本 然用戶在打開某個軟體的時候電腦自動重啟呢
把下面這行保存成,"重啟.bat'文件即可
shutdown -r -t 0
這個要自己寫一個hook。每次創建進程是你都知道是那個程序,看到不喜歡的程序你就可以從新啟動了。
這里有網路介紹
http://ke..com/view/1208620.htm#sub1208620
這里有msdn介紹
SetWindowsHookEx Function
--------------------------------------------------------------------------------
The SetWindowsHookEx function installs an application-defined hook procere into a hook chain. You would install a hook procere to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
Syntax
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
Parameters
idHook
[in] Specifies the type of hook procere to be installed. This parameter can be one of the following values.
WH_CALLWNDPROC
Installs a hook procere that monitors messages before the system sends them to the destination window procere. For more information, see the CallWndProc hook procere.
WH_CALLWNDPROCRET
Installs a hook procere that monitors messages after they have been processed by the destination window procere. For more information, see the CallWndRetProc hook procere.
WH_CBT
Installs a hook procere that receives notifications useful to a computer-based training (CBT) application. For more information, see the CBTProc hook procere.
WH_DEBUG
Installs a hook procere useful for debugging other hook proceres. For more information, see the DebugProc hook procere.
WH_FOREGROUNDIDLE
Installs a hook procere that will be called when the application's foreground thread is about to become idle. This hook is useful for performing low priority tasks ring idle time. For more information, see the ForegroundIdleProc hook procere.
WH_GETMESSAGE
Installs a hook procere that monitors messages posted to a message queue. For more information, see the GetMsgProc hook procere.
WH_JOURNALPLAYBACK
Installs a hook procere that posts messages previously recorded by a WH_JOURNALRECORD hook procere. For more information, see the JournalPlaybackProc hook procere.
WH_JOURNALRECORD
Installs a hook procere that records input messages posted to the system message queue. This hook is useful for recording macros. For more information, see the JournalRecordProc hook procere.
WH_KEYBOARD
Installs a hook procere that monitors keystroke messages. For more information, see the KeyboardProc hook procere.
WH_KEYBOARD_LL
Windows NT/2000/XP: Installs a hook procere that monitors low-level keyboard input events. For more information, see the LowLevelKeyboardProc hook procere.
WH_MOUSE
Installs a hook procere that monitors mouse messages. For more information, see the MouseProc hook procere.
WH_MOUSE_LL
Windows NT/2000/XP: Installs a hook procere that monitors low-level mouse input events. For more information, see the LowLevelMouseProc hook procere.
WH_MSGFILTER
Installs a hook procere that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. For more information, see the MessageProc hook procere.
WH_SHELL
Installs a hook procere that receives notifications useful to shell applications. For more information, see the ShellProc hook procere.
WH_SYSMSGFILTER
Installs a hook procere that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar. The hook procere monitors these messages for all applications in the same desktop as the calling thread. For more information, see the SysMsgProc hook procere.
lpfn
[in] Pointer to the hook procere. If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procere in a dynamic-link library (DLL). Otherwise, lpfn can point to a hook procere in the code associated with the current process.
hMod
[in] Handle to the DLL containing the hook procere pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procere is within the code associated with the current process.
dwThreadId
[in] Specifies the identifier of the thread with which the hook procere is to be associated. If this parameter is zero, the hook procere is associated with all existing threads running in the same desktop as the calling thread.
Return Value
If the function succeeds, the return value is the handle to the hook procere.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
SetWindowsHookEx can be used to inject a DLL into another process. A 32-bit DLL cannot be injected into a 64-bit process, and a 64-bit DLL cannot be injected into a 32-bit process. If an application requires the use of hooks in other processes, it is required that a 32-bit application call SetWindowsHookEx to inject a 32-bit DLL into 32-bit processes, and a 64-bit application call SetWindowsHookEx to inject a 64-bit DLL into 64-bit processes. The 32-bit and 64-bit DLLs must have different names.
An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
Calling the CallNextHookEx function to chain to the next hook procere is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Before terminating, an application must call the UnhookWindowsHookEx function to free system resources associated with the hook.
The scope of a hook depends on the hook type. Some hooks can be set only with global scope; others can also be set for only a specific thread, as shown in the following table.
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD Thread or global
WH_KEYBOARD_LL Global only
WH_MOUSE Thread or global
WH_MOUSE_LL Global only
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
For a specified hook type, thread hooks are called first, then global hooks.
The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid ring application debugging. Libraries that no longer need a hook should remove its hook procere.
Windows 95/98/Me: SetWindowsHookEx is supported by the Microsoft Layer for Unicode (MSLU). However, it does not make conversions. To see Unicode messages, notifications, and so forth, you must subclass the window. To use this version of the application programming interface (API), you must add certain files to your application, as outlined in Installing and Releasing Hook Proceres.
Example
For an example, see Installing and Releasing Hook Proceres.
Function Information
Minimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as ANSI and Unicode versions.
See Also
Hooks Overview, CallNextHookEx, CallWndProc, CallWndRetProc, CBTProc, DebugProc, ForegroundIdleProc, GetMsgProc, JournalPlaybackProc, JournalRecordProc, LowLevelKeyboardProc, LowLevelMouseProc, KeyboardProc, MouseProc, MessageProc, ShellProc, SysMsgProc, UnhookWindowsHookEx
Ⅸ 如何進行pixhawk的串口調試
以下所描述的都是針對px4原生固件,此外,由於固件更新過於頻繁,本文描述的是15年7月的固件,主要是舉例,有改動的話,自己再研究研究吧(後面換cmake編譯方式了,改動蠻大)。
既然要做開發,第一步就是搭好開發環境,根據我的經驗,最好是在linux環境下編譯,這樣效率會很快,以前在windows下編譯,經常40分鍾以上,這樣就太影響開發了;
第二步,大概了解下固件的架構,
如果只涉及應用層的開發,那底層的nuttx系統就可以繞過去了,一般,最好先把uorb模塊的機制整明白就好了,從uorb入手,了解每個話題的來源以及作用,整理數據流,清楚每個模塊之間的關系即可,比如,要實現手動模式,哪些模塊互相交互,auto模式,又有哪些模塊起作用,
如果涉及相應演算法的開發,要學會定位到相應的演算法模塊,甚至具體到哪些代碼,比如,你想試驗你的姿態估計演算法,那你就將姿態估計模塊替換掉即可,不過相應的介面仍需要和px4環境一樣,以姿態估計為例,最後要發布你的vehicle_attitude話題,不然無法與其他模塊交互;
另外,不要試圖在代碼中找main函數,那是單片機思維,你只需看啟動腳本即可,\ROMFS\px4fmu_common\init.d\rcs;
第三步,針對你的具體情況,定位相應的模塊,進行精讀研究,雖然模塊基本是用C++寫的,但是不會C++也沒關系,畢竟又不是讓你寫,本人倒目前為止,也不會C++,配合注釋,看明白就好了,比如,整理下mavlink的控制流程;
px4原生固件模塊列表:
系統命令程序
mavlink –通過串口發送和接收mavlink信息
sdlog2 –保存系統日誌/飛行數據到SD卡
tests –測試系統中的測試程序
top –列出當前的進程和CPU負載
uORB – 微對象請求代理器-分發其他應用程序之間的信息
驅動
mkblctrl–blctrl電子模塊驅動
esc_calib –ESC的校準工具
fmu –FMU引腳輸入輸出定義
gpio_led –GPIOLED驅動
gps –GPS接收器驅動
pwm –PWM的更新速率命令
sensors –感測器應用
px4io –px4io驅動
uavcan –uavcan驅動
飛行控制的程序
飛行安全和導航
commander –主要飛行安全狀態機
navigator –任務,失效保護和RTL導航儀
估計姿態和位置
attitude_estimator_ekf –基於EKF的姿態估計
ekf_att_pos_estimator –基於EKF的姿態和位置估計
position_estimator_inav–慣性導航的位置估計
multirotor姿態和位置控制器
mc_att_control–multirotor姿態控制器
mc_pos_control –multirotor位置控制器
fixedwing姿態和位置控制器
fw_att_control –固定翼飛機的姿態控制
fw_pos_control_l1 –固定翼位置控制器
垂直起降姿態控制器
vtol_att_control –垂直起降姿態控制器
最後提一句,多看看官網的說明,另外根據本人的經驗來看,由於大框架,代碼人家都寫好了,通常你要加功能,所修改的也就幾行代碼而已,舉例說明,比如px4固件只能在手動模式解鎖,假如我要修改成定高模式解鎖
Ⅹ 請問:華為小豚攝像頭安全嗎
圖 4-6 通過串口順利登錄設備
5. 小結
到此即是我們對小豚 AI 攝像頭的第一篇,在本文中,我們對此設備進行了簡單的外部分析,並順利的開啟了設備的串口功能。但事實上,我們分析的很多設備是無法啟用串口的,所以在下一篇文章中,我們會繼續分享其他的系統登錄方法。在登錄系統之後,我們還會分析其中的一個關鍵程序,就是產生 TLS 加密通信的關鍵程序。