2015年12月4日 星期五

Delay utilite for STM8 family



get form https://github.com/Hoksmur/stm8_routines/blob/master/delay.h



/* 
 * delay utilite for STM8 family
 * COSMIC and SDCC
 * Terentiev Oleg
 * t.oleg@ymail.com
 */

#ifndef _UTIL_DELAY_H_
#define _UTIL_DELAY_H_ 1

#define F_CPU 2000000UL

#ifndef F_CPU
#warning F_CPU is not defined!
#endif

/* 
 * Func delayed N cycles, where N = 3 + ( ticks * 3 )
 * so, ticks = ( N - 3 ) / 3, minimum delay is 6 CLK
 * when tick = 1, because 0 equels 65535
 */

static inline void _delay_cycl( unsigned short __ticks )
{
#if defined(__CSMC__)
/* COSMIC */
  #define T_COUNT(x) (( F_CPU * x / 1000000UL )-3)/3)
    // ldw X, __ticks ; insert automaticaly
    _asm("nop\n $N:\n decw X\n jrne $L\n nop\n ", __ticks);
#elif defined(__SDCC)
  #define T_COUNT(x) (( F_CPU * x / 1000000UL )-5)/5)
    __asm__("nop\n nop\n"); 
    do {         // ASM: ldw X, #tick; lab$: decw X; tnzw X; jrne lab$
                __ticks--;//      2c;                 1c;     2c    ; 1/2c   
        } while ( __ticks );
    __asm__("nop\n");
#elif defined(__RCST7__)
/* RAISONANCE */
  #error ToDo for RAISONANCE
#elif defined(__ICCSTM8__)
/* IAR */
  #error ToDo for IAR
#else
 #error Unsupported Compiler!          /* Compiler defines not found */
#endif
}

static inline void _delay_us( const unsigned short __us )
{
    _delay_cycl( (unsigned short)( T_COUNT(__us) );
}

static inline void _delay_ms( unsigned short __ms )
{
    while ( __ms-- )
    {
        _delay_us( 1000 );
    }
}

#endif

2015年11月27日 星期五

Arduino 與 ESP8266 Wifi module(AT Command Firmware)的結合



itead/ITEADLIB_Arduino_WeeESP8266
An ESP8266 library for Arduino providing an easy-to-use way to manipulate ESP8266.



以下節錄: http://arduinovirgins.blogspot.tw/

Interfacing the ESP8266 WIFI module to an Arduino




The current ESP8266 library project is called 'WeeESP8266'.

The WeeESP8266 Arduino API documentation is located here and the library files can be downloaded here from Github.

The  ESP8266 interface uses standard 'AT' (attention) commands. It uses the same type of commands that were used in MODEMs . . . . remember them? Below is a list of the standard commands but be aware that this may change with time.

2015年11月6日 星期五

2015年11月2日 星期一

ESP-12 Series 比較


註:  PCB天線形狀是ESP-12E 和 ESP-12F 外觀的最大差異,ESP-12F為ESP-12E加強版,天線全新改版射頻性能優化。


------------------------------------------------------------------------------------------------------------------

ESP-12

半孔貼片工藝,全IO引出,帶金屬屏蔽殼,已過FCC &CE認證,內置PCB板載天線,4M Bytes Flash。

「esp-12」的圖片搜尋結果



------------------------------------------------------------------------------------------------------------------

ESP-12-D  ===> DIO

ESP-12-Q (ESP-12E) ==> QIO

ESP-12-E (ESP-12E) ==> QIO

在ESP-12的基礎上多引出6個腳,抗干擾能力大大增強。
Wi-Fi модуль ESP8266 ESP-12-Q「esp-12-Q」的圖片搜尋結果
「esp-12e」的圖片搜尋結果「esp-12-F」的圖片搜尋結果「esp-12-Q」的圖片搜尋結果

------------------------------------------------------------------------------------------------------------------

ESP-12-F (ESP-12F)


「esp-12-F」的圖片搜尋結果「esp-12-F」的圖片搜尋結果
突破性的設計改版。全新四層板設計,天線全新改版射頻性能優化,相較於ESP-12E的通訊距離增加30%-50%!半孔貼片工藝,全IO引出,帶金屬屏蔽殼,已過FCC &CE&RoHS認證,內置PCB板載天線,4MBytes Flash。


「esp-12-F」的圖片搜尋結果
「ESP-12F」的圖片搜尋結果「ESP-12F」的圖片搜尋結果


------------------------------------------------------------------------------------------------------------------

ESP-14


以ESP-12E为设计原型,内部增加了STM8S003F3P6,并通过STM8S对ESP8266进行AT指令控制.该模块就是一个完整的STM8S的单片机,可以通过STM8单片机编程进行WIFI操作。
「esp-14」的圖片搜尋結果「ESP-12F」的圖片搜尋結果






2015年9月15日 星期二

STM8S + ESP-01 + CH340T 原理圖分析


STM8S + ESP-01 + CH340T 原理圖分析



「ESP-01」的圖片搜尋結果


利用J7連接ST-Link燒錄STM8 firmware
調整JP2 , 短路 WRXD/TXD  ,短路WTXD/RXD , 則CH340T連接ESP-01
調整JP2 , 短路 WRXD/UT  ,短路WTXD/UR , 則STM8 連接ESP-01
可利用J8當作ESP-01燒錄的switch,由STM8 firmware判別,控制ESP-01(JP1) 的CH_PD,GPIO0,GPIO2,RST,來進行ESP-01 firmware更新....