328eForth Workshop C. H. Ting February 16, 2012 SVFIG.

Slides:



Advertisements
Similar presentations
Microcontroller Fundamentals
Advertisements

Robotics Club, Snt Council2 The 3 Schools of Robotics: Mechanical Design – Types of motors – Material selection –
MICRO-CONTROLLER: A microcontroller is the brain of the robot: These are: 1. Integrated Circuits (ICs) 2. Programmable.
2012 FIG Taiwan Conference February 16, 2012 Chen-Hanson Ting
Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.
Chen-Hanson Ting SVFIG December 20, 2014
Seminars at RSSC.org Sergei Grichine
Essentials of motors and motor driver
Welcome to Workshop 88’s Tiny85 Class Please download Tiny core libs from: (for Arduino 1.0, not 1.5!) Unzip and.
SENIOR DESIGN 10/3.
Project Goals And Objectives ____________________________________________________ Create a “smart”, customizable, all in one system Little to no learning.
You must be knowing about Digital Integrated Circuits (ICs) right ? For example 7404: Hex Inverter 7408: Quad 2-input AND gate 7410: Triple 3-input NAND.
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
CALLISTO Double - Heterodyne - Frequency Agile - Radio - Spectrometer ERAC Symposium Heppenheim Sep 5/6/7th 2003 Meyer Hansueli ETH Zürich.
Colorado Space Grant Consortium Gateway To Space ASEN 1400 / ASTR 2500 Class #12 Gateway To Space ASEN 1400 / ASTR 2500 Class #12 T-58.
Little arduino microcontrollers Meghan Jimenez 12 February 2014.
328eForth for Arduino Uno C. H. Ting February 16, 2012 SVFIG.
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
2.0 EMBEDDED CONTROLLER Engr. Hj. Mohamad Fauzi bin Zakaria Department of Mechatronics and Robotics Engineering Faculty of Electrical and Electronic Engineering.
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
1 Microcontrollers you should know about Thomas Edwards
Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.
Microprocessors A practical approach Subjects Goals for this module Results Subjects of the module Plans Questions.
Arduino 101 Instructors: Ted Markson / Jim Sweeney.
Microcontroller Presented by Hasnain Heickal (07), Sabbir Ahmed(08) and Zakia Afroze Abedin(19)
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Microcontroller Programming
OBSTACLE AVOIDANCE ROBOT
Interrupt On a very basic level, an interrupt is a signal that interrupts the current processor activity. It may be triggered by an external event (change.
Arduino A free development system based on Atmel AVR 8 bit microcontrollers. LB8X Tom.
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
Lab 1 Summary.
Submitted by:.  Project overview  Block diagram  Power supply  Microcontroller  MAX232 & DB9 Connector  Relay  Relay driver  Software requirements.
 RAJ JOSHI  CHINMAY JOSHI RMS POLYTECHNIC E.C 6 TH SEM PROJECT PPT HEAD OF DEPARTMENT : HIMANSHU GUPTA INTERNAL GIDE : VIRAL.
Introduction to AVR Name : 1) Abhishek Yadav ) Prakash Giri ) Kheni Niral ) Bhadresh Langadiya Branch.
GROUP MEMBERS: SUMEET HOODA. RAJDEEP PATRE. DHIRAJ GAONKAR. LIVE HUMAN DETECTION USING WIRELESS REMOTE CONTROLLED ROBOT.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
INTERFACING HARDWARE WITH MICROCONTROLLER GUIDED BY: Prof. ASIF SIR 1. AKSHAY KIRAN 2. DEEP PARIKH 3. JIGAR PATEL 4. TILAK PATEL ,05,D2D06,09.
Overview AvrEmbedded128_Pro RTLab. 김태현. Atmega128 Features High-performance, Low-power AVR® 8-bit Microcontroller advanced RISC Architecture – 133 Powerful.
Timers and Scheduled Interrupts
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
8255 Programmable Peripheral Interface
Outline Introduction to Arduino UNO Programming environment setup GPIO
SUBMITTED BY EDGEFX TEAM
AC PWM CONTROL FOR INDUCTION MOTOR
Application Case Study Security Camera Controller
Fundamentals of Computer Engineering
AVR ATMEGA 8 MICRO-CONTROLLER
PC Mouse operated Electrical Load Control Using VB Application
AC PWM BASED POWER Control BY IGBT / MOSFET
BITS EDU. CAMPUS , VARNAMA
Project Title EVM IN PIC Under the Guidance of Submitted by.
The Arduino Microcontroller: Atmel AVR Atmega 328
Week 5: Microcontrollers
AVR Hardware Connections and Flash Loading
Introduction to Microprocessors and Microcontrollers
Introduction to the Atmel AVR Butterfly
Tim Sumner, Imperial College, Rm: 1009, x47552
Lecturer: Reza Arjmandi Autumn 2015
8051 Micro Controller.
Introduction to Arduino
Introduction to Arduino
Arduino Board.
Arduino म्हणजे काय?.
2012 FIG Taiwan Conference February 17, 2012 Chen-Hanson Ting
Introduction to arduino
Presentation transcript:

328eForth Workshop C. H. Ting February 16, 2012 SVFIG

Summary Optimized FORTH for Arduino Uno ATmega328P Demonstrations BLINK a LED TONE Generator SERVO Motors TRAFFIC Controller

Optimized Forth for Arduino Subroutine Thread Model Fully optimized Uniform byte addressing Case insensitive Interpreter is in Bootloader section Optimized flash programming Visible words are reduced to 140 for ease of learning

ATmega328P 8 Bit microcontroller, 131 instructions 20 MIPS at 20 MHz 32KB Flash, 2 KB RAM, 1 KB EEPROM 3 Counter/Timers 6 Channels 10-bit ADC USART, SPI, I2C, ISP 23 Programmable I/O lines 1.8-5.5 V

BLINK a LED Toggle LED HEX 20 24 C! \ make Line 13 an output pin 20 23 C! \ toggle Line 13 LED BLINK program : MS ( n -- ) FOR AFT $1CB FOR NEXT THEN NEXT ; : BLINK 20 24 C! BEGIN 20 23 C! 400 MS AGAIN ; FLUSH BLINK

TONE Generator Timer/Counter1 Setup HEX 2 24 C! \ set Line 9 as output 40 80 C! \ set CTC mode 8000 88 !\ init compare reg 9 81 C! \ prescaler=1, start

TONE Generator : /SO A000 88 ! ; : DO 77B1 88 ! ; : RE 6AAA 88 ! ; : ME 5F07 88 ! ; : FA 59DB 88 ! ; : SO 5000 88 ! ; : LA 4745 88 ! ; : MS ( n -- ) FOR AFT $1CB FOR NEXT THEN NEXT ; : 1/4 100 MS ; : 1/2 200 MS ; : 1/8 400 MS ;

TONE Generator : PHRASE1 DO 1/4 RE 1/4 ME 1/4 DO 1/4 ; : PHRASE2 ME 1/4 FA 1/4 ME 1/4 SO 1/2 ; : PHRASE3 SO 1/8 LA 1/8 SO 1/8 FA 1/8 ME 1/4 ME 1/4 DO 1/4 ; : PHRASE1 DO 1/4 /SO ¼ ME 1/4 DO 1/2 ; : SONG 2 24 C! 40 80 C! 9 81 C! PHRASE1 PHRASE1 PHRASE2 PHRASE2 PHRASE3 PHRASE3 PHRASE4 PHRASE4 0 81 C! ;

SERVO Motors Assembling by AVR Assembler 2 Simulating by AVR Simulator 2 In System Programming with AVRISP mkll Running 328eForth from HyperTerminal

SERVO Motors HEX : INIT-PORTS E 24 C! 68 2A C! \ OUTPUT PORTS A3 44 C! 5 45 C! \ TCCR0A, TCCR0B 18 47 C! 18 48 C! \ OCR0A, OCR0B A1 80 C! D 81 C! \ TCCR1A, TCCR1B 18 88 C! 18 8A C! \ OCR1A, OCR1B A3 B0 C! 7 B1 C! \ TCCR2A, TCCR2B 18 B3 C! 18 B4 C! \ OCR2A, OCR2B ;

SERVO Motors : S1 ( N -- ) 88 C! ; : S2 ( N -- ) 8A C! ; : S3 ( N -- ) B3 C! ; : S4 ( N -- ) B4 C! ; : S5 ( N -- ) 47 C! ; : S6 ( N -- ) 48 C! ; FLUSH

TRAFFIC Controller : init-ports fc 2a c! 3 24 c! \ output ports 3f 28 c! c 25 c! ; \ input ports, pullup : seconds for aft 100 for 400 for next next then next ; : lights ( n -- ) dup 2b c! \ PD outputs 100 / C or 25 c! ; \ PB outputs, maintain pullups : switches ( -- n ) 23 c@ 100 * \ PB inputs 26 c@ or \ PC inputs dup cr . ;

TRAFFIC Controller : N-S begin 104 lights 5 seconds switches c3a and if 108 lights 2 seconds then switches a and if 130 lights 3 seconds then switches c30 and until ; : E-W begin 50 lights 5 seconds switches 82f and if 90 lights 2 seconds then switches 820 and if 310 lights 3 seconds then switches f and until ; : go init-ports begin N-S E-W ?key until drop ; flush

Turn Key Application Application Turn Key Burn Fuses : go init-ports begin N-S E-W ?key until drop ; Turn Key ‘ go 100 ! 100 erase 100 100 write Burn Fuses Lfuse=F2, Hfuse=D8, Efuse=FD

Tao of Arduino No external crystal No external reset No current limiting resistors to drive LED’s No external pull up resistors to read sensors 2 AA batteries are sufficient for power

Conclusion Arduino is the best platform to teach FORTH. ATmega328 is the simplest microcontroller for embedded applications. 328eForth is the easiest way to build applications on Arduino Uno.

為學日益,為道日損. 損之又損,以至於無. 為無為而無不為. Ardunio之道 為學日益,為道日損. 損之又損,以至於無. 為無為而無不為.