jueves, 16 de junio de 2011

Visio

The objective of this exercise is to learn the basics about Vision Builder AI environment 2009 (SP1) through a tutorial that Vision Builder itself gives us.

In order to familiarize themselves with the working environment of Vision Builder I will explain first what you have in your front panel:



1 .- This area view the image or images that we are taking, either through a camera or stored in a 'folder' on your computer.
2 .- Here we go inserting instructions in our exercise.
3 .- In this field we can take decisions by states and transitions, ie, as if a state machine is involved.
4 .- From here choose the instructions inserted in each exercise.




To begin this exercise, we will use images of the tutorial number one Vision Builder offers a simulation mode.




To do this we will click on (Simulate Acquisition) (1), then we will click on to load the images in the tutorial, (2) then select the first and (3) Finally click 'Open'.

Once we have the image acquisition, we will take a pattern thereof, that is, identify a part that is common to all of them to determine their position. To do this we will click on (Pattern Match).

Then select the area you want to identify the boat (in my case I selected the area marked by the green box). To end the pattern will click 'Next' and then 'finsihed'.





Ahora que ya hemos marcado el patrón de nuestra imagen pasaremos a darle una coordenada de origen. Para ello haremos click en (Set Coordenade) (Fig.5).
Después haremos click en ‘ Settings ‘ y escogeremos desplazarnos en el eje de las X,ya que las imágenes tomadas sola varían en ese eje  (Fig. 6).


fig5


 fig 6

The next step will be to detect whether or not the pot lid. This is done by using (Intensity Measure), an instruction to detect color changes (in our case from white to black).

To mark the areas of interest (green boxes), simply drag the pointer left click on the image, if we check more than one area then press 'Control' while we are marking the zones.

In addition we will use the coordinate pattern to identify the image covers about this.



 The following will check the status of the above steps by using the Step Inspection Status .

The following will check the status of the above steps by using the Step Inspection Status.


Finally we create the indicators that show information about each of the boats. in thiscaso nos indicará si el In this pot lid or not. This instruction will choose the 'Custom Overlay .
                          First we will give you a name and then we will set it up.


To create the indicator we will click on  .    and then drag in the image, using the left mouse button to get the size you want.

Once you have will give you the value that indicadaremo if 'True' or 'flase', assigning it the value of education 'Measure Intensity'.

Finally we write the text to display in case of success or failure.








martes, 14 de junio de 2011

Exercise using the PIC18F4550 LCD Graphic

The following exercise shows how to use a graphic LCD LGM12641BS1R specifically. To control the LCD usethe PIC18F4550. To program the PIC will use the C language using the PCWHD CSS Compiler. Once programmed the ride thereon Proteus designing the circuit to simulate and another with the PCB design tomanufacture the plate.




 The first thing is to make the main code to load into the PIC. First use the library of the 18F4550. After I declare that I will use the PIC's internal crystal and operating at a frequency of 8MHz. Subsequently declared the library that controls the LCD Graphic and then the library that contains the commands necessary to write to the LCD.

Declare an array's number of char to write the name, date and name of the center. Must take these variablesas the Graphic LCD can not write directly on it like a normal LCD. Once written, drawing 2 lines to highlight the name and last name. Using the option to fill circle and created a circle within a circle without filling and the white border. Repeating this in different heights and sizes, helping to create 3 circles. To complete a circle together with two lines.






Once the source code step by designing the plate to emulate in Proteus. To avoid blurring the design much always use tags. We feed the PIC Vcc and Vss. We put a circuit to control and power MRCL PIC reset manually. Finally she gets the Graphic LCD.

 Dowload:
https://sites.google.com/site/franbc0100/nuevalcddeluis.rar?attredirects=0&d=1 

Communication between PIC's 18F series by the SPI bus

Exercise involves connecting two PIC's 18F4550 through SPI port. In my case the exercise is simple Master in case of receiving a logic 1 at the door RA0 send a signal to the Slave. This activates an LED long as it says the Master.


 By having two independent PICs we will need to have two codes. Empelo CCS C language to program the PIC's. The first thing is to program the Master. The teacher is aware of how the RA0 is if entry is a logical 1 this will account for 1 and writes it to the SPI. In the event that there is a logical 0 RA0 this account written in a 0.



Once we set a schedule Master Slave. The slave checks all the time if you have entered a value in the SPI. If you entered data enter thou read the data and stored in the variable number. If number is 1 turn out RA02 activating an LED.


Dowloar year:
https://sites.google.com/site/franbc0100/%5BComunicacionentrepics%5D.rar?attredirects=0&d=1

Temperature Gauge

With a PIC 18F4550 SPI communication using will read the temperature by TC77. It will show real-time temperature in degrees Celsius. The temperature is shown in a alphanumeric LCD 16 × 2.

The TC77 is a temperature sensor designed for use in SPI communication. Looking at their data sheet we can see how it works and know what steps are required to read the book he gives us. Once we know how we will create the code for PIC. In my case, always use proper C language as applied to CCS PIC's.

I had problems to display tenths of temperature and I have decided to show only whole degrees because I think that a difference of 14.2 and 14.6 is hardly relevant at least in our application. My code only shows whole degrees.


exercise so that you can download it.

https://sites.google.com/site/franbc0100/SPITemperatura.rar?attredirects=0&d=1 


EEPROM

 With this exercise we will learn to read and write in an EEPROM (25LC020) through SPI communication with the PIC 18F4550.

The exercise consists of the following:




To start writing the program code in C language for PIC's of CCS. The PIC is programmed as a master at using the SPI BUS. The first thing is to write, in this case write 7 data, from 0 × 00 to 0 × 07. Amedida that are written to the EEPROM is written to the LCD every half second, the first E stands for writing. Once written, we will read and display them as Ian is displayed on the LCD every half second. The L is read




To test the operation load the program on the Proteus and simulate. Using a tool you can view all transfers made by the SPI. In the simulation is seen as the PIC reads the data recorded in the EEPROM as the LED goes from 0 to 6.



Dowload year:

https://sites.google.com/site/franbc0100/%5BEscribirLeerEEPROMSPI%5D.rar?attredirects=0&d=1

Comberter Dijital Analogic

Using the converter PCF8591, create a digital-analog converter.

The converter is 8 bits resolution and communicate with a high-end PIC (18F4550) via I2C.
To schedule use code language 'C ' (SCCS Compiler) and its simulation using Proteus.
The conversion will be displayed with the virtual oscilloscope Proteus.


Now that we are clear about the content of the exercise we will set the converter to work with him. The first thing to know is that it is a converter

that can work in analog-digital or digital-analog.
In addition we also know that the line of communication with the PIC will be the I2C bus.
Now we will configure it as simply indicates the 
PDF,to work with him.


After reviewing the PDF see the need to send 2 bytes ('ADDRESSING'and 'Control ') to work with the PCF8591.


The first byte ('ADDRESSING') after the start we send I2C communication (i2c_start ();). As we can see, the byte consists of a fixed and a programmable part.
The fixed part contains the four bit more weight ('1001').
The programmable part contains the four least significant bits. The first three (A2, A1 and A0) are the analog inputs and the least significant bit, read or write data as configured.

This part will be in 'OOOO', and we will not use any analog input and also it's in 'Writing'.





SECOND BYTE ('Control'), configure the device to work on digital-analog converter mode, besides indicating that the output will show the conversion (A OUT).

To use it as only 'A OUT', the byte will be '01000000 '. The 'msb' first bit ('O ') is fixed, the '1' indicates that we use the output 'A OUT' and the others left to 'O' because we do not use.








Finally here I leave the code, as you see all I do is increase or decrease the variable 'analogue' as it is. That is, if you're in 'OO' the incrementaré and if it gets to 'FF ' the decrementaré.

The variable ranges between these two values ​​because being an 8-bit converter, the accuracy of this is 2 ^ 8 = 256 (256 different values ​​are those that can take the converter).

Therefore, the oscillation between 'OO' and 'FF ' (from O to 255).





Dowload exercices: