บทความประกอบการเรียนรู้ => ไมโครคอนโทรลเลอร์ (Arduino) => ข้อความที่เริ่มโดย: admin ที่ เมษายน 30, 2014, 10:32:53 PM
-
เขียนโปรแกรมแสดงค่าแอนนาลอกแสดงผลตัวเลขบน 7 segment MAX7219
ฟังก์ชั่นที่ใช้งาน
-pinMode() http://arduino.cc/en/Reference/PinMode (http://arduino.cc/en/Reference/PinMode)
-delay() http://arduino.cc/en/Reference/Delay (http://arduino.cc/en/Reference/Delay)
-delayMicroseconds() http://arduino.cc/en/Reference/DelayMicroseconds (http://arduino.cc/en/Reference/DelayMicroseconds)
-analogRead() http://arduino.cc/en/Reference/AnalogRead (http://arduino.cc/en/Reference/AnalogRead)
-map() http://arduino.cc/en/reference/map (http://arduino.cc/en/reference/map)
ไลบารี่เพิ่มเติม
-LedControl.h (ไลบรารี่ตัวเดียวกันกับงานครั้งที่ 20 หากติดตั้งแล้วไม่ต้องทำซ้ำ)*ดูวิธีติดตั้งในงานครั้งที่ 20 (http://www.praphas.com/forum/index.php?topic=266.0)
ฟังก์ชั่นในไลบารี่ LedControl.h
-LedControl lc=LedControl(dataPin,clkPin,csPin,numDevices);
-lc.shutdown(addr,false); // Enable display
-lc.setIntensity(addr,value); // Set brightness level (0 is min, 15 is max)
-lc.clearDisplay(addr); // Clear display register
-lc.setDigit(addr, digit, value, point_decimal) //display number 0-9
-lc.setChar(addr, digit, character, false) //display character etc. A,b,c,d,E,F,H,L,P,-,_
-lc.setRow(addr, digit,value) //display part of segment
รายละเอียดเพิ่มเติมของไลบารี่ http://playground.arduino.cc/Main/LedControl (http://playground.arduino.cc/Main/LedControl)
โจทย์โปรแกรม
-แสดงตัวเลขจากเซนเซอร์แอนาลอกโดยแสดงผลที่ 7 segment MAX7219
-โปรแกรมรายละเอียดพิเศษรายกลุ่ม (แจ้งให้ทราบเมื่อถึงชั่วโมงเรียน)
วงจรที่ใช้ในการทดลองสำหรับผู้ที่ใช้บอร์ด Arduino
(http://www.praphas.com/PhotoForum/arduino/Lab-21-01.png)
วงจรที่ใช้ในการทดลองสำหรับผู้ที่ใช้ไอซี ATmega328 (ที่มี Boot Loader Arduino)
(http://www.praphas.com/PhotoForum/arduino/Lab-21-02.png)
บริเวณใช้งานบอร์ดทดลอง
(http://www.praphas.com/PhotoForum/arduino/Lab-21-03.png)
โมดูลสำเร็จรูปเพิ่มเติม
MAX7219 7 Segment
(http://www.praphas.com/PhotoForum/arduino/Lab-20-c.jpg)
http://www.arduinoall.com (คลิก) (http://www.arduinoall.com/product/460/%E0%B9%82%E0%B8%A1%E0%B8%94%E0%B8%B9%E0%B8%A5-%E0%B8%88%E0%B8%AD%E0%B9%81%E0%B8%AA%E0%B8%94%E0%B8%87%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B9%80%E0%B8%A5%E0%B8%82-8-%E0%B8%AB%E0%B8%A5%E0%B8%B1%E0%B8%81-%E0%B8%AA%E0%B8%B5%E0%B9%81%E0%B8%94%E0%B8%87-0-36quot-max7219-digital-tube-display-module)