/* ---------------- JAVA+SCRIPT 1 ---------------- */

AVR Programming using ISP and PonyProg

>> Tuesday, June 14, 2011

PonyProg is a free serial device programmer software with a user friendly GUI framework available for Windows and Linux. You can download PonyProg here and install. Its purpose is reading and writing every serial device using either the serial or parallel port on a PC. At the moment following devices are currently supported with PonyProg software.

AVR Microcontroller
PIC Microcontroller
I²C Bus EEPROM
SPI EEPROM
Siemens EEPROM
Microwire EEPROM

Setting up the PonyProg environment
When we first start PonyProg this is the screen we see, click OK to start.


After clicking OK button following message will display to inform us that bus timing calibration is not done for read write operations. Click OK to continue.


Bus timing calibration can be selected from Setup->Calibration menu.

  

Click Yes to calibrate the bus timing.

Click OK to continue

Setting up the Hardware
Goto Setup->Interface Setup to setup the hardware.


Set all the parameter as follows and click OK

Rest  part of this post is
read more

Read more...

[DIY]+[AVR Programmer]+[PonyProg]

>> Thursday, May 26, 2011

Introduction
There are many kinds of AVR programmers in market, most of these use the parallel port, a serial port (COM port), or the USB but they are very costly and hobbyist like me can not buy such a costly programmer so i decided to make a cheap AVR programmer. Being a electronics hobbyist I believe in DIY (do it yourself) so here I glad to tell you that my programmer can be built easily in very short amount of time and since there are only few parts, it is very cheap. This AVR programmer is called "AVR ISP (In System Programmer) programmer".
On the AVR microcontroller side there are two possibilities to program the AVR microcontroller, socket and in-circuit. A socket programmer provides a way to connect just a bare AVR microcontroller to the programmer and ISP programmers however connect to the AVR microcontroller while it is connected to the target circuit. So ISP allows programming of a AVR microcontroller in circuit, avoiding the need to constantly take it in and out of the programmer and the subsequent bending of pins.

Advantage
  • This simple AVR Programmer will allow you to painlessly transfer hex programs to most ATMEL AVR microcontrollers without sacrificing your budget and time
  • This AVR programmer  is very cheap due to only few common parts are used.  
  • It is in-system programmer so can be used to conveniently program AVR microcontrollers without removing them from the target circuit.   
  • It can be built in very short amount of time.
  • This AVR programmer is compatible with a popular PonyProg software that shows you a status bar of the programming progress. 
How to build
Here you can find schematic, board layout and component layout of the my " AVR ISP programmer".
Schematic 
 Board Layout
 Component Layout

Description of the in-system programmer
The programmer is quite simple and it is based on the SI-Prog from the author of PonyProg software. The Zener diodes D1, D2 with the resistors R1, R2 reduce the voltage from the ouput pins DTR, RTS on the serial port to around 5V which is suitable for microcontroller (MOSI, SCK). MISO signal is connected directly to the input CTS pin. The diode D3 with the resistor R3,R4 drive the NPN transistor Q1, which controls RESET signal. The AVR microcontrollers are in reset when the signal has low level. The resistor R5 works as a pull-up for reset signal. The resistor R3 helps to close the transistor Q1. The programmer has standard 6 pins header.

Download
You can find eagle schematic and board files in following image (see my another interesting post here to see hidden files).
2 Hidden Files

How to program with PonyProg
Check my another post here in continuation with this post.
 

read more

Read more...

PIC Programming using ICSP and ICPROG

>> Monday, May 23, 2011

IC-Prog is a free windows program that you can use for PIC Programming. It interfaces using either the serial or parallel port on a PC. You can download IC-Prog here. The following devices are currently supported IC-Prog software.

Microchip PIC devices:  
Spi Microcontrollers:  
Flash Microcontrollers:  
Philips Serial Microcontrollers:  
I2C eeproms:  
4-Wire eeproms:  
Spi eeproms:   
Microwire eeproms:  
Modern Serial eeproms:  
IM-Bus eeproms:  
Scenix/Ubicom devices : 


Setting up the IC-Prog environment
When we first start IC-Prog this is the screen we see for selecting the hardware for the PIC programmer; I have selected JDM programmer - a serial port programmer, Windows API - interface and leave rest of the settings same.

Press OK to continue. After this the main program screen is displayed.

How to select a device to program:
Device can be selected in two ways. Firstly, we can select our device (in my case it is 16f877a) from combobox located at top right side of the IC-Prog software window.

Secondly, goto to software menu and select Settings->Device->Microchip PIC->More->More->PIC 16f877a.

Now goto File->Open and select hex file to be uploaded (burned) in PIC 16f877a microcontroller. When opened file get loaded in IC-Prog buffer following action can be taken :

Program Device

The program device button does just that it programs the contents loaded from the hex file (in IC-Prog memory) into the program memory of the PIC micro. If there is any EEPROM in the chip then it programs this as well. Finally it programs the configuration word

Read Device
The read device button reads back the entire contents of the chip into the currently selected buffer (shown at the bottom of the ICPROG window). So you can save the hex file or compare it to the contents of another buffer.

Verify Device
The verify device button reads back the entire contents of the chip ensuring that it matches the hex file. Verification may automatically happen at the end.Once you get used to IC-Prog and your hardware works reliably you may only want to do a verify if something does not work otherwise it takes more time up.
Note: Depending on settings in menu (Settings->Options->Programming)

Erase Device

The next PIC programming action is to erase the device by hitting the erase device button. It sends a command to the PIC which erases the whole device including protection bits. So this command quickly erases the chip.

Note: You don't have to use the erase button as the program button will overwrite the chip contents anyway. It is sometimes useful if you want to convince yourself that the program is actually programmed into the device correctly.

Which are ICSP pins of microcontroller
As we know ICSP pins are used to upload hex file in microcontroller. Here are ICSP pins of some PIC microcontroller.

16f84

16f877

16f628

18f452

18f2550

Some Useful Videos
Watch following videos to setting up the JDM Programmer hardware settings in IC-Prog software and uploading hex file in microcontroller (in my case it is 16f877a).


IC-Prog Settings


Uploading hex file
read more

Read more...

Hide files inside of JPEG/GIF images

>> Sunday, May 22, 2011

If you’re looking to hide files on your PC hard drive, you may have read about ways to encrypt folders or change the attributes on a file so that they cannot be accessed by prying eyes. However, a lot of times hiding files or folders in that way requires that you install some sort of software on your computer, which could then be spotted by someone else. The another reason to hide files is, if
  • You suspect someone's illegally distributing your copyrighted PDF's or images, so you add hidden copyright information in them.
  • You want to exchange information like passwords or sensitive images over an insecure transmission protocol, like email.
  • You want to embed secret files available only to a select few in a public forum.
  • You want to impress your friends and co-workers with your sneaky ways.

Here I’m going to show you a new way to hide files that is little bit tricky but safe. Using a simple trick in Windows. You can actually hide any type of file inside of an image file, including txt, exe, mp3, avi, or whatever else. Not only that, you can actually store many files inside of single JPG/GIF file  and no one can imagine files are hidden inside picture file. This can come in very handy if you need to hide files and don’t want to bother with encryption and all that other technical stuff.

How to hide files inside of image file:
In order to accomplish this task, you will need to have either WinZip or WinRAR installed on your computer. You can download either of these two off the Internet and use them without having to pay anything. Here are the steps for hiding files in image file:
  • Create a folder on your hard drive, i.e. C:\Test and put in all of the files that you want to hide into that folder. Also, place the image that you will be using to hide the files in.
  • Now select all of the files that you want to hide, right-click on them, and choose the option to add them to a compressed ZIP or RAR file. Only select the files you want to hide, not the picture. Name it whatever you want, i.e. “test.rar”. 
  • Now you should have a folder that looks something like this with files, a GIF image, and a compressed archive
  • Now here’s the real part. Click on Start, and then click on Run. Type in "CMD" without the quotes and press Enter. You should now see the command prompt window open. Type in "CD\" to get to the root directory and then type CD and the directory name that you created, i.e. "CD Test".
  • Now type in the following command and press Enter:
    copy /b fp.gif + test.rar hidden.gif
    You should get a response like below


Just make sure that you check the file extension on the compressed file, whether it is .ZIP or .RAR as you have to type out the entire file name with extension in the command. I have heard that some people say that they have had problems doing this with a .ZIP extension, so if that doesn’t work, make sure to compress to a .RAR file.
And that’s it! The picture file will have been updated with the compressed archive inside! You can actually check the file size of the picture and see that it has increased by the same amount as the size of the archive.

How to see files inside of image file
You can access your hidden file in two ways. Firstly, you can just right-click on the GIF image and choose Open With and then scroll down to WinRAR. See following image for reference:


Secondly, simply change the .GIF extension to .RAR using command "rename hidden.gif hidden.rar" without quotes and open the file using WinRAR.


Either way, you’ll see your hidden files show up that you can then extract out.


That’s it! That is all it takes to hide files inside JPG/GIF picture files! It’s a great way simply because not many people know it’s possible and no one even thinks about a picture as having to the ability to “hide” files.

Enjoy and Happy Hiding!


Note: All image file used in this post has hidden file, to check click on image then save image and follow to above steps.



read more

Read more...

[DIY]+[PIC Programmer]+[IC-Prog]

>> Friday, May 20, 2011

Introduction
There are many kinds of PIC programmers in market, most of these use the parallel port, a serial port (COM port), or the USB but they are very costly and hobbyist like me can not  buy such a costly programmer so i decided to make a cheap PIC programmer. Being a electronics hobbyist I believe in DIY (do it yourself) so here I glad to tell you that my programmer can be built easily. The programmer, which I built, does not need an external power supply it takes all necessary signals and power supply from RS232 serial port, and since there are only few parts, it is very cheap and easy to make. This PIC programmer is called "JDM programmer" and based on ICSP (In-Circuit Serial Programming) . This name comes from the name of Jens Dyekjar Madsen who devised this first. His homepage is here.


Advantage
  • This simple PIC Programmer will allow you to painlessly transfer hex programs to most Microchip PIC microcontrollers without sacrificing your budget and time
  • This PIC programmer  is very cheap due to only few common parts are used.  
  • It is in-circuit serial programmer so can be used to conveniently program PIC microcontrollers without removing them from the target circuit.   
  • It can be built in very short amount of time.
  • This PIC programmer is compatible with a popular IC-Prog software that shows you a status bar of the programming progress. 
How to build
Before you build this "PIC programmer", I recommend checking to see if there is enough output voltage at the serial port your personal computer. If TXD, DTR, and RTS do not have more than +7.5V(or -7.5V), this programmer will not work well, especially, with the latest laptop computers that using low power RS232 interface ICs. See follwing image to find TXD, DTR and RTS pins.
On the PIC side there are two possibilities to program the PIC microcontroller, socket and in-circuit. A socket programmer provides a way to connect just a bare PIC to the programmer and In-circuit programmers however connect to the PIC while it is connected to the target circuit. So ICSP allows programming of a PIC in circuit, avoiding the need to constantly take it in and out of the programmer and the subsequent bending of pins.


ICSP mode of programming 
In ICSP mode of programming PICs are programmed using 5 signals. The data is transferred using a two wire synchronous serial scheme, with the clock always controlled by the programmer. The ICSP signals are:  

GND:Negative power input to the PIC and the zero volts reference for the remaining signals. Voltages of the other signals are implicitly with respect to GND.
Vdd:This is the positive power input to the PIC. Some programmers require this to be provided by the circuit (circuit must be at least partially powered up), some programmers expect to drive this line themselves and require the circuit to be off, while others can be configured either way (like the Microchip ICD2). The Embed Inc programmers expect to drive the Vdd line themselves and require the target circuit to be off during programming.
Vpp:Programming mode voltage. This must be connected to the MCLR pin, or the Vpp pin of the optional ICSP port available on some large-pincount PICs. To put the PIC into programming mode, this line must be in a specified range that varies from PIC to PIC. For 5V PICs, this is always some amount above Vdd, and can be as high as 13.5V. The 3.3V only PICs like the 18FJ, 24H, and 33F series use a special signature to enter programming mode and Vpp is a digital signal that is either at ground or Vdd. There is no one Vpp voltage that is within the valid Vpp range of all PICs. In fact, the minimum required Vpp level for some PICs can damage other PICs.
PGC:Clock line of the serial data interface. This line swings from GND to Vdd and is always driven by the programmer. Data is transferred on the falling edge.
PGD:Serial data line. The serial interface is bi-directional, so this line can be driven by either the programmer or the PIC depending on the current operation. In either case this line swings from GND to Vdd. A bit is transferred on the falling edge of PGC. 

Here you can find schematic, board layout and component layout of the my "JDM programmer" which is  based on ICSP.
Schematic 
 Board Layout
 Component Layout

Download
You can find eagle schematic and board files in following image (see my another interesting post here to see hidden files).
2 Hidden Files
How to program with IC-Prog
Check my another post here in continuation with this post.
 

read more

Read more...

[Winavr]+[Eclipse IDE]

>> Thursday, May 5, 2011

Probably many of us (including me) are using Programmers Notepad or AVR Studio to set up AVR projects. Each of them has advantages and disadvantages. For instance WinAVR comes with Programmers Notepad GUI by default. It is very powerful editor, but there are lots of manual routines required to start compiling project – like setting up makefile, creating file dependencies, etc. AVR Studio is a great solution which generates makefiles automatically, and it has great simulator for immediate debugging. So why would we need another IDE? Actually Eclipse IDE is one of the best open source tools that is widely used by programmers. Eclipse has some nice features that makes it attractive like code writing with auto-complete functionality,  optimized for managing projects, subversion integration, code completion in editor.  So why not to give a try for it.

Download and Installation 
First of all make sure you have latest WinAVR tools installed. Latest WinAVR can be downloaded here and need to be installed.

Eclipse IDE is a Java based IDE, so we also need Java Runtime 5 (or higher). Java Runtime can be downloaded here and need to be installed. Then download Eclipse IDE for C/C++ for Windows platform  from here. Eclipse is self contained (does not require installation) and only needs to be unpacked (e.g. c:\eclipse).

Now you need to download AVR Eclipse plugin from here. This plugin is self contained (does not require installation) and only needs to be unpacked in Plugin folder (e.g. c:\eclipse\plugin)


How to run Eclipse IDE
Run Eclipse by double click.

Following screens show that everything gone fine.



This is default location of the workspace, press OK button. Following welcome page indicates that Eclipse IDE is working and we can start our winavr projects.

Dismiss the welcome page by clicking the cross on the tab to reveal the actual work environment. Now we can start new project.

First project with code
To start a new project go to File->New->C Project or C++ Project. Select Empty Project in AVR Cross Target Aplications and enter Project name which also serves as new project folder in desired location. In my case my project name is test.project01.


After pressing Next you will have to select configurations weather you want to debug or generate hex file. Lets leave both (debug and release) configurations selected.
Click Next..

Here we must select AVR microcontroller and its clock frequency. After selections are done click Finish button to prepare new project. Now our project is set up we can start writing program for our AVR. To add files to project we can create new or add existing source files. Simply go to File->New->Source File to add blank C or C++ file. We can use drag and drop feature to add files to project tree. Files also are copied to project folder physically.

How to compile
To compile the source code go to Project->Build Project or press following button in Eclipse IDE.

After compiling the few lines of source code I noticed that it is 21.5% full,

so we need to reduce the size of the compiled file with the help of following  settlings in Eclipse IDE. These settings will reduce the compiled file size dramatically to 1%.

Optimization to reduce code size
For optimization we have to select Project->Properties. Then select C/C++ Build->Settings in the left pane. Select Additional Tools in Toolchain in the right pane. Check Generate HEX file for Flash memory. Check Print Size.

Select AVR Assembler and then Debugging. Set Generate Debugging Info to No debugging info

Select AVR Compiler and then Debugging. Set Generate Debugging Info to No debugging info

Select AVR Compiler and then Optimization. Set Optimization Level to Size Optimizations (-Os)

Select AVR C++ Compiler and then Debugging. Set Generate Debugging Info to No debugging info

Select AVR C++ Compiler and then Optimization. Set Optimization Level to Size Optimizations (-Os)

Set Other Optimization Flags to following (this is to reduce hex file size):
-ffunction-sections -fdata-sections -Wl,--gc-sections

Select AVR C/C++ Linker.In the linker menu, change command line pattern to the following:
${COMMAND} --cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}


read more

Read more...