2016年8月25日 星期四

LME288 的處理方法

  1. Run command prompt as Administrator.
  2. Type (without quotes) "bcdedit /set IncreaseUserVa 3072"
  3. Reboot computer.

2016年7月19日 星期二

在 Batch File 中使用 findstr 比對 log 檔中的訊息

當 Batch File 需要判斷某個程式輸出的 log 檔內容時,  findstr 是一個可用的工具.

目前用過的參數:

參數說明:
findstr /?

比對檔案中的文字
findstr /c:string filename

可用 ERRORLEVEL 判斷是否有符合字串.

ERRORLEVEL 為 0 時, 有符合字串.
ERRORLEVEL 為 1 時, 沒有找到符合字串.

--
ERRORLEVEL 的用法:

IF ERRORRLEVEL N to check if the errorlevel is >= N. 
IF NOT ERRORLEVEL N to check if errorlevel is < N

例如:

findstr /C:FFFF info_1.hex
IF ERRORLEVEL 1 goto NOT_MATCH
echo MATCH
goto END

:NOT_MATCH

echo NOT_MATCH

:END

Batch file 指令太長如何換行

當 Batch File 的一行太長要換行時, 加入 "^" (不含 ") , 緊接著換行就可以了.
例如:

echo off
IF "%1"=="" goto end
echo %1

:end

寫成:


echo off
IF "%1"=="" ^
goto end

echo %1

:end

注意 "^" 一定要緊接著換行碼, 不能有空格!

2016年7月5日 星期二

python 中使用 enum


from enum import Enum
class Color(Enum):
    red = 1
    green = 2
    blue = 3

python 如何安裝 .whl 檔

在命令列中執行:

 pip install some-package.whl

就可以了

2016年7月1日 星期五

把 list 的資料寫入到 file


bytesToWrite=[125,3,255,0,101]
newfile=open("hello.bin",'wb')
newfile.write(bytes(bytesToWrite))
newfile.close()

2016年6月6日 星期一

Atmel Studio 7 啟動時 Error ("ErrorListPackage did not load correctly") 解決方式

參考:
http://atmel.force.com/support/articles/en_US/Workaround/Installing-Visual-Studio-2015-Update-1-leads-to-Atmel-Studio-no-longer-starting

Root Cause
The Visual Studio 2015 Update 1 updates a dll that is shared between Atmel Studio and Visual Studio, without providing the correct dll load redirect information. Until we have had the chance to verify that this new dll (version 1.1.37) works with Atmel Studio, we suggest downloading the previous version (1.1.36) and place it in a load path for Atmel Studio with higher load precedence than the Visual Studio load path.
Workaround
This issue is fixed in Atmel Studio 7.0.790 and newer.

If you are using an older version, use to following workaournd:
  1. Download System.Collections.Immutable (1.1.36) from nuget.org
  2. The file downloaded is a zip file with a .nupkg extension, rename the file to .zip 
  3. Open the zip file, go to the lib folder and into a folder called portable-net45%2Bwin8%2Bwp8%2Bwpa81
  4. Copy the System.Collection.Immutable.dll file into one of the Atmel Studio load folders
    1. We suggest using '<installdir>\Extensions\Application', which might be 'C:\Program Files (x86)\Atmel\Studio\7.0\Extensions\Application' on your machine