Shop OBEX P1 Docs P2 Docs Learn Events
Poor guy loooking for BS2 code ................ — Parallax Forums

Poor guy loooking for BS2 code ................

sckamsckam Posts: 27
edited 2004-10-02 21:14 in BASIC Stamp
Dear all,
After couples of burning midnight oil, I still could not figure out how it should be(due to lack of training and exposure), I really hope some expert out there can help me, the poor guy in creating the BS2 code:

“Process Simulator” Working Principles:

How it works ? :
The input of the “Process Simulator” is getting the current input 4 to 20mA from the output of the other PID simulator (not show in the PDF file) (to be indicated as X in BS2 code).
·
The input X·will be display as percentage (using numeric value or bar graph) on Scott Edwards’s Serial LCD (BPI-216)(indicated as LCD in the schematic).

Then it will go through each stage of:
1. Disturbance (simulate by SW3) (output from here to be refer as X1 in BS2 code).
··· The effect of disturbance on input is just adding up to the input to become output X1.
2. First unit of First Order Lag Delay Time (simulate by SW4) (output from here to be···
··· refer as X2 in BS2 code).
3. Second unit of First Order Lag Delay Time (simulate by SW5) (output from here to be···
··· refer as X3 in BS2 code).
4. Third unit of First Order Lag Delay Time (simulate by SW6) (output from here to be···
··· refer as X4 in BS2 code).
5. The Output X4 will be minus 50% or 0.5 (the output refer as Y in BS2 code).
·
Explain of function of SW3,SW4,SW5 and SW6
All the simulation done by SW3,SW4,SW5 and SW6 will be supply through mechanical selector switches that have different resistance values(from different resistors) as output when the selector switch to be rotate at different position.
SW3 is only providing add up value (D) to the Input (X), it does not give any delay time as compare to SW4, SW5 and SW6.
Time delay from the switches SW4,SW5 and SW6 will be represent as T1,T2 and T3 (to represent the delay time in the first order lag delay time exponential formula).
·
Then the analogue values T1, T2 and T3 will be supply to BS2 via ADC0832CCN as digital value. The BS2 will then supply the T1,T2 and T3 values to Al Williams’s PAK XII math co-processor chip.
The ·PAK XII will be doing all· the mathematic exponential calculation base on those exponential first order lag delay time formula as indicated in PDF files.
The result (Y) from PAK XII then pass back to BS2.

BS2 will be display the output Y as percentage (using numeric value and bar graph) on Scott Edwards’s Serial LCD (BPI-216) (refer as LCD2 on schematic) and also as Analogue Output (the BS2 will convert the digital value to analogue value via DAC1257) to knob W1,W2 and W3.

Questions:

1.Is my schematic design ok ?

2.ADC part – by convert the input 4-20mA(placing precision resistor 250ohm 0.1% in series with input), can I share the same ADC0832CCN(U2) with SW3 ? as I am short of BS2 I/O point.
·
3. I cannot get any reading voltage value using the 'DEBUG' on the BS Editor DEBUG Termial, when I try to measure the output from U3,U4 and U5.
So I measured the output from U3,U4 and U5, but the value is very small only few mV.
Shall I place those Operational Amplifiers here for signal amplification, is that ok ?
·
4. How to do the digital to analogue conversion(DAC) in BS2 coding ?

5.How is the BS2 coding for PAK-XII ?

Attac here the schematic, block diagram and the process simulator's template faceplate.

Thank you very much in advance.

Best regards.
Kam

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you.

Warm regards.
Kam

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-10-02 11:11
    Hi Kam,

    Nice progect you have designed !!

    I would suggest you work the software step by step. Of course first get the Stamp running then maybe an LCD display. After that an ADC and the input X1 (signal from outside + disturbance). First thing to do may be to ad a (temperary) blinking LED to the Stamp so you can see it is actually running as your progam develops. Feels good in hard times if you can 'see' the Stamp running smile.gif)).

    After that you can try to put in the PAK and an exponential delay.

    This way your code and your application grow as your experience gows. Devide your project into manageble pieces and you will succeed smile.gif.

    Regards,

    Klaus

    PS keep me informed, I like the idea of a simulation system with 2 Stamps smile.gif.
  • DaveGDaveG Posts: 84
    edited 2004-10-02 21:14
    Kam,

    I looked at your schematic and I have a suggestion.

    Regarding your problem with U3, U4 & U5:
    First of all, I am assuming that you want the circuit to do the following:
    a. The switches (SW3-SW5) produce a series of voltage steps, based on the values of the resistors(R6-R29).
    b. The voltage steps are buffered by the op amps(U6,U7) and applied to the inputs of the ADCs(U2-U5).

    The reason you are seeing very small voltages from U3,U4, & U5 is that the voltages from the switches are not right.
    On each switch, you need to add another resistor, from the wiper contact to ground. This will form a Voltage-Divider.
    For example, try adding a 20K resistor from the wiper of SW4 to ground. Then measure the output of U6B and
    I think you'll find that it is working, when you rotate the switch. And you'll be getting a good reading from U3.

    The switches, as you have them currently connected, will not put out voltage steps, because the resistors
    do not form a voltage-divider. You need to add another resistor from the wiper to ground.
    I would suggest that you do some research on how voltage-dividers work. This will help you select the values
    of the resistors, so you get the exact voltage steps you want.

    I think you'll also find that the resistor values on SW3 are too low, they will draw too much current in a
    voltage-divider circuit. The solution is to make them larger, then adjust the value of the resistor to ground to
    get the desired voltage steps.

    It is not necessary to add any signal amplification to U6 or U7, the voltage-dividers will provide plenty of signal.


    Good luck.

    Dave G
Sign In or Register to comment.