Icon

USC Config - v. Integer Maths Branching Demonstration

  • To follow this application import UAP1052 "Variable Period Triangle Generator" from the USC centre on the APCS web site or CD catalogue.
  • Complete understanding of the provided application is not necessary as the following is a guide to using the step mode to test program branches independently.

Introduction

This worknig example demonstrates the use of the equation editor to simulate the function of individual program branches.

The following example also features:

  • Integer maths is used to calculate values for use in the equation at power up. This technique can be used to free up the equation constants for use in the user interface.
  • Integer variables are directly controlling program branching. Three logical decisions are available after the variable is read into the stack, "=Int0", ">Int0" and "<Int0".
  • Integer counter variables are used to generate the output values due to their very fast calculating time.
  • As the application running at up a 5mS update time extra branching has been added to send memory every eighth time or 40mS apart to preven the com port from being overloaded.

Functional Description

Channel 1 is connected to a potentiometer and is scaled to produce 1 to 10 (period in seconds) when moved from 0 to 100%

Memory 4 drives the milliamp output and is scaled to produce 4 to 20mA out for an input of 0 to 10000.

The setting of channel 1 was moved every 4 seconds during the recording resulting in changes to the triangle period.

Referring to the flow chart the program is made up of three main branches that are called base on the value of variable 00.

Is Going DownIs Power OnIs Going Up

Simulating The Power On Branch

  1. Open UAP1052 click on "Equation" then "Configure".
  2. In the "Select Mode" frame click step.
  3. Click the "Step >"
  1. When asked if Var00 =0 press "Yes"
  2. The program list will jump to the beginning of the "IsPowOn" branch.
  3. Press "Step >" until the "Step >"button will no longer operate.
  4. The program will have completed the "IsPowOn" branch and the "CalcVals" branch as shown below.

At switch on the value in Var00 is float 0, therefore when the power is first applied to the USC701 the "IsPowOn" branch will run.

From Var0 other values are calculated for use in the other branches of the equation.

Power On Branch Calculations (IsPowOn)

Name Label Use Initial Value Calculated
Var00 DwnOnUp Main branch flag Float 0 Int +1
Var01 =Int 1 Fixed value after power on. Float 0 Int +1
Var02 H=Int10k Fixed value after power on. Float 0 Int 10000
Var06 = Int 0 Fixed value after power on. Float 0 Int 0
Var08 = Int -1 Fixed value after power on. Float 0 Int -1
Var10 =Int 100 Fixed value after power on. Float 0 Int 100

 

 

Before continuing to the 'Is Going Up' branch remain in the current step position (evaluate to 95) and type in the initial values plus data type to be used for V1, V2, V3, V5, V6, V8, V10 as shown below, leave V0 as float 0 for a moment.

It can be seen that only V0 is now reported, as all other values are the same as the initial value.

Now change V0 to integer 1 the error message is reported as the simulator is running the power on branch with an incorrect data type for the Var00 calculations.

This error is expected now continue to the 'Is Going Up' branch.

Simulating The Up Branch

If still in step mode from previous procedure "Simulating Power On Branch" then reset the step counter by;

  • Selecting "Edit" in the select mode frame
  • Reselecting "Step" in the "Select Mode", if prompted to "Move To Last Step Position" select "Cancel".
  1. Enter step mode end type in the power on values V1= Int 1, V2 = Int 10000, V6 = Int 0, V7 = Int 0, V8 = Int -1, V10 = Int 100 (if not already)
  2. Press step, when asked at program list 2 "Is Var00=0" select no.
  3. Press step, when asked at program list 3 "Is Var00>0" select yes.
  1. Press step until the program list has reached line 31, these steps will read the last value of Var07 (Integer value representing the output) and increase it by Var03 (required step size for current input setting).
  1. The memory results screen shows the calculated values to this point.
  2. Each time the equation runs the "IsGngUp" branch will continue to run until Var07 reaches the value of Var02 at which time the "StartDwn" branch will run.
  1. To simulate multiple operation of the equation to the current point, change the value of V7 in the "Initial Values Used In Step Equation Evaluation". V(7) in the evaluation results screen will increase by the step size.
Each time the equation is run the resulting value in Var07 is converted to a floating-point number and saved in memory 4 for use by the USC701 output components.

Simulating The Down Branch

If still in step mode from previous procedure "Simulating Power On Branch" then reset the step counter by;

  • Selecting "Edit" in the select mode frame
  • Reselecting "Step" in the "Select Mode", if prompted to "Move To Last Step Position" select "Cancel".
  1. Enter step mode and type in the power on values V1= Int -1, V2 = Int 10000, V6 = Int 0, V7 = Int 10000, V8 = Int -1, V10 = Int 100
  2. Press step, when asked at program list 2 "Is Var00=0" select no.
  3. Press step, when asked at program list 3 "Is Var00>0" select no.
  4. Press step, when asked at program list 4 "Is Var00<0" select yes.
  1. Press step until the program list has reached line 11, these steps will read the last value of Var07 (Integer value representing the output) and decrease it by Var03 (required step size for current input setting).
  1. The memory results screen shows the calculated values to this point.
  2. Each time the equation runs the "IsGngDwn" branch will continue to run until Var07 <= 0 at which time the "StartUp" branch will run.
  1. To simulate multiple operation of the equation to the current point, change the value of V7 in the "Initial Values Used In Step Equation Evaluation". V(7) in the evaluation results screen will decrease by the step size.
Each time the equation is run the resulting value in Var07 is converted to a floating-point number and saved in memory 4 for use by the USC701 output components.