Followers

Powered by Blogger.
Thursday, March 26, 2009

How to Install GCC (c/c++) Compiler in Ubuntu Linux

Install package called build-essential is the best way

build-essential contains a list of packages which are essential for building Ubuntu packages including gcc compiler, make and other required tools.


$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
$ gcc -v
$ make -v

Now, you should able to compile software using C / C++ compilers.
Wednesday, March 25, 2009

Install More Than 4Gb Memory in 32 bit Ubuntu - How to Install PAE ( Physical Address Extension)

If You Install More than 4 GB Memory in your 32bit ubuntu Machine It will not access the memory beyond 4GB.The x86 architecture presently uses only 36 bits out of 52 bits possible. On x86-64 processors, PAE is obligatory in native long mode; currently 40 bits are used out of 52 bits possible. How do I find out if my Linux kernel supports 36-bit or more physical addressing?

$ sudo grep physical /proc/cpuinfo

shows

physical id : 0
address sizes : 36 bits physical, 48 bits virtual .........


$ free -m will show only <>$ sudo apt-get update
$ sudo sudo apt-get install linux-headers-server linux-image-server linux-server
Once kernel images installed, just reboot your machine ,

$ sudo reboot
After reboot, login into your system and type the following command to verify memory usage:
$ free -m

Friday, March 20, 2009

Microchip PIC18 Family Video Tutorial


The PIC18 family utilizes a 16-bit program word architecture and incorporates an advanced RISC architecture with 32 level-deep stack, 8x8 hardware multiplier, and multiple internal and external interrupts. With the highest performance in Microchip’s 8-bit family, the PIC18 family provides up to 16 MIPS and linear memory. PIC18 is the most popular architecture for new 8-bit designs where customers want to program in C. Choose from over 150 PIC18 products supporting both 3V and 5V applications with packages ranging from 18 to 100 pins. Integration is key on the PIC18 devices, with support for connectivity and human interface peripherals including: USB, Ethernet, touch sensing, LCD display drivers – all with free supporting software and application notes to help you get to market faster.

See a Video Tutorial about PIC 18 Family here http://www.youtube.com/watch?v=iC3BTlfFHM4
Tuesday, March 17, 2009

Scrolling LCD Display in CCS C




Most popular 2 x 16 LCD Display HD44780 chipset have a display memory up to 40 charactors.
]
Only 16 can display on a line. See the program for display the screen to the left or right shift operation .


#include <16f877.h>
#fuses XT,NOWDT,PUT,NOPROTECT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#include "lcd.c"

void forword_dir(void)
{
lcd_send_byte(0, 0X18);
}

void backword_dir(void)
{
lcd_send_byte(0, 0X1E);
}
void main() {
int a,i;

lcd_init(); //lcd initialize
lcd_putc("\f"); //lcd clear
// lcd memory can hold up to 40 characters
lcd_putc(" http:// shibuvarkala . blogspot . com");

for(;;){
for(i = 0; i <>
{
backword_dir();
delay_ms(50); // scroll delay
}

for(i = 0; i <>
{
forword_dir();
delay_ms(50);
}
}
}


Tuesday, March 10, 2009

How to Access Linux Partition from Windows : Linux Reader


How to get safe and quick access to Linux file systems? DiskInternals Linux Reader is a new tool for do this. This program act as a bridge between MS Windows and Ext2/Ext3 Linux file systems. This easy-to-use tool runs under Windows and allows you to browse Ext2/Ext3 Linux file systems and extract files from there. Linux Reader is absolutely free. Download it Here
Sunday, March 8, 2009

CCS C Tutorial : Basic Data Types of CCS C

Monday, March 2, 2009

How to Make Password Protected Encrypted Text Files Using vi Editor

You can make encrypted text file with Password Using Famous Text Editor vi.

For Making an encrypted file , Use vi -x filename to edit a new file. Then vi will prompts you to set a password, after that it will encrypts the contents of the file. Whenever you access this file, vi will ask for the correct password.
Sunday, March 1, 2009

How to set PORTA as Digital I/O Port in PIC16F877A

If you want to set PORTA of PIC16F877/877A/874, You have to use some extra register configurations with ADCON1 and COMCON registers .

COMCON=0x07 disables the comparators
ADCON1 = 0x06 makes all the pins of PORTA as Digital I/O by default it is Analog .

Example
void main (){

ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
TRISA = 0x00 ;

while(1)
{
PORTA = 0XFF ;
Delay_ms(500) ;
PORTA = 0X00 ;
Delay_ms(500) ;
}
}

You need a special care in the case of PORTA4 (RA4), it is Vref to the comparator . A pull up resister is need to wok it. So read details of PORTA before using RA4.
Sunday, February 22, 2009

How to use ROM for storing DATA in MikroC Avoid Error Not Enough RAM and Strings problem (const truncated)

Most of the Microcontrolleres having limited RAM, For Avoiding the Errors Not Enough RAM and Strings problem (const truncated) .
You have to move the strings to ROM (FLASH program) memory, and there by save RAM.

In MikroC
if the string is declared as constant - compiler will move it to ROM
This is the way in which const truncated problem can be solved if
great number of strings was used that was located in RAM.

How we can impliment it in MikroC, see the example

First you declare the following

char text[15]; // this is stored in RAM
const char *mesg1="shibuvarkala1234"; // this is stored in ROM
const char *mesg2="CE Attingal"; // this is stored in ROM

here is the function for copying string before the usage ,
copy the following function to your code( Received from Mikroelecronica) :

// --- Copying strings from ROM to RAM
void strConstCpy(char *dest, const char *source) {
while(*source)
*dest++ = *source++ ;

*dest = 0 ;
}

you have to use the above function to access the strings stored in ROM,

strConstCpy(text,mesg1);
LCD_Out(1,1,text); // Now output is shibuvarkala1234

strConstCpy(text,mesg2);
LCD_Out(1,1,text); // Now output is CE Attingal
Tuesday, February 10, 2009

Pulse Width Modulation or PWM Tutorial using PIC 16F877, Proteus and Mikroc PART-2

Now lets see how to write a code for controlling PWM Module of a PIC Micro Controller using the Mikroc compiler.
MikroC provides a very simple PWM library with 4 functions shown below
  • Pwm_Init
  • Pwm_Change_Duty
  • Pwm_Start
  • Pwm_Stop
The pwm_init used for initializing PWM which takes a arguement of frequency in hertz

To Initialize a PWM module at 2KHz do this :Pwm_Init(2000);

Pwm_Start and Pwm_Stop are used for starting and stopping PWM .

Pwm_Change_Duty Changes PWM duty ratio. Parameter duty takes values from 0 to 255. It can be calculate using equation (Percent*255)/100. See 0 is 0%, 127 is 50%, and 255 is 100% duty ratio.

Take a look at the following simple program

// microcontroller : P16F877A
// PWM module is set on RC2 Pin No 17.

unsigned short i;

void main() {
PORTC = 00; // Set PORTC to $FF
TRISC = 0; // PORTC is output
Pwm_Init(5000); // Initialize PWM module

Pwm_Start(); // Start PWM

while (1) { // Endless loop
for(i=0;i<=255;i++)

{ Pwm1_Change_Duty(i);

delay_ms(10); }

} }


This program creates a pwm on pin17 of PIC16F877A .Hope you found this tutorial useful .If you have any doubts about the program .Leave a comment . click to enlarge figure. set CRO channel A Volts to 1 V and time/div to 50us

Download DSN for Proteus

Pulse Width Modulation or PWM Tutorial using PIC 16F877, Proteus and Mikroc PART-1



Pulse width Modulation or PWM is one of the powerful techniques used in todays control systems.
It is used for speed control of motors, used for measurement , communication and power control.

Pulse-width Modulation is achieved with the help of a squarewave whose duty cycle (ON time vs OFF time) is changed to get a varying voltage output as a result of average value of waveform. See Picture

Consider a square wave shown in the figure above.

TON is the time for which the output is high and ToFF is time for which output is low. Let Ttotal be time period of the wave such that, Ttotal = TON +ToFF

Duty cycle of a squarewave is defined as
D = TON / (TON+ToFF)= TON/Ttotal

See output voltage varies with duty cycle

VOUT = D x VIN

VOUT = (TON/Ttotal) x VIN

we see from the final equation the output voltage can be directly varied by varying the TON value.

If TON is Zero , VOUT is also Zero.
Friday, February 6, 2009

How to Read and Write Data into EEPROM using MikroC

This is an Example program for Demonstrating read and write Data into EEPROM of a PIC Microcontroller (Pic16F877A have 256 Bytes EEPROM),This program first writes 0xAA into the address 0x00 and the reads and displays it in PORTB . You don't need external EEPROM for storing small user datas.

Mikroc Having a EEPROM library .There are only two functions in this library
  • Eeprom_Read
  • Eeprom_Write

First function Eeprom_Read returns an integer value from the specified address. The following is the syntax .

unsigned short Eeprom_Read(unsigned int address);

Second Function Eeprom_Write takes two parameters address and data .

See syntax given below .

void Eeprom_Write(unsigned int address, unsigned short data);

See the Example program

unsigned short data = 0xAA, address=0x00;

void main() {
PORTB = 0x00;
TRISB = 0x00;

//writes 0xAA into the location 0x00
EEprom_Write(address,data);

//insert 20 or 30 ms delay between every read and write cycle
Delay_ms(20);

// the following delay is just for making a feel
Delay_ms(1000);


//reads the data from 0x00 and send it to PORTB

PORTB = Eeprom_Read(address);
Delay_ms(1000);
}
Thursday, February 5, 2009

Digital Clock using PIC16F877A and DS1307 RTC Code in MikroC

This picture shows the Circuit Simulated in Proteus



MikroC Code for RTC DS1307 and PIC16F877A in Mikroc here
http://rapidshare.com/files/194319667/ds1307_Mikroc_shibu.c.html
Monday, February 2, 2009

OBAMA's Blackberry - Secure Wireless Phone and PDA


More Details here Click on picture for enlarge

About Me