Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

May 2, 2013

Chat with Friends through ms dos Command Prompt


1) All you need is your friend's IP Address and your Command Prompt.


2) Open Notepad and write this code as it is.....!

@echo off
:A
Cls
echo MESSENGER
set /p n=User:
set /p m=Message:
net send %n% %m%
Pause
Goto A

3) Now save this as "Messenger.Bat".

4) Open Command Prompt.

5) Drag this file (.bat file) over to Command Prompt and press Enter.

6) Now, type the IP Address of the computer you want to contact and press enter


7) Now all you need to do is type your message and press Enter.
Start Chatting.......!

How to create autorun file


   This is meant only for educational purpose and i do not encourage anyone to involve in any illegal activities and i am not responsible for that.


Ready to know how to create autorun file.Firstly autorun file is the windows file which will start immediately once you plugin your pendrives or your CDs.They are usually in the .inf format and is kept hidden from the user.Few days back i wrote a post on a particular autorun virus that was spreading fast and you can take a look at the solution for that virus here : Pendrive Autorun Virus

How autorun files are being created ?

Initially you do not need any extra tools for creating an autorun file,just a notepad can do this job for you.
Open a notepad from run command by pressing " WinKey+R " and then by typing "notepad" and click "ok".

An autorun files starts with the name autorun which is placed within the square brackets so that the compiler can understand that it is an autorun file , like this :
[autorun]
Few commands that can be used inside the autorun files are :

    label = Some drive
    The label command is used to set a drive name for your device.
    icon = someicon.ico
    Specific icon can be set for your drive.If you need a .ico files you can get it from here : IconArchieve
    open = filename.exe
    Use the command to open any files that are stored inside your pendrive.

Nov 9, 2010

WinAVR

Start with WINAVR

Instruction Manual to Start with AVT "Plug & Play Kit" with WINAVR


1.      Winavr Download and Installtion
Winavr is a opensource and free available software. Download winavr from the link http://sourceforge.net/projects/winavr/ and install it.
2.      USBASP/Usbtiny Driver installation
·         Connect usbasp/USBTiny programmer to usb port of your computer. Computer will detect usb device and will show dialog box as shown below.
·                     Click button Yes, this time only, then click next button. The wizard will display next dialog box as shown below
 
·         Click on the Install from specified location button→next
·         Now the wizard will ask for windriver  folder as shown below
·         Browse the win-driver folder wherever you have→ next
·         Now the installation starts and will take some time (few seconds).A message will display on the bottom  right corner of taskbar  as shown below.
Now USBASP/UsbTiny driver is installed and you are ready to download data to the microcontroller.
3.      How to start a new project
·         Create a new folder and name it whatever you want.
·         Start menu→ All programs→ winavr→ Programmers Notepad
·         In programmers notepad window, click on File menu→ new→ c/c++
·         Click on File menuSave As
·         Save this fie in project folder, name the file as main.c
·         Generate a Makefile (discussed in subsequent topic) in same folder
·         Open Makefile in programmer’s Notepad
·         Make five changes in Make file
·         Write your code in main.c
Note: Files needed for successful compilation main.c and Makefile.

4.      How to generate MakeFile
·         Simplest way to get a Make file: Copy a Makefile from any old project to your new project folder.
·         If you don’t have any Make file in your computer, you need to generate it.
·         Click on :StartàAll ProgramsàWINAVR*******àMFile[WINAVR]
·         A window will appear with lots of text written on it.
·         Click on FileàSave As
·         Save this file in your Project folder (don’t change the file name)

5.      Five changes in Makefile

Variables
Default
Modified
1
MCU name
Line #44
# MCU name  
MCU = atmega128
# MCU name  
MCU = atmega32
2
Processor frequency
Line #65

F_CPU = 8000000

F_CPU = 4000000
3
Add extra include file
(If you are including extra header files)  
 Line #83                        

SRC = $(TARGET).c

SRC = $(TARGET).c lcd_lib.c(for lcd display place lcd_lib .c separated by space)
4
AVRDUDE programmer Name
Line #276

AVRDUDE_PROGRAMMER =  STK500

AVRDUDE_PROGRAMMER = usbasp
5
AVRDUDE port Name
Line #279

AVRDUDE_PORT = COM1

AVRDUDE_PORT = usb



6.      How to compile and Transfer your program
Note: Connect the usbasp programmer to the usb port of your computer and the other end of the programmer to the BRiCS’ plug & play AVR kit.

·         Write your complete code in file main.c using programmer’s Notepad
·         Click on toolà [WINAVR]Make All to compile your code. If there is no error in your code, it will generate a main.hex file in your project folder. Output window will look like figure as below.
Note: If the Process Exit Code is 0, code has compiled successfully but it does not ensure that your code is right and free from logical errors.
·         Click on toolà[WINAVR]program to download your code to micro-controller using USBASP programmer
·         When the hex file is downloaded in to microcontroller, in the output window you will see the lines as shown in above figure.
·         If you are using parallel port connector use ponyprog to downloadmain.hex file



7.      How to use Ponyprog
·         Install ponyprog on your computer
·         Run ponyprog using link in start menu
·         Click OK on all windows appears
·         Click Setupàcalibration
·         Wait for popup window
·         Click on OK(on popup window)
·         Click on DeviceàAVR microàAtmega32 to select your device
·         Click SetupàInterface setup
·         A setup window will appear
·         Select parallel
·         Select AVR ISP I/O (the one bellow parallel option)
·         Select lpt1
·         Click Probe to check your programmer. It will show OK if programmer is connected and everything is OK.
·         Click OK
·         Click OK
·         Open your main.hex file using: FileàOpen Device File.
·         It will show lots of hex numbers in window
·         Download your code to micro-controller using: Commandàwrite all
·         Wait for successful download

8.      Sample code to blink LEDs on port B and port D:
#include <avr/io.h>                    //  header file
#include <util/delay.h>               //   header file
int main(void)                        // main function
{
DDRB=0xFF;           //port B enabled
DDRD=0xFF;           //port D enabled
int i=0;             //A variable i and enabled to 0
while (1)
{
for(i=1;i<256;i=i*2){PORTB=i;_delay_ms(100);}  //port B pins will be on from 1 to 8 after           every  100 miliseconds
for(i=1;i<256;i=i*2){PORTD=i;_delay_ms(100);}  //port B pins will be on from 1 to 8 after    every 100 miliseconds
}
return 0;                                       //return nothing to main function
}

9.      Sample code to print string on 16*2 LCD screen:
#include <avr/io.h>                //  header file
#include <util/delay.h>            //  header file
#include "lcd_lib.h"               //extra  header file included for LCD
int main(void)                     // main function
{
LCDinit();         //Initializes LCD              
LCDclr();          //Clears LCD
while (1)
{
LCDGotoXY(5,0);   //Cursor to (5,0) position
LCDstring("BRiCS",5);   //Outputs string to LCD
_delay_ms(10);          //delay of 10 miliseconds
LCDGotoXY(0,1);         //Cursor to (0,1) position
LCDstring("A Step Towards Future",21); //Outputs string to LCD
LCDshiftRight(1);     //shift by 1 character Right        
_delay_ms(100);        //delay of 10 miliseconds
}
return 0;             //return nothing to main function
}