顯示具有 uart 標籤的文章。 顯示所有文章
顯示具有 uart 標籤的文章。 顯示所有文章

2016年3月23日 星期三

利用 python 經由 serial port 輸出資料


Python 需安裝 Python Serial Port Extension
  https://pypi.python.org/pypi/pyserial

安裝方式:
. 下載 pyserial-3.0.1.tar.gz
. 解開 pyserial-3.0.1.tar.gz
. 進入解開壓縮檔的目錄下, 執行:
  python setup.py install
 
開始寫程式:
# coding=UTF-8

import time
import serial


ptn = [0xAA,0x50,0x60,0x70]

def main():
   
    ser = serial.Serial('COM3', 2400, timeout=0.5)
    ary = bytearray(ptn)
    ser.write(ary)
    time.sleep(0.1)
    ser.close()   

if __name__ == "__main__":
    main()














ref : https://learn.adafruit.com/arduino-lesson-17-email-sending-movement-detector/installing-python-and-pyserial

2015年9月29日 星期二

Energia : using hardware UART

Using LaunchPad MSP-EXP430G2
MCU: M430G2553

problem:
Serial Monitor can't get the data from LaunchPad

Solution:
  Connecting to the USB2.0 hub port instead of connecting to USB3.0 port. If it still not works, trying another USB2.0 hub port.


使用 LaunchPad 時, Serial Monitor 一直無法看到 UART 傳來的資料.
後來使用 USB2.0 hub 連接 LaunchPad , Serial Monitor 就可收到 UART 的資料.