Company logo.jpg (12785 bytes)


Tutorial with Easy Format™ Supported Voice/Melody Controller

Home

Introduction to the Easy Format supported Voice / Melody controller

Syntax of Easy Format Supported Voice / Melody controller

Introduction to Easy Format Enhanced C

The Easy Format™  is designed to minimize the learning curve for programmers.  The friendly nature of Easy Format™ can be illustrated with real world examples.  Comments of the program is followed by the ";" sign.  The following examples are prepared with reference to a micro-controller based sound chip which produces wave files as typical audio signal output to demonstrate the Easy Format™ programming capability.

Example 1: One shot (Irretriggerable)

Example 2: One shot (Retriggerable by itself)

Example 3: Police Car (Toy application)

After you browse through the following typical examples,  you may grasp the concept about the structure of Easy Format.   The syntax of an Easy Format application can be divided into following sections.

  1. Determine the multiplexed input keys.
  2. Declare the voice/melody file.
  3. Define Input States.
  4. Define Output States.
  5. Define the Paths.

Example 1 One shot (Irretriggerable)

The following state diagram illustrates the state transition in this example.

Program Listing

Input States
;State Name P1.1 P1.3 P1.2 P1.4 P2.1 P2.2 P2.3 P2.4
STATE#0: Path1 X X X X X X X
BUSY: X X X X X X X X

;Note: "Path"1 is the path to be executed corresponding to a rising edge at Port 1.1

Paths
POWERUP:   STATE#0  END
PATH1:         BUSY  SOUND  STATE#0   END

Upbutton.gif (1242 bytes) (Click this button to the top of this document)
Example 2 One shot (Retriggerable by itself)

The following state diagram illustrates the state transition in this example.

Program Listing

Input States
;State Name P1.1 P1.3 P1.2 P1.4 P2.1 P2.2 P2.3 P2.4
STATE#0: /Path1 X X X X X X X

;Note: "Path"1 is the path to be executed corresponding to a falling edge at Port 1.1.
;         The falling edge trigger is denoted by the "/" sign.  Please note that an input
;         pin can be programmed to response to both rising edge and falling, each
;         leads to a different execution Path.

Paths
POWERUP:   STATE#0  END
PATH1:         SOUND  END

(Click this button to the top of this document)
Example 3 Police Car (Toy Application)

This is a full program application example to demonstrate how Easy Format handle a complicated design requirement.  All the work is to be done on a single page.

The product requirements are:

4 Push Buttons Inputs and 2 Outputs to drive 2 lights.

BUTTONS:

  1. Start Button : Turn ON (START) or OFF the engine.
  2. Accel Button : Gas pedal to give ACCELERATION sound from idle and then keep on at a steady sound.
  3. Siren Button : SIREN sound On/Off : toggle ON and toggle OFF.
  4. Brake Button : BRAKE, triggers deceleration sound and then bring the car to idle.

LEDS :

LED Output : Blink in opposite phase when the Siren sound is On.  That is when one light is On, the other light is Off in an alternating pattern.

TIME OUT REQUIREMENTS:

Every sound needs to be automatic shut down after a specified period of time if no more trigger signal is received.

The structure of this program can be illustrated with the state diagram.

Program Listing

EASY 4
; Declare Wavefiles
StartSound.wav/ad4
IdleSound.wav/ad4
AccelSound.wav/ad4
DecelSound.wav/ad4
RunSound.wav/ad4
SirenSound.wav/ad4
SirenRunSound.wav/ad4

Input States

;State Name P2.0 P2.1 P2.2 P2.3
; Start Accel Siren Brake
StopCar: /P12Start /P13Accel /P14SirenOn X
Idle: /P21Start /P23Accel /P25SirenOn X
Run: X X /P35SirenOn /P32Brake
Siren: X /P45Accel /P41SirenOff X
SirenRun: X X /P53SirenOff /P54Brake

Output States

;State names P3.0 (Left Light) P3.1 (Right Light)
SirenOn: P+ P-
SirenOff: H H

Paths

PowerUp: StopCar  SirenOff    FLASHRATE=6Hz  End
P12Start: Idle  1*StartSound   10*IdleSound  PowerDown
P21Start: StopCar  End
P13Accel: Run  2*IdleSound  1*AccelSound   20*RunSound  PowerDown
P14SirenOn: Siren  SirenOn  10*SirenSound   PowerDown
P41SirenOff: Stop  SirenOff  End
P23Accel: Run  AccelSound  Run  20*RunSound   PowerDown
P32Brake: Idle  1*DecelSound   10*IdleSound  PowerDown
P25SirenOn: 1*AccelSound  SirenRun   10*SirenRunSound  PowerDown
P35SirenOn: SirenRun  SirenOn   10xSirenRunSound   PowerDown
P53SirenOff: SirenOff  Run  20*RunSound   PowerDown
P45Accel: P25SirenOn
P54Brake: 1*DecelSound  Siren  SirenOn   10*SirenSound  PowerDown
PowerDown: SirenOff  StopCar  End
Description:
  1. The 4 switches correspond to Port2.0 to P2.3 respectively.  Each switch is properly named during the programming process to facilitate cross reference.
  2. A signal Flow Diagram is very helpful to structure the program.  This demo program is a good example to demonstrate how well Easy Format is supported by a good flow chart directly.
  3. The 5 Input States corresponds to the 5 steady states of the flow chart and can also be freely named by the users to facilitate program tracing.
  4. Each Path equation correspinds to a Path linking the steady states of the flow chart and can also be freely named by the users to facilitate program tracing.
  5. The output Port3.0 and 3.1 drives the red and blue blinking lights of the police car.   The P+ and P- signifies +ve going and -ve going pulses to provide the alternating lightling effect.  "L" means the output port is set at logic LOW.
  6. The timeout function is provided by looping the sound to the desirable time out duration, if no more trigger is received, the controller will enter the shut down mode.
(Click this button to the top of this document)

[Home]
[Introduction to Easy Format™ supported voice/melody controller]
[Syntax of Easy Formt™ support voice/melody controller]
[Introduction to Easy Format Enhanced C] [Contact Us]

EasyFormatWord.JPG (11117 bytes)

For any question or comment: e-mail to WebMaster@EasyFormat.com
Copyrights© 1999 Grow with Me, Inc.     All materials are subject to change without notice.   Easy Format is a trademark of Grow With Me, Inc.   Patent no. 5867818 and other pending patents.
Last modified: 04/18/99 04:15 PM