Atmega328P Datasheet 14. PM - Power Management and Sleep Modes

Started by tha, November 01, 2017, 11:51:44 AM

Previous topic - Next topic

tha

14.6. Power-Down Mode
เมื่อ the SM[2:0] bits ถูกเขียนเป็น '010', คำสั่ง the SLEEP instruction ทำให้ the MCU เข้าสู่ Power-Down mode. ใน mode นี้, the external
Oscillator ถูกหยุด, ขณะที่ the external interrupts, the 2-wire Serial Interface address watch, and the Watchdog ทำงานต่อไป (ถ้า enabled).

มีเพียงหนึ่งของ events เหล่านี้ที่สามารถ wake up the MCU:
• External Reset
• Watchdog System Reset
• Watchdog Interrupt
• Brown-out Reset
• 2-wire Serial Interface address match
• External level interrupt on INT
• Pin change interrupt

sleep mode นี้ โดยพื้นฐานแล้วจะหยุด clocks ทั่วไปทั้งหมด, ยอมให้เพียงแต่การทำงานของ asynchronous modules เท่านั้น.

หมายเหตุ: ถ้า a level triggered interrupt ถูกใช้สำหรับ wake-up จาก Power-Down, the required level ต้องถูกยึดไว้นานเพียงพอสำหรับ the MCU เพื่อเสร็จสิ้น the wake-up เพื่อ trigger the level interrupt. ถ้า the level หายไปก่อนการสิ้นสุดของ the Start-up Time, the MCU จะยังคง wake up, แต่ไม่มี interrupt ใดจะถูกทำให้เกิดขึ้น. The start-up time ถูกกำหนดโดย the SUT and CKSEL Fuses.

เมื่อ waking up จาก Power-Down mode, มันจะมี a delay จาก the wake-up condition เกิดขึ้นจนกระทั่ง the wake-up เป็นผล. นี้ยอมให้ the clock รีสตาร์ทใหม่และมั่นคงหลังจากที่ถูกทำให้หยุดไป The wake-up period ถูกกำหนดโดย the same(เดียวกัน) CKSEL Fuses ที่กำหนด the Reset Time-out period.

ROM

Quote from: tha on December 04, 2017, 02:10:13 PM
Quoteเพิ่งเริ่มหัดใช้ git อยู่เหมือนกันครับ แต่เห็นว่าน่าจะมีประโยชน์ดี
ตอนนี้ก็เริ่มต้นศึกษาจากตรงนี้  http://www.select2web.com/git/git-1.html แต่ก็ยังไม่คล่องเท่าไหร่ครับ
( ถ้าใจร้อนก็ไปตอนที่ 7 เลยก็ได้ http://www.select2web.com/git/git-7.html )
เลยอยากแนะนำท่าน tha มาใช้ด้วยกันไปเลย เห็นท่านเขียน Code เจ๋งๆอยู่
น่าจะเป็นอีกเรื่องที่น่าสนุกนะครับ

มันลงตามนี้ใช่หรือเปล่าคุณ ROM http://www.select2web.com/git/git-4.html หรือเป็นตัวอื่นสำหรับ windows 7 32bit ผมอัฟไฟล์ยังไม่ได้เลย แต่ฝั่งเว็ปเป็นแบบนี้ https://github.com/thamanoon/adc_usart6 ถูกต้องใหม อัฟโหลดยังไม่ได้ครับ

ท่าน tha ติดตรงไหนครับ ใช้ Source Tree หรือเปล่า ?
ลองอ่าน https://www.atlassian.com/git  ตรงหัวข้อ  How Git works น่าจะพอช่วยได้



tha

ไม่ไหวหล่ะคุณ ROM ผมคนรุ่นเก่าไฟฟ้ากำลังไม่ได้เรียนเน็ตมา
ทำใม Github for windows 32bit ถึงไม่มี มีแต่ 64bit โน๊ตบุ๊คของผมลงไม่ได้ครับ
https://desktop.github.com/

ต่อเรื่อง sleep mode กันต่อ มีใครลองทำ sleep mode power down กันไปก่อนกันแล้วมั่ง ก็ง่ายๆ เหมือนกันกับ idle mode ส่วนหยุด clock ตัวไหนบ้างก็อ่านกันเอาเองนะครับ

http://www.mediafire.com/file/5qo04xyp9ohf223/sleep3.rar
http://www.mediafire.com/file/suubau5r5zz3gbs/sleep4.rar


ROM

Quote from: tha on December 07, 2017, 11:04:22 AM
ไม่ไหวหล่ะคุณ ROM ผมคนรุ่นเก่าไฟฟ้ากำลังไม่ได้เรียนเน็ตมา
ทำใม Github for windows 32bit ถึงไม่มี มีแต่ 64bit โน๊ตบุ๊คของผมลงไม่ได้ครับ
https://desktop.github.com/

ต่อเรื่อง sleep mode กันต่อ มีใครลองทำ sleep mode power down กันไปก่อนกันแล้วมั่ง ก็ง่ายๆ เหมือนกันกับ idle mode ส่วนหยุด clock ตัวไหนบ้างก็อ่านกันเอาเองนะครับ

http://www.mediafire.com/file/5qo04xyp9ohf223/sleep3.rar
http://www.mediafire.com/file/suubau5r5zz3gbs/sleep4.rar

โอ้ เสียใจด้วยครับ ไม่เจอ git desktop ที่เป็น GUI 32 bit เหมือนกัน  :'(

tha

Quoteโอ้ เสียใจด้วยครับ ไม่เจอ git desktop ที่เป็น GUI 32 bit เหมือนกัน  :'(
ทำได้แล้วแจ้งด้วยนะ คุณ ROM ตอนนี้ถ้าผมมีทำผิดหรืออยากแก้ให้ดีกว่าด้วยวิธีอื่นๆที่แตกต่างก็แก้ได้เลยนะครับ แก้ใน electoday นี่แหละ แก้สั้นๆก็เขียนบอกวิธีแก้มา ถ้าแก้ยาวเลยก็แก้แล้วอัฟโหลดมาก็ได้ ไม่ต้องเกรงใจ
ไปเที่ยงลำปางมาสองสามวัน หมู่นี้เลยไม่ได้แปล

tha

14.7. Power-save Mode
เมื่อ the SM[2:0] bits ถูกเขียนด้วย 011, the SLEEP instruction ทำให้ the MCU เข้าสู่ Power-save mode. โหมดนี้ก็เหมือนกันกับ Power-down, โดยมีข้อยกเว้นอยู่ข้อหนึ่ง :

ถ้า Timer/Counter2 ถูกเปิดใช้งาน, มันจะทำงานต่อไปในระหว่างที่ sleep อยู่. The device สามารถ wake up จาก Timer Overflow หรือ Output Compare event จาก Timer/Counter2 ถ้า the corresponding Timer/Counter2 interrupt enable bits ถูกเซทใน TIMSK2, และ the Global Interrupt Enable bit ใน SREG ถูกเซท

ถ้า Timer/Counter2 ไม่ได้รันอยู่, แนะนำให้ใช้ Power-down mode แทนการใช้ Power-save mode.

The Timer/Counter2 สามารถถูกให้สัญญานนาฬิกาได้ทั้งแบบ synchronously และ asynchronously ใน Power-save mode. ถ้า Timer/Counter2 ไม่ได้ใช้ the asynchronous clock, the Timer/Counter Oscillator จะถูกหยุดในระหว่าง sleep. ถ้า Timer/Counter2 ไม่ได้ใช้ the synchronous clock, the clock source ถูกหยุดในระหว่าง sleep. ถึงแม้ว่า the synchronous clock กำลังรันใน Power-save, clock นี้สามารถใช้สำหรับ Timer/Counter2 เท่านั้น.

งงแล้วสิงานนี้  synchronously และ asynchronously
synchronously หมายถึง ใช้สัญญานนาฬิกาภายนอกใช่หรือเปล่า?
asynchronously หมายถึง ใช้สัญญานนาฬิกาภายในใช่หรือเปล่า?   
ท่านใดพอทราบมาช่วยเคลียร์หน่อย Timer/Counter ก็ยังแปลไปไม่ถึงเลย จะยกตัวอย่างได้ใหมนี่  :(

tha

ตกลง Power-save Mode ยังไม่ทำจะดีกว่า เพราะทำจริงๆจะข้ามขั้นตอนมากเกินไป และไม่ค่อยจะใช้งานมากนัก ใช้ Power-down Mode แทนก็ได้ ต่อ

14.8. Standby Mode
เมื่อ the SM[2:0] bits ถูกเขียนเป็น '110' และ an external crystal/resonator clock option(ทางเลือก) ถูกเลือก, the SLEEP instruction ทำให้ the MCU เข้าสู่ Standby mode. โหมดนี้ก็เหมือนกันกับ Power-Down โดยมีข้อยกเว้นที่ให้ the Oscillator รันต่อไป. จาก Standby mode, the device จะ wakes up ใน six clock cycles.

tha

ตัวอย่าง standby mode ครับ library ก็เช็คเอาใน folder นี้ C:\WinAVR-20100110\avr\include\avr
http://www.mediafire.com/file/xbygyr9iawmcy4d/sleep5.rar