Tuesday 28 March 2023

List of Common Microcontrollers used in Embedded Domain


Below is list of common microcontrollers used in embedded systems, categorized by their bit architecture:


8-bit Microcontrollers:

·       Atmel AVR ATmega series

·       Microchip PIC series

·       Freescale HC08 series

·       TI MSP430 series

·       Renesas H8 series

·       Cypress PSoC 1 series

·       STMicroelectronics STM8 series

·       NXP (formerly Philips) LPC900 series 


16-bit Microcontrollers:


·       Microchip PIC24 series

·       Freescale HCS12 series

·       Renesas M16C series

·       Infineon C166 series

·       Atmel AVR XMEGA series

·       TI MSP430X series

·       STMicroelectronics STM32 series


32-bit Microcontrollers:


·       Atmel SAM3X series

·       Microchip PIC32 series

·       NXP LPC1700 series

·       Renesas RX600 series

·       STMicroelectronics STM32F series

·       TI Stellaris LM3S series

·       Freescale Kinetis series

This is not an exhaustive list and there are many other microcontrollers available in each category and also different variants are available with different specifications and features. 

Some popular Integrated Development Environments (IDEs) used for different types of microcontrollers:

8-bit Microcontrollers:


·       Atmel Studio - for Atmel AVR microcontrollers

·       MPLAB X IDE - for Microchip PIC microcontrollers

·       CodeWarrior - for Freescale HC08 microcontrollers

·       Code Composer Studio - for TI MSP430 microcontrollers

·       Renesas HEW (High-performance Embedded Workshop) - for Renesas H8 microcontrollers

·       PSoC Designer - for Cypress PSoC 1 microcontrollers

·       Flash Magic - for NXP (formerly Philips) LPC900 microcontrollers


16-bit Microcontrollers:


·       MPLAB X IDE - for Microchip PIC24 microcontrollers

·       CodeWarrior - for Freescale HCS12 microcontrollers

·       Renesas HEW - for Renesas M16C microcontrollers.

·       Infineon DAVE - for Infineon C166 microcontrollers

·       Atmel Studio - for Atmel AVR XMEGA microcontrollers

·       Code Composer Studio - for TI MSP430X microcontrollers

·       STM32CubeIDE - for STMicroelectronics STM32 microcontrollers

32-bit Microcontrollers:


·       Atmel Studio - for Atmel SAM3X microcontrollers

·       MPLAB X IDE - for Microchip PIC32 microcontrollers

·       LPCXpresso IDE - for NXP LPC1700 series microcontrollers

·       Renesas e2 studio - for Renesas RX600 series microcontrollers

·       STM32CubeIDE - for STMicroelectronics STM32F series microcontrollers

·       Code Composer Studio - for TI Stellaris LM3S series microcontrollers

·       Kinetis Design Studio - for Freescale Kinetis microcontrollers

     Some IDEs may support multiple microcontroller architectures, and some may be specific to certain manufacturers or families of microcontrollers.

List of Integrated Development Environments (IDEs) that can support multiple microcontroller architectures:


·       Eclipse - Eclipse is an open-source IDE that can support a variety of microcontroller architectures through the use of plugins. For example, the Eclipse CDT (C/C++ Development Tools) plugin can be used with plugins such as GNU ARM Eclipse to support ARM-based microcontrollers, or the AVR Eclipse plugin to support Atmel AVR microcontrollers.


·       Visual Studio Code - Visual Studio Code is a popular open-source code editor that can support a variety of microcontroller architectures through the use of extensions. For example, the PlatformIO extension can be used to support a variety of microcontroller architectures, including AVR, PIC, STM32, and many others.


·       Keil ┬ÁVision IDE - The Keil ┬ÁVision IDE supports multiple microcontroller architectures, including ARM, Cortex-M, and Cortex-R microcontrollers from a variety of manufacturers, including STMicroelectronics, NXP, and Texas Instruments.


·       Code Composer Studio - Code Composer Studio is a proprietary IDE from Texas Instruments that can support multiple microcontroller architectures, including MSP430, C2000, and SimpleLink devices.


·       IAR Embedded Workbench - The IAR Embedded Workbench is a proprietary IDE that supports multiple microcontroller architectures, including ARM, AVR, MSP430, Renesas RX, and many others.


·       MPLAB X IDE - The MPLAB X IDE from Microchip supports multiple microcontroller architectures, including PIC, AVR, SAM, and many others.


Note that the specific microcontroller architectures and manufacturers supported by each IDE may vary, and some may require additional plugins or extensions to support certain microcontrollers. 

Contact sales@sysargus.com for any firmware requirements or visit www.sysargus.com


Friday 12 June 2020

Medtronics Open Ventilator PB 560 Project- Resources & File locations

As we know Medtronics (https://www.medtronic.com/) has made available one of its ventilators design. As we all know the complexity of the medical products this is an efforts to collect all the available information at one place and mention the things which are not clear or pending and if in the community anyone has done it come forward and paste it here so that I can update the link or solution here.

Below is the list of resources which are shared at various location, if any link is not working let me know.


FTP Site


Some of the things which are not found at this moment and not available to download is given below if anyone is able to successfully build it or have the data please share in comments:

  • C166 V7.05 Tool Chain
  • xC18 V3.10 Compiler
  • USB_Firmware_V3.1.bin File
  • Source Code For Power Pack2
  • CPU Board Test Software
  • Power Management Board Software
  • UUT Test Software
  • UUT Software download application

As per   https://community.cypress.com/thread/53866   we should get USB_Firmware_V3.1.bin from Medtronics , if anyone has default binary let us know. Also test softwares were not released by them but they have released some app as on today 12/06/2020, need to still review the same. Will keep updating the post. Let us know if anyone has any other links/document for the same ventilator project.

Sunday 3 February 2019

Common MTD commands : Boot EEPROM/ NAND flash access from Linux

Common MTD Commands use wisely

  •  cat /proc/mtd

dev:    size   erasesize  name
mtd0: 000c0000 00001000 "U-Boot"
mtd1: 00002000 00001000 "U-Boot Env"
mtd2: 00001000 00001000 "JFFS2"
mtd3: 0013d000 00001000 "my-data"
mtd4: 0013e000 00001000 "U-image/Kernel"
mtd5: 0013f000 00001000 "rootfs"
mtd6: 00140000 00001000 "mylog"
mtd7: 00141000 00001000 "mydata"

  •  mtdinfo -a
  • ls -l /dev/mtd*
  •  flash_unlock could be used to unlock the appropriate sectors.
  • flash_eraseall /dev/mtdchar0 
    •  cat /dev/mtdchar0 < new.bin  ( Erase and load new file)
  • cat /dev/mtdchar0 > /tmp/flash.bin ( Entire flash to file) 
  • flashcp to write to NOR flash
  • flash_eraseall -j /dev/mtd2
    mount -t jffs2 /dev/mtdblock2 /mnt/flash
  • flash_eraseall /dev/mtd0 ( erases everything, use rarely)
IOCTL Commands
  • MEMGETINFO Get layout and capabilities struct mtd_info_user *
  • MEMGETREGIONINFO struct region_info_user *
  • MEMWRITEOOB NAND only: write out-of-band info (ECC) struct mtd_oob_buf *
  • MEMERASE Erase flash blocks struct erase_info_user *
  • MEMLOCK Lock flash blocks to disallow changes struct erase_info_user *
  • MEMUNLOCK Unlock flash to allow changes struct erase_info_user *
  • MEMGETREGIONCOUNT Return number of erase block regions int *
  • MEMREADOOB NAND only: read out-of-band info (ECC) struct mtd_oob_buf *
  • MEMSETOOBSEL NAND only: set default OOB info struct nand_oobinfo*
  •  The exact flash layout may be determined using the MEMGETREGIONCOUNT and MEMGETREGIONINFO commands.
  • MEMERASE command may be issued to erase the desired blocks.

Difference between Raw Flashes (MTD) and Block Devices

Block Devices Examples 

  • SSD
  • MMC
  • eMMC
  • RS-MMC
  • SD
  • Mini/micro-SD
  • USB flash drive
  • CompactFlash
  • MemoryStick
  • MemoryStick Micro
  • Hard drives 

Ext2, ext3, XFS, JFS, FAT and conventional file systems work with block devices. 

  • Block devices consists of sectors.
  • Sectors are small (512, 1024 bytes)
  • Maintains operations: read sector and write sector
  • Bad sectors are re-mapped and hidden by hardware (at least in modern LBA hard drives);
  • Sectors are devoid of the wear-out property 
 Bad sector re-mapping and wear out in case of FTL devices, it is the responsibility of FTL to provide this.

MTD (Memory Technology Devices) Examples ( Used for Raw Flash devices)

  • NAND
  • OneNAND
  • NOR 
  • AG-AND
  • ECC'd NOR
  • CFI (Common Flash Interface)  
  • Bare NAND Flashes with SW/HW
  • Legacy FTL/NFTL "translation layers"
  •  M-Systems' DiskOnChip 2000 and Millennium chips
  •  PCMCIA flashes (pcmciamtd driver).

 MTD subsystem provides an abstraction layer for raw flash devices to make use of the same API when working with different flash types and technologies. Also to use conventional files systems over an MTD device, we need a software layer known as Flash Translation Layers (FTLs) which enables them to behave like a block devices.

MTD Characteristics & Features

  • Consists of eraseblocks
  • Eraseblocks are larger (typically 128KiB)
  • Maintains : read from eraseblockwrite to eraseblock, and erase eraseblock
  • Bad eraseblocks are not hidden and should be dealt with in software.
  • Eraseblocks wear-out and become bad and unusable after about 103 (for MLC NAND) - 105 (NOR, SLC NAND) erase cycles

MTD Subsystem interfaces:

  • MTD character devices - These character devices provide I/O access to the raw flash and referred as /dev/mtd0, /dev/mtd1 etc. They support a number of ioctl calls for getting information about MTD devices.
  • The sysfs interface - It provides full information about each MTD device in the system and is easily extensible.
  • The /proc/mtd proc file system- This is a legacy interface and provides general MTD information. 
During Electronic Product Design & Development it is essential that hardware is designed in a way that it uses proper flash types & accordingly partitions are made.

For More information :http://www.linux-mtd.infradead.org

IPv6 CVS access with IPv4 Linux PC

Convert or get IPv6 address over IPv4 using with versions above RHL7

 echo NETWORKING_IPV6=yes >> /etc/sysconfig/network
 echo IPV6_DEFAULTDEV=tun6to4 >> /etc/sysconfig/network
 echo IPV6INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-eth0
 echo IPV6TO4INIT=yes >> /etc/sysconfig/network-scripts/ifcfg-eth0
 /sbin/service network restart

Allow Firewall port 
Add rule to allow IP protocol #41 (IPv6 in IPv4) in and out.

GET IPv6 CVS Access over SSH 

          export CVS_RSH=`which ssh`
          cvs -d :ext:anoncvs@cvs.infradead.org:/home/cvs co mtd

Reference : http://www.linux-mtd.infradead.org/archive/index.html

Tuesday 2 October 2018

How many types of Embedded System jobs are available in embedded companies?

I have interviewed a lot of freshers and also acted as mentors for lot many. One of few general questions asked by new graduates are "How many types of Embedded System jobs are available in embedded companies" and the relevant skill sets required for it. Tried to capture some descriptions of job profiles. This post does not cover required skill set and will try to add in another blog post.

But as industry changes the description also changes drastically from company to company and domain to domain.

 This is prepared keeping general product and if you  think I have missed anyone, please add in comment. Also there could be one person doing multiple things in small startups or for every function different people are recruited.

Embedded products life-cycle job functions

1) Understand Market of the "New" product, analysis of competitors product & features  :

  • Product Manager / Product Line Manager
2)  Analysis of requirement from technical side/engineering side and prepare project plan :

  • Project Manager 

3) Hardware Engineering team :

  •  PCB Design Engineer
  •  PCB Layout Engineer
  •  Mechanical Design Engineer
  •  Circuit designer
  •  VLSI Design Engineers
  •  VLSI Verification team
  •  Chip designers (if semiconductor companies)
  •  FPGA Design Engineers
  •  PCB Assembly technicians
  •  Hardware QA & test engineer
  •  Procurement Engineer
  •  Purchase Executive

4) Software Engineering Team

  •   Firmware Design Engineer
  •   Device Driver development Engineer
  •   Application Software Engineer
  •   Unit test engineer
  •   Integration test engineer
  •   Automation Engineers       

5) QA test team

  •    Software testing engineer
  •    Hardware test engineers
  •    Performance test engineers
  •    Automation QA Engineers    
  •    Network support Engineers

6) Operation & Support team

  •    Purchase Officer
  •    Custom clearance Executive
  •    Finance Executive
  •    Accounts Executives
  •    IT network support Engineer
  •    HR executives
  •    Sales & Marketing Engineers
  •    Store & Inventory executive
  •    Technical writers ( Can report to any SW/HW teams or can be independent team)

For few job profile descriptions you can visit careers page of one of the embedded companies.

Saturday 23 June 2018

How to calculate target cost for electronic proudcts

Recently came across good blog on  how to calculate target cost for electronic products:

Image from www.sysargus.com



About Company:

Argus Embedded System is India’s leading company in providing electronic product design services for Industrial, Networking & Telecom and Defense domains.

Friday 27 October 2017


#HTTP Proxy/FTP Proxy

# export http_proxy=http://<proxy-server-ip-or-dns-name>:<Port-Number>

# export ftp_proxy=http://<proxy-server-ip-or-dns-name>:<Port-Number>

# vi /etc/bash.bashrc
export http_proxy=http://<proxy-server-ip-or-dns-name>:<Port-Number>/
export ftp_proxy=http://<proxy-server-ip-or-dns-name>:<Port-Number>/

# Proxy Settings in APT on Ubuntu Linux

# vi /etc/apt/apt.conf
Acquire::http::Proxy "http://<proxy-server-ip-or-dns-name>:<Port-Number>";


# export RSYNC_PROXY="http://<proxy-server-ip-or-dns-name>:<Port-Number>”

# For Git Clone 

#vi ~/.gitconfig
    proxy = http://username:password@<proxy-server-ip-or-dns-name>:<Port-Number>

#Yum Proxy setting

vi /etc/yum.conf


#DNF proxy setting

vi /etc/dnf/dnf.conf



vi ~/.curlrc

proxy = http://username:password@<proxy-server-ip-or-dns-name>:<Port-Number>

Sunday 22 October 2017

Proxy setting in Browsers - Internet Explorer, Firefox, Chrome

1) Internet Explorer 

2) Firefox

3) Chrome

Installation of Kernel from source file

Download the latest tar source files:


Copy the file to /usr/src location

  • tar -xvzf [file name]
  • cd /usr/src/
  •  make menuconfig\
Exit from the window and save the kernal

  • make bzImage
  • make
  • make modules
  • make modules_install
  • make install


 "make bzImage" command sometimes fails, install dependency libraries.

scripts/sign-file.c:23:30: fatal error: openssl/opensslv.h: No such file or directory
#include <openssl/opensslv.h>
compilation terminated.
make[1]: *** [scripts/sign-file] Error 1
make: *** [scripts] Error 2

yum install openssl / dnf install openssl

Install kernel headers and kernel developmental tool in Fedora

Give the uname -r and copy the kernel version and fedora version
   Ex. # uname -r

Copy "4.8.6-300.fc22.i686" and replace in the below command instead of 'uname -r'

dnf install kernel-headers- `uname -r` kernel-devel- `uname -r`

How to stop Kernel from assigning random Interface names

In order to ensure the the kernel uses the name assigned to it, below command can be used:

On Ubuntu

ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules

In Fedora:

ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

Reference: https://bbs.archlinux.org/viewtopic.php?id=162519

Change MAC address of Bluetooth Dongle

Download the tool 
  • Kernel should be 4.X or above versions.
  • Download bdaddr from below website:
  • bdaddrtar.bz2
  • tar xvf bdaddrtar.bz2
  • cd bdaddr 
  • make


  The "bdaddr" application is generated which can be used to change MAC address of dongle.

  1. Insert dongle and make interface up 

hciconfig -i hci0 up

      2./bdaddr ==> it will show current mac address
  root@bt:# ./bdaddr
Manufacturer: Cambridge Silicon Radio (10)
Device address: 00:50:F2:7E:2F:9B
      3.To change mac address give new MAC address as below
         root@bt# ./bdaddr -i hci0 00:01:E3:64:DD:9B
Manufacturer: Cambridge Silicon Radio (10)
Device address: 00:50:F2:7E:2F:9B
New BD address: 00:01:E3:64:DD:9B

Address changed - Reset device now

     4.Re -connect the dongle it should show new MAC address.

Note: If any dependency error install BlueZ, otherwise not required.

  •  Install BlueZ
  •  http://www.bluez.org/download/
  •  tar xf bluez-5.46.tar.xz 
  •  cd bluez-5.46 
  •  ./configure --enable-test
  •  make 


Loading a developmental kernel Snap

The command to load the kernel snap is :

#snap install Snapped 96boards-kernel_XXX_arm64.snap --dangerous

Once in a while there is error in loading the kernel, in that case below workaround can be used.

Get the name of  existing kernel snap

# snap list kernel-name

Back up the existing kernel

# cp /var/lib/snapd/snap/kernel-name-version1.snap ~/

Replace the developing kernel to current kernel snap.

# sudo cp <new kernel snap> /var/lib/snapd/snaps/kernel-name-version1.snap

Reboot the system and test it

# sudo reboot

If it doesnt boot up, restore the old snap.

# sudo cp kernel-name-version1.snap /var/lib/snapd/snaps/kernel-name-version1.snap

Installing Kernel header files in ubutntu

  1.  sudo apt-get install linux-headers-4.3.XX-generic
  2.  The header files will be installed in /lib/modules/4.3.XX-generic/build

Sunday 16 July 2017

How to open a cmd window in a specific location in windows 10 and windows 8?

  • Go to specific location.
  • Hold Shift key + right click on content space/ background of folder
  • Click on " Open command Windows here"

Monday 26 June 2017

Brief Explanation for UART RS232 SPI I2C

Reference : https://electronics.stackexchange.com/questions/37814/usart-uart-rs232-usb-spi-i2c-ttl-etc-what-are-all-of-these-and-how-do-th

Serial is an umbrella word for all that is "Time Division Multiplexed", to use an expensive term. It means that the data is sent spread over time, most often one single bit after another. All the protocols you're naming are serial protocols.

UART, for Universal Asynchronous Receiver Transmitter, is one of the most used serial protocols. It's almost as old as I am, and very simple. Most controllers have a hardware UART on board. It uses a single data line for transmitting and one for receiving data. Most often 8-bit data is transferred, as follows: 1 start bit(low level), 8 data bits and 1 stop bit(high level). The low level start bit and high level stop bit mean that there's always a high to low transition to start the communication. That's what describes UART. No voltage level, so you can have it at 3.3 V or 5 V, whichever your microcontroller uses. Note that the microcontrollers which want to communicate via UART have to agree on the transmission speed, the bit-rate, as they only have the start bit's falling edge to synchronize. That's called asynchronous communication.

For long distance communication (That doesn't have to be hundreds of meters) the 5 V UART is not very reliable, that's why it's converted to a higher voltage, typically +12 V for a "0" and -12 V for a "1". The data format remains the same. Then you have RS-232 (which you actually should call EIA-232, but nobody does.)

The timing dependency is one of the big drawbacks of UART, and the solution is USART, for Universal Synchronous/Asynchronous Receiver Transmitter. This can do UART, but also a synchronous protocol. In synchronous there's not only data, but also a clock transmitted. With each bit a clock pulse tells the receiver it should latch that bit. Synchronous protocols either need a higher bandwidth, like in the case of Manchester encoding, or an extra wire for the clock, like SPI and I2C.

SPI (Serial Peripheral Interface) is another very simple serial protocol. A master sends a clock signal, and upon each clock pulse it shifts one bit out to the slave, and one bit in, coming from the slave. Signal names are therefore SCK for clock, MOSI for Master Out Slave In, and MISO for Master In Slave Out. By using SS (Slave Select) signals the master can control more than 1 slave on the bus. There are two ways to connect multiple slave devices to one master, one is mentioned above i.e. using slave select, and other is daisy chaining, it uses fewer hardware pins (select lines), but software gets complicated.

I2C (Inter-Integrated Circuit, pronounced "I squared C") is also a synchronous protocol, and it's the first we see which has some "intelligence" in it; the other ones dumbly shifted bits in and out, and that was that. I2C uses only 2 wires, one for the clock (SCL) and one for the data (SDA). That means that master and slave send data over the same wire, again controlled by the master who creates the clock signal. I2C doesn't use separate Slave Selects to select a particular device, but has addressing. The first byte sent by the master holds a 7 bit address (so that you can use 127 devices on the bus) and a read/write bit, indicating whether the next byte(s) will also come from the master of should come from the slave. After each byte receiver must send a "0" to acknowledge the reception of the byte, which the master latches with a 9th clock pulse. If the master wants to write a byte the same process repeats: the master puts bit after bit on the bus and each time gives a clock pulse to signal that the data is ready to be read. If the master wants to receive data it only generates the clock pulses. The slave has to take care that the next bit is ready when the clock pulse is given. This protocol is patented by NXP(formerly Phillips), to save licensing cost, Atmel using the word TWI(2-wire interface) which exactly same as I2C, so any AVR device will not have I2C but it will have TWI.

Two or more signals on the same wire may cause conflicts, and you would have a problem if one device sends a "1" while the other sends a "0". Therefore the bus is wired-OR'd: two resistors pull the bus to a high level, and the devices only send low levels. If they want to send a high level they simply release the bus.

TTL (Transistor Transistor Logic) is not a protocol. It's an older technology for digital logic, but the name is often used to refer to the 5 V supply voltage, often incorrectly referring to what should be called UART.

Difference between USB and USB CDC and other USB standards

HID (Human Interface Device) generally requires no Drivers to be installed by the User
It is limited to 64 Bytes/ms (~64K/second) per endpoint used
It is guaranteed to get the timeslot because it uses INT transfers.

CDC (Comunication Device Class) requires drivers (INF file) to be installed and then simulates a serial port.It uses Bulk transfers so theoretically can have good bandwidth but is NOT guaranteed
There are also other code and packet overheads involved. USB CDC can work as UART.

Various USB standards

  • The USB 3.1 Specification released on July 26, 2013 and ECNs approved through February 15, 2017
  • USB 3.1 Appendix E:  Repeaters
  • USB 3.0 Adopters Agreement
  • On-The-Go and Embedded Host Supplement to the USB Revision 3.0 Specification Revision 1.1 as of May 10, 2012
  • Inter-Chip Supplement to the USB Revision 3.0 Specification, Revision 1.02 as of May 19, 2014
  • USB 3.1 Device Class Specification for Debug Devices as of July 14, 2015
  • USB Type-CTM Locking Connector Specification, March 9, 2016
  • USB Type-CTM Cable and Connector Specification Revision 1.2, March 25, 2016 and ECNs
  • USB Type-CTM Port Controller Interface Specification as of November, 2016
  • USB Power Delivery Specification Rev. 2.0, Version 1.3 is available at http://www.usb.org/developers/powerdelivery/
  • USB Power Delivery Specification Rev. 3.0, Version 1.1, January 12, 2017, and corresponding Adopters Agreement
  • USB Authentication Specification Rev. 1.0 with ECN and Errata through February 2, 2017

 There are 5 modes of USB data transfer, in order of increasing bandwidth: Low Speed (from 1.0), Full Speed (from 1.0), High Speed (from 2.0), SuperSpeed (from 3.0), and SuperSpeed+ (from 3.1); modes have differing hardware and cabling requirements. USB devices have some choice of implemented modes, and USB version is not a reliable statement of implemented modes. Modes are identified by their names and icons, and the specifications suggests that plugs and receptacles be colour-coded (SuperSpeed is identified by blue).

References : 
  •   WIki
  •   https://cscott.net/usb_dev/data/devclass/usbcdc11.pdf
  •   http://www.usb.org/developers/docs/
  • http://www.microchip.com/forums/m420851.aspx

Tuesday 13 December 2016

Netsh command to disable IPv4 Autoconfiguration in Windows 10/ Windows 8

  1. Open Windows command prompt in administrator mode.
  2. At the command prompt type: netsh winsock reset catalog and press [Enter].
  3. Next type: netsh int ip reset reset.log and press [Enter].
  4. Restart your PC for the changes to take effect.

Wednesday 18 May 2016

PERL example for opening EXCEL sheet using WIN32:OLE

# This PERL file will open one EXCEL, create 4 WORK Sheets, in first
# WORKSheet make table with borders and few values

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;                                # die on errors...
my $Excelfile = Win32::OLE->GetActiveObject('Excel.Application')
                || Win32::OLE->new('Excel.Application', 'Quit'); 
$Excelfile->{DisplayAlerts} = 0;
$Excelfile->{ScreenUpdating} = 0;

$workbook = $Excelfile->Workbooks->Add();

for ($j=1;$j<=4;$j++)
    $worksheet = $workbook->WorkSheets->Add({after => $workbook->WorkSheets($workbook->WorkSheets->{COUNT})});
my $cur_dir = `cd`;
$TargetFile = $cur_dir."\\Excel_Test_File.xls";
print "Result file name is $TargetFile \n";

#Select first sheet and write values


$current_row = 3;
$current_col = 2;

#for ($k=0;$k<3;$k++)
#    $worksheet->Cells($current_row,$current_col)->Font->{FontStyle}="Bold";
#    $worksheet->Cells($current_row,$current_col)->Interior->{ColorIndex} =24;
#    $worksheet->Columns($current_col)->{ColumnWidth}=20;
#    $current_col++;

### Another way of formatting if we are using fixed columns

$worksheet->Range("B$current_row:D$current_row")->Interior->{ColorIndex} =24;
$worksheet ->Range("B$current_row:D$current_row") ->{ColumnWidth} = 20;

$worksheet->Cells($current_row, $current_col)->{'Value'} = "S.No";
$worksheet->Cells($current_row, $current_col+1)->{'Value'} = "Name";
$worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Department";
$worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Work_type";


for ($i=1;$i<=10 ;$i++) {

    $worksheet->Cells($current_row, $current_col)->{'Value'} =$i;
    $worksheet->Cells($current_row, $current_col+1)->{'Value'} = "Name_".$i;
    $worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Colour";

    #### Keep border for excel if it is last line.

    $worksheet->Range("B$start_row_forborder:D$last_row")->{HorizontalAlignment} = xlHAlignRight;
    $worksheet->Range("B$start_row_forborder:D$last_row")->{Borders}->{Weight} = xlThin;

#Deleting Default SHEETS
$worksheet = $workbook->Worksheets("Sheet1")->Delete();
$worksheet = $workbook->Worksheets("Sheet2")->Delete();
$worksheet = $workbook->Worksheets("Sheet3")->Delete();