Tuesday, December 22, 2009

Installing all the Free and Open Source EDA Tools on Fedora Release 12 Leonidas i386

If you have a fast Internet connection and you have established the Internet connection in your machine then follow the steps given below:
1. Open an instance of a terminal and run su to get root access:
]$ su
password:
2. Enter the root password and press ENTER. On correct root password entry the prompt of the shell would change from ]$ to ]#.
3. Run the following command (copy and paste it to the terminal and press ENTER) to use the package manager of Fedora, yum for installing the tools:
]# yum -y install irsim alliance* pharosc* ngspice* magic magic-doc iverilog ghdl* gtkwave gwave gspiceui \
octave* qtoctave freehdl archimedes electric ktechlab kicad pikdev piklab avr* pikloops sdcc* gsim85 \
netgen xcircuit geda* gerbv vhd2vl gds2pov dinotrace drawtiming gnuplot gresistor qucs gnucap linsmith \
nasm yasm pcb tkgate toped vym yum-presto perl-Hardware-Vhdl-Parser perl-Hardware-Vhdl-Tidy \
perl-Hardware-Vhdl-Lexer perl-Verilog presto-utils perl-Verilog-CodeGen perl-Hardware-Verilog-Parser \
perl-Verilog-Readmem perl-SystemPerl perl-SystemC-Vregs perl-Verilog perl-ModelSim-List dia nedit \
gpsim* gputils* sk2py deltarpm LabPlot plotutils gtkterm gtk+ gtk+-devel gperf ddd yumex fvwm
yum will do all the dependenciy check for u.done !!!

Tuesday, October 13, 2009

How to create a simple 3 button USB mouse using PSoC USB device CY8C24794

Writing code for a usb mouse is such a complicated thing that anybody learning the report structure will go mad. Here comes Cypress's PSoC .PSoC device CY8C24794 is a USB programmable device with a USB interface.Also it can be powered using the USB cable.We can make a simple 3 button mouse using this device within 10 mins,if the CY3214 kit is available.The PSoC makes it all possible.!!!!!The most important thing is to understand the working of basic things and then the technical stuff will become simple.Here a person who doesn't know how to configure the PSoC using the PSoC designer software is advised to go through the Cypress site to get the detailed tutorial. Anybody can download the tutorial by registering into the Cypress site.Also there is a site called PSoC developer where we can find some PSoC related useful posts.This is the code for the 3 button USB mouse
//----------------------------------------------------------------------------
// C main line

//----------------------------------------------------------------------------

#include // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#include "DualADC8.h"

BYTE abMouseData[4] = {0,0,0,0};


void main()
{

/*adc initialisation*/
char cResult1, cResult2;
char cResult1_prev, cResult2_prev;
M8C_EnableGInt; // Enable global interrupts
DUALADC8_Start(DUALADC8_HIGHPOWER); // Turn on Analog section
DUALADC8_SetCalcTime(100); // Set CalcTime to 100
DUALADC8_GetSamples(); // Start ADC
cResult1=0;cResult2=0;
cResult1_prev=0;cResult2_prev=0;
/*usb initialisation*/

M8C_EnableGInt; //Enable Global Interrupts
USBFS_Start(0, USB_5V_OPERATION); //Start USBFS Operation using device 0
//and with 5V operation
while(!USBFS_bGetConfiguration()); //Wait for Device to enumerate
//Enumeration is completed load endpoint 1. Do not toggle the first time
USBFS_LoadInEP(1, abMouseData, 3, USB_NO_TOGGLE);

/*lcd initialisation*/
LCD_1_Start();
LCD_1_Position(0,5);
while(1)
{
while(!USBFS_bGetEPAckState(1)); //Wait for ACK before loading data
//ACK has occurred, load the endpoint and toggle the data bit
USBFS_LoadInEP(1, abMouseData, 3, USB_TOGGLE);
while(DUALADC8_fIsDataAvailable == 0);
cResult1_prev=cResult1;
cResult2_prev=cResult2;
cResult1 = DUALADC8_cGetData1();
cResult2 = DUALADC8_cGetData2ClearFlag();
{
if ((cResult1_prev-cResult1)> 20 ||(cResult1-cResult1_prev) > 20)
abMouseData[1] = 0x01;
else if ((cResult1_prev-cResult1)<> 20 ||(cResult2-cResult2_prev) > 20)
abMouseData[2] = 0x01;
else if ((cResult2_prev-cResult2)< style="text-align: justify;">Here in this code the mouse x and y motions are mimicked by using 2 potentiometers.The PSoC core reads the ADC (8bit)continuously and sends the conditioned value to the PSoC core for processing and sending the required data to the system. The required value is sent through the USB interface.The PRT0DR is the port 0 data register.where the data read from the input ports of the PSoC is stored. The abMouseData is an array which is actually called the report descriptor by software guys who code for this complex USB HID device.The format for the USB HID mouse is given below