October 31, 2012

EasyHDL scripting : Tutorial #1 , emulation of the TSL202R

Filed under: Proteus VSM — admin @ 10:30 am

Using EasyHDL with ISIS can be a little bit sticky because of the lack of documentation for this language.
In this tutorial, i’m starting from scratch with my own little experience and discoveries i’ve made.

First, EasyHDL is a variation of the HDL language (VERILOG).
Its BASIC-like oriented syntax.

It can be usefull to simulate simple or complex behaviors of schematic models that are not included in ISIS libraries.

For this Tutorial, we will simulate a simple behavior of a cell-array sensor known as TSL202R.
The TSL202R is a 128 photodiodes array organised in 1 row.
If you take a look at the datasheet, you’ll see that, actually, the sensor’s cells are splitted into 2 sections of 64 photodiodes each, than can be cascaded to form a unique row of 128, by correctly connecting the input/output pins of the internal shift register.

For ease of simulation, this easyHDL tutorial will simulate the device in cascaded mode, wich means that the analogue output will be AO2 pin,SO2 (’end of cell 128 output’), while the inputs of the device will be CLK and SI1 pins.
Despite that fact, SO1 (’end of 64cells output’ signal) will be available as an useable output.

Starting from the device’s datasheet, the first thing is to build the graphical object into ISIS, with Pins numbered and named accordingly to the datas ( VDD,SO1,SO2,SI1,SI2,CLK,AO1,AO2,GND )

Just before selecting ‘make device’ from the right-click menu, it should look like this :

Now, when making device, you have to Add properties/definitions to the device, in order to specify wether the simulator will have to treat it as analogic or digital when simulating.
For this tutorial, the script will act as analog, because the AO outputs of the TSL202R are analogic levels.
The Device will have 3 properties :

  • Package : you can let it blank, or add one (DIL14 like)
  • SCRIPT : default value can be the easyHDL script’s name you want to be associated with the device.

Notice that the SCRIPT property is NOT listed in the drop-down menu of the device’s properties et definition’s popup window.Select ‘blank item’ to add this property (name : SCRIPT )

The PRIMITIVE property setup  (default value : ANALOG ):

Then the SCRIPT property ( default value : RND (for example. this is the script’s name) ) :

Once Done, you can create a blank design and insert your device into it. The device name will be TLS202R  ( but anything you want will work, of course )

Now we have to insert the script with basic easyhdl code into the design.
Select the text-script mode into ISIS, then click next to the device you’ve inserted.
A ’script edit’ window pops-up.
This is where you have to type your script.
Here is the script :

The test design with output load (330ohm resistor) , input clock and reset signals, and the oscilloscope should look like this :

For easy setup, the pulse and digital clock generator’s parameters are shown , for SI1 and CLK .
The signals SI1,CLK, SO1 and AO2 analog output (Trace C) will look like this :

A (yellow) is 4Mhz clock,
B (blue) is serial-in pulse ( that’s the pulse to restart the 128cell’s output from the internal shift register)
C (redish) is the analog output (simulated). That values are stored in the script, under ‘DATA’. You can modify it freely to match your needs.
D  (green) is the SO1 signal : it fires when the 64 first cells have been output. we could have monitored SO2 wich is fired when the 128 cells have been output.

Now, let’s talk about details of the script.

    This is the script’s name. Used by ISIS to link the script to the device’s script specified as a property ‘SCRIPT’
  • ‘PIN’ : Here you make the declarations of input/output PINS of the device. the scripted PIN names must match the schematic device’s pin names. ( pin CLK for CLK pin, pin AO1 for the AO1 pins and so on..)
    PINs act as digital I/Os .
  • ‘NODE’ : it’s an analogic (voltage) point for the script. We link it to the AO2 ( analogic output ) of the schematic device.
  • Needed variables can be declared, as FLOAT , INT (integers) , or BOOL (booleans) as needed.
  • DATA is the equal command to the BASIC language DATA. Memorised datas can be read by the READ command, and RESTORE resets the READ index to the first DATA, when needed.
  • Finally, BOUNDSTEP is restricting the iterations numbers of the script. you’ll have to test around to check the effects of this command.

Play around and feel free to modify and customize the script :
For example, VDD/GND could be checked to simulate a closer behavior of the device . Also, the voltage output is proportionnal to the time of exposure of the photodiodes array ( integration time) , so a better emulation would consist to simulate that variations, as a function of the clock speed…

Stay tuned for the next tuto. I hope that one will help some of you.



August 20, 2011

MM5486 Model

Filed under: Proteus VSM — Tags: , , — admin @ 8:04 am

This model simulates the behaviour of the MM5486N IC , a 33 led driver with serial input , and cascadable serial-out pin , designed to drive common anode LED displays (i.e hdsp h151)

Limitations of the model are :
Pin 19 (brightness resistor) not modelled
All 33 outputs will be driven to VCC when in off state, and pulled down to ground when ‘on’.

The model was successfully tested with a real-life electronic device.
Click the link to download zip file: mm54861_model_and_lib



cat{ 31 } { post_142 } { } 2009-2015 EIhIS Powered by WordPress