Google

Jul 31, 2008

where can you find robotics resources in Hyderabad

Microcontroller, microprocessor sensor and other chips and IC's


Are you looking for the microcontroller , microprocessor or any other chips like sensors in Hyderabad. and do you want to now where you can get them in Hyderabad.

The biggest electronics chips market in Andhra Pradesh is located in koti gujarati gulli
here you can get all the electronic items with almost everything from spare parts to basic circuits to CRTs.

These are the two shops which are famous in the market for the IC and stepper motors
1) Ictronics
2) Roland electronics

Roland fellow is little arrogant and charges more i suggest you go for ictronics or other shop

RC motors and balsa wood in Hyderabad

If some one is working for the shaastra robotics projects or fire n IC then gujarathi gulli is the place that you should't miss to go. for fast motors or rc motors with high speed and torqe like the once used in rc aero planes or small steamer RC boats.

they are available to buy for some shop in secendrabed near patny center. i don't exactly remember the name of the shop but if you what to know it just comment it here i will let you know the price range of these motors starts for 2000 to 20.000 this guy will also sell balsa wood for Rs 100 each frame which of the size of a fan blade

To get complete details about these shops address or telephone no's or if you want to talk to the shop guy directly for free then call to google hyderabad call center this they will help you.
this is the tool free No 1800 41 99 99 99


if you are looking for some thing in hyderabad regarding any project kits or electronics items or motors or printed circuit boards.

that just comment here your problem I will be glad to help you.


You might be also interested in:
:: Assembly Language Programs for Multiplication and Division
:: Assembly Language Programs on array of Hexadecimal numbers
:: Assembly Language Programs on strings

Jul 28, 2008

Interfacing Multimedia card with ATMega 128

I am interfacing Multimedia card with ATMega 128 through SPI protocol. For that while reading data from Multimedia Card, I use to send dummy bytes through MOSI and receive data through MISO in SPDR.
hears some routine. Take a Look on them

void SPI_init(void)

{

DDRB |= (1 << SPICS); // 0 set port B SPI chip select to output

DDRB |= (1 << SPICLK); // 1 set port B SPI clock to output

DDRB |= (1 << SPIDO); // 2 set port B SPI data out to output

DDRB &= ~(1 << SPIDI); // 3 set port B SPI data input to input

SPCR = (1 << SPE) | (1 << MSTR); //pg#168(391)

SPICS_ON();

}





char Command(char befF, int AdrH, int AdrL, char CRC )

{ // sends a command to the MMC

SPI(0xFF);

SPI(befF);

SPI((AdrH >> 8));

SPI(AdrH);

SPI((AdrL >> 8));

SPI(AdrL);

SPI(CRC);

SPI(0xFF);

return SPI(0xFF); // return the last received character

}



unsigned char SPI(unsigned char mydata)//transmit through SPI data out
line(MOSI)

{

//unsigned char Rx_SPDR=0xDC, Rx;

SPDR = mydata; //1 Byte data

while(!(SPSR & (1<<SPIF))) // wait for complete transmission

;

//printf("\r\nRx_SPDR = 0x%X", Rx_SPDR);

//Rx=SPDR;

//printf("\r\nRx_SPDR = 0x%X", Rx_SPDR);

return SPDR; //return the received value of SPDR

}





int Read_from_MMC(void) { // send 512 bytes from the MMC via the serial port

int i;

// 512 byte-read-mode

if (Command(0x51,0,512,0xFF) != 0)

{

printf("MMC: read error 1 ");

return 0;

}

// wait for 0xFE - start of any transmission

// ATT: typecast (char)0xFE is a must!

while(SPI(0xFF) != (char)0xFE);



for(i=0; i < 512; i++)

{

while(!(UCSR0A & (1 << UDRE0))); // wait for serial port

/*Here we are transmitting 0xFF through MOSI and then assigning the received
character to USART Data Register*/

UDR0 = SPI(0xFF); // send character

}





// at the end, send 2 dummy bytes

SPI(0xFF); // actually this returns the CRC/checksum byte

SPI(0xFF);

return 1;

}

You might be also interested in:

:: Assembly Language Programs for Multiplication and Division
:: Assembly Language Programs on array of Hexadecimal numbers
:: Assembly Language Programs on strings




Jul 26, 2008

A C program for serial communation with pc using 8051

This program will read a complete line coming through my COM port in 8051.


This is the subroutine or function in c for accept line from serial port
void get_line(void)
{
char c, index=0;

while(c = getchar() != '\n')
{
buffer[index++] = c;
}
}


The main program
void main()
{
PCON = 0x80; // Double Baud Rate
SCON = 0x50; // SCON: mode 1, 8-bit UART, enable rcvr
TMOD |= 0x20; // TMOD: timer 1, mode 2, 8-bit reload
TH1 = BAUD_CONST; // TH1: reload value for desired baud. Calculate this for your crystal frequency
TR1 = 1; // TR1: timer 1 run
TI = 1;
RI = 0;

get_line(); //function call

}

You might be also interested in:

:: options available for int 21h instruction
:: Answers of Microprocessor(8085) & Electronics FAQ
:: The 8085 Microprocessor Architecture Microprocessors & Interfacing

Jul 23, 2008

Interfacing stepper motor with pic microcontrollers

Here I am not going to discuss completely about how to interface the stepper motor to the pic microcontrollers but will be talking about the what IC is to be used for interfacing the stepper motor to the pic microcontrollers

ULN2003

There are plenty of stepper motor drivers out there in the market. All you need to do is run a google search or ask around. The problem is that the PIC MicroC can not sink or source more than 25mA of current if I remember correctly. Whereas your stepper motor windings would draw a lot more current.

Also, the inductive windings will create a back EMF when the winding is turned off, this large current will also damage the PIC. The ULN 2003 is a "Driver" IC which simply accepts a logic state from the PIC and routes the necessary amount of current to the stepper windings. It also prevents the winding back EMF from affecting the PIC, in a sense isolating the pic from the large inductive load of the SM winding.

I'm not saying ULN is the best solution, it's a possibility. there are drivers available specifically for stepper motor control. You can control direction as well as control if the movement will be a full-step or half-step.

You might be also interested in:

:: assembly program to find out the largest number from an unordered array
:: Program to find out the number of even and odd numbers from a given series
:: assembly Program to create , write and close file

Jul 22, 2008

8086 program to find GCD of two 2 numbers

Euclid (a Greek mathematicians and philosopher of about 300 BC) describes this algorithm in Propositions 1 and 2 of Book 7 of The Elements, although it was probably known to the Babylonian and Egyptian mathematicians of 3000-4000 BC also.
If we try it with an two numbers, the final non-zero remainder is the greatest number that is an exact divisor of both our original numbers (the greatest common divisor)


Here is the program


mov ax,4000h
mov ds,ax
mov si,0000h
mov al,num1 ;num1 is first no.
mov cl,num2 ;num2 is second no.
mov ah,00h
cmp al,cl
ja next
xchg al,cl
next: mov bl,cl
div cl
cmp ah,00h
je down
mov al,cl
mov cl,ah
mov ah,00h
jmp next
down mov result,bl ;result is the mem.loc.
;where gcd is to be stored
hlt

You might be also interested in:

:: options available for int 21h instruction
:: Answers of Microprocessor(8085) & Electronics FAQ
:: The 8085 Microprocessor Architecture Microprocessors & Interfacing

Jul 20, 2008

speed control of DC motor using pic microcontroller

this is the program for speed control of DC motor using 89c51 microcontroller

code !



$mod51

;***************************************************************************

;* LED PWM 2 *

;* Amateur World *

;***************************************************************************

; R7 is used to hold a value between 0 and 255 which will correspond to a
brightness

; level for the LED. Timer 0 will be used to create the Pulse Width Modulated
output.

; Timers are generally used to repeatedly measure the same fixed interval of
time.

; In this case we want to measure 2 periods of time. The high output period and
the

; low output period.

;**************************************************************************

; RESET ;reset routine

ORG 0H ;locate routine at 00H

AJMP START ;jump to START

;**************************************************************************

; INTERRUPTS (not used) ;place interrupt routines at appropriate

;memory locations

ORG 03H ;external interrupt 0

RETI

ORG 0BH ;timer 0 interrupt

AJMP TIMER_0_INTERRUPT ; go to interrupt routine (can be anywhere we want)

; since a jump does not return to this point we do not

; need a Return command

ORG 13H ;external interrupt 1

RETI

ORG 1BH ;timer 1 interrupt

RETI

ORG 23H ;serial port interrupt

RETI

ORG 25H ;locate beginning of rest of program

;**************************************************************************

INITIALIZE: ; set up control registers

MOV TMOD,#00H ; set timer 0 to Mode 0 (8 bit Timer with 5 bit prescalar)

SETB TR0 ; turn on timer 0


MOV PSW,#00H

SETB EA ; Enable Interrupts (each individual interrupt must also be enabled)

SETB ET0 ; Enable Timer 0 Interrupt

RET

;**************************************************************************

; Real code starts below.

;*************************************************************************

; The LED is off during the high section and on during the low section of each
cycle

; The Flag F0 is used to remember whether we are timing tlow or thigh.



TIMER_0_INTERRUPT:



JB F0, HIGH_DONE ; If F0 is set then we just finished the high section of the

LOW_DONE: ; cycle so Jump to HIGH_DONE

SETB F0 ; Make F0=1 to indicate start of high section

SETB P1.0 ; Turn off LED

MOV TH0, R7 ; Load high byte of timer with R7 (our pulse width control value)

CLR TF0 ; Clear the Timer 0 interrupt flag

RETI ; Return from Interrupt to where the program came from

HIGH_DONE:

CLR F0 ; Make F0=0 to indicate start of low section

CLR P1.0 ; Turn on LED

MOV A, #0FFH ; Move FFH (255) to A

CLR C ; Clear C (the carry bit) so it does not affect the subtraction

SUBB A, R7 ; Subtract R7 from A. A = 255 - R7.

MOV TH0, A ; so the value loaded into TH0 + R7 = 255

CLR TF0 ; Clear the Timer 0 interrupt flag

RETI ; Return from Interrupt to where the program came from

;**************************************************************************

START: ;main program (on power up, program starts at this point)

ACALL INITIALIZE ;set up control registers

MOV R7, #00H ; set pulse width control to dim

TEST: LCALL TIMER

INC R7 ;FROM HERE TO TEST IS THE TRICK TO VARY R7 AS WELL AS

;THE INTENSITY OF LED

CJNE R7,#0FFH,TEST

TEST1


TEST1: LCALL TIMER

DEC R7

CJNE R7,#00H,TEST1

LCALL TEST

;go to LOOP(always jump back to point labeled LOOP)



TIMER: push 00h

push 01h

push 02h ;store the internal location 00h,01h,02h contents

mov 02h,#03h

USER_L2:

mov 01h,#0ffh

USER_L1:

mov 00h,#0ffh

DJNZ 00h,$;decreament the internal location 00h

;content repeat until it becomes 0

DJNZ 01h,USER_L1 ;""""""



DJNZ 02h,USER_L2 ;""""""





pop 02h

pop 01h

pop 00h

RET

END ;end program

You might be also interested in:

:: Traffic light control system using 8086
:: Assembly Language Program to serve NMI
:: Interfacing Stepper Motor to 8086 using 8255



Jul 18, 2008

Edge triggeringin PIC16F877A

i am using the following program for edge triggering. i am using PIC16f877a Controller.

i put one key for the external interrupt.And using RB0/INT pin for the edge triggering concept.and i connected one led on porta to see the output.

i am using the HITECH c compiler

#include<pic.h>

#include<stdio.h>



#define ldata PORTD

#define RS RC4

#define RW RC5

#define EN RC6



unsigned int d;



void Init_Int(void);

void cmd(unsigned char);

void cardiac_lcd(unsigned int);

void Msdelay(unsigned int);

void convert_disp(unsigned char);





void Msdelay(unsigned int time)

{

unsigned int i,j;

for(i=0;i<time;i++)

for(j=0;j<1275;j++);

}



void Lcd_disp()

{

cmd(0x38);

Msdelay(5);

cmd(0x0e);

Msdelay(5);

cmd(0x01);

Msdelay(5);

cmd(0x80);

Msdelay(5);

}

void cardiac_lcd(unsigned int value1)

{

ldata=value1;

RS=1;

RW=0;

EN=1;

Msdelay(1);

EN=0;

}



void cmd(unsigned char value)

{

ldata=value;

RS=0;

RW=0;

EN=1;

Msdelay(1);

EN=0;

// return;

}



void convert_disp(unsigned char val)

{

unsigned int b,c;

b=val/10;

c=val%10;

d=b|0x30;

}



void Init_Int()

{

RP0=1;

INTEDG=1;

// RPBU=1;

RP0=0;

GIE=1;

INTE=1;

}

void interrupt intr_tc()

{

unsigned int a=0;

if(INTF==1)

a=a++;

// if(a>10)

{

// convert_disp(a);

RA1=1;

}

INTF=0;

}

void main()

{

PORTA=0x00;

TRISA=0x00;

PORTB=0x00;

TRISB=0xff;

PORTC=0x00;

TRISC=0x00;

PORTD=0x00;

TRISD=0x00;

Lcd_disp();

Init_Int();

cardiac_lcd(d);

while(1)

{

//cardiac_lcd(d);

//RA1=0;

}

}




if cant able to bring the no of counts in LCD display.and led is blinking then do the following
for the lcd line initialization (0x38) takes more time , so that it would be better to pass 0x38 three times. i had only checked that much and also increase the delay time

You might be also interested in:

:: Traffic light control system using 8086
:: Assembly Language Program to serve NMI
:: Interfacing Stepper Motor to 8086 using 8255

Jul 14, 2008

8051, FREESCALE, PIC, AVR. which is better ?

I am presently working on developing applications using 8051 and freescale 8 bit microcontrollers.

I wanted to know. in what terms terms the 8-bit series of microncontrollers namely. 8051, PIC, FREESCALE, AVR. are better from each other and why?

Actually now I have to learn PIC for the rest of the projects that i have two accomplish.


rishi says:
8051 ---- for learning n getting started in embedded systems

PIC ---- reach peripheral set and tremendous resources at every level

AVR ---- user friendly mainly for hobbyist

freescale ---- used in industry.

see PIC,AVR, FREESCALE all are used equally.the difference lies just in the application where they are used.

8051 is not used in industry.its modern derivative are used where they r almost equivalent 2 pic n avr in features like u can check high performance 8051 from silicon labs.i use them n they r monsters really.

anudeep says :
it isnt like that. many products till this date use 8051
example
(1)the coin box phones use atmel's 8052 at89c52 series. at least the 1se used
in india
(2)many mp3 players use 8051. where quality isnt an issue ie fr industrial purposes.if u want quality go fr vs2001(arm7 core)
(3)8051 is still used in card readers(sd,mmc and stuff----yes....there are ranges
from atmel)
(4)8051 is used fr protocol convectors ie usb to serial convectors,etc.
so it depends on the application frankly.

pic,avr,arm are equally important. cause at the end of the day.when you design a product the 2 most important things in your mind should be cost and quality.
so we have to choose the controllers accordingly.


You might be also interested in:

:: Assembly Language Programs on strings
:: Assembly Language Programs to compute an expression
:: Interfacing Analog-to-Digital converter to 8086 using 8255

Three phase latching relay programming for pic microcontroller 16f873a

I m using pic16f873a microcontroller and ICD2 Debugger cum programmer

I will give you brief introduction about my application.I need to toggle the relay on and off continuously.During on condition i need to check the continuity of relay contacts.For that i gave +5v supply to the relay contacts.output of this contact is given to microcontroller 25th pin.If the relay contact is working i will increase the relay test count and this count should written into the EEPROM.I f relay contact is not working micrcontroller should wait until the contact works.


TEST BSF PORTB,2 ;Set Turn off Relay
CALL DELAY
BCF PORTB,2 ;Clear Turn off Rly
CALL DELAY
CALL DELAY
CALL DELAY
CLRF PORTB
BSF PORTB,1 ;Set Turn on Rly
CALL DELAY
BCF PORTB,1 ;Clear Turn on Rly
CALL DELAY
CALL DELAY
CALL DELAY
MOVF PORTB,W
MOVWF CTAT_STATUS
BTFSS CTAT_STATUS,4
GOTO $-3
MOVLW 01H
MOVWF DATA_EE_ADDR
CALL READ
MOVWF DATA_TCNTL
MOVLW 00H
MOVWF DATA_EE_ADDR
CALL READ
MOVWF DATA_TCNTH
INCFSZ DATA_TCNTL,1
GOTO STORE
INCFSZ DATA_TCNTH,1
GOTO STORE
STORE MOVF DATA_TCNTL,W
MOVWF DATA_EE_DATA
MOVLW 01H
MOVWF DATA_EE_ADDR
CALL WRITE
MOVF DATA_TCNTH,W
MOVWF DATA_EE_DATA
MOVLW 00H
MOVWF DATA_EE_ADDR
CALL WRITE
GOTO TEST



if the code do not work on the application then follow the instructions
connect ground to relay contact and check for 0 in program also have a pull up for microcontrolloer pin.
for current program go for pull down resistor.
that should solve your problem.

You might be also interested in:

:: MASM 611 SOFTWARE
:: bit reversal and sorting programs
:: Find Square Root of a hexadecimal number in assembly language
:: common intreview questions on 8086

Migrating from 8051 to ARM

So as long as the 8051 is powerful enough for your needs than you shouldn't move. But if you feels like you needs a change you should move to ARM based architectures for a number of reasons:

  • They are dropping RAPIDLY in price
  • They are FULLY 32-bit cores, 8-bit MCU's just don't cut it some times. For example my DVD player from 2002 has an 8052 MCU embedded in it as a front end (remote control reading, On Screen Display etc.). But newer DVD players from what I've been seeing are either using proprietary cores or ARM based cores.
  • Also budget wireless chipsets and routers use ARM7 and ARM9 chips (probably to do the WEP/WPA encryption). Well I do know the wifi chipset in the PSP uses an ARM9 based CPU.
  • Supported by freeware GNU compilers (GCC for example), makes development rather painless and if you want to code in assembly (GNU assembler really sucks ) then you get free assembler.
  • Tons of very cheap devkits available (that operated close to 60Mhz, a 60Mhz ARM is a very powerful chip, definitely could do MP3 decoding)
  • And of course, the iPod Nano ( and probably all iPod's) uses ARM as a main CPU.
  • The ARM is rapidly gaining ground and with their price going downwards each year, they will soon replace most 8-bit in anything but mundane tasks.

Generally when it comes to MCU's:

PIC - Only use for mundane tasks (keyboard reading, image scanning, etc.) because the single cycle architecture makes this stuff easier.

8051 - Use for more complicated tasks, still a bit limited because of the limited stack space. Handles complicated tasks much more elegantly than PIC.

ARM7/9 - Use for complicated tasks that require a lot of code (Video players, MP3 players, etc.). Handles complicated tasks very elegantly and efficiently. Better tuned for embedded C programming.

Of course I skipped many other great MCU architectures but if you are interested you can find some better ones.


You might be also interested in:


:: MASM 611 SOFTWARE
:: bit reversal and sorting programs
:: Find Square Root of a hexadecimal number in assembly language
:: common intreview questions on 8086

Jul 10, 2008

trouble with my isp for ATmega16L

i built my own stk 200 isp dongle and tried to program the ATmega16 using pony prog.i'm getting a device not recognized error. i have checked all the connections and nothing seems to be wrong.i have supplied power to the device and used a 8Mhz crystal. could anyone tell me what is wrong.

troubleshooting steps

  • check your connections properly and the connections to printer port
  • select the correct printer port, LPT1, LPT2 or LPT3
  • You may use chipblaster AVR from HP infotech and select programmer as kanda systems/stk200 available in the programmer select menu.
  • provide 5 v power supply and check the voltages.

also the 8Mhz crystal you used won't work because the chip is initially set at 1Mhz factory settings.so even if you connect 8Mhz crystal it will work at its default 1Mhz.To use the 8Mhz crystal you have to program the fuse bits properly. you can find about crystal select options and fuse bits in the datasheet of the relevant chip.also be careful with fuse bits . if you program them incorrectly it will get locked and you will not be able to read or write your chip.

These are few reasons why homemade ISP can fail :

- Length of wire greater than 50 cm (some times it works on as much as 1m length and more, but it HAS TO WORK with 50 cm wire length)

- forgetting to connect ckt GND to parallel/serial port GND

- forgettin to short certain pins of parallel port/serial port

You might be also interested in:


:: Assembly Language Programs on strings
:: Assembly Language Programs to compute an expression
:: Interfacing Analog-to-Digital converter to 8086 using 8255

Jul 7, 2008

why there are two ( 2 ) power supplies for PIC microcontrollers

Why do we need two power supplies and two ground pins for PIC ?

For eg, in PIC16F877A, Pins 11 and 32 must be connected to +5V, and 12 and 33 to ground...
But why do we need 2 of them ???

My lecturer told me something about Ground bouncing, etc. caused because of some conditions, when many pins are grounded at the same time...and due to some EMI effects caused because of the self inductance of the pins.


ANSWER:

On some devices there are separate power supply pin called AVDD & AVSS. It is used for the Analog to Digital Conversions,where AVDD & some times AVSS to be connected to a precise voltage source. But on some devices if this feature is not available, to maintain same pin configurations of the family it is to be used just as VDD & VSS.

You might be also interested in:

:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086
:: Traffic light control system using 8086

Jul 6, 2008

AVR Interrupt in C

AVR programming in C interrupts

hey...most of you guys must have tried AVR interrupts in C.. I am trying to use UART receiver interrupt. I am using WinAVR.. I am including my code below, it looks it is branching to RESET.

the program is done by: niyaz zubair



int main(void)

{

unsigned char t1,t2;

long int i;

//configuring all ports



DDRA = 0xFF;

DDRB = 0xFF;

DDRC = 0xFF;

DDRD = 0xEF;



//for (i=0;i<10;i++)

// delay(4000);

lcdinitroutine();

cmdroutine(0x80);

dataroutine('s');

USART_Init(0x17);

USART_Transmit('A');

cmdroutine(0xC8);

dataroutine('Q');

while(1)

{

;

}

}



void USART_Init( unsigned char baud )

{

/* Set baud rate */

/* Enable receiver and transmitter, Rx complete
interrupt*/

UCSRB = (1<<RXEN)|(1<<TXEN)|(1<<RXCIE);

/* Set frame format: 8data, 2stop bit,Even parity */

UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)|(2<<UPM0);

/* Configuring for 1200 bps baus*/

UBRRH = 0;

UBRRL = 50;

/* Global Interrupt
Enable*/

SREG = SREG | (0x80);

}



void USART_Transmit( unsigned char data )

{



unsigned char letter;

letter ='A';

while(letter != 'Z')

{

/* Wait for empty transmit buffer */

while ( !( UCSRA & (1<<UDRE)))

;

cmdroutine(0x80);

dataroutine(letter);

/* Put data into buffer, sends the data */

UDR = letter;

letter ++;

}

}



ISR(SIG_UART_RECV)//ISR(USART_RXC_vect)//(USART0_RX_vectXS)

{

unsigned char data;



/* Read the received data */

data = UDR;

cmdroutine(0xC0);

dataroutine(data);

}



HEADER FILES INCLUDED ARE,



#include <stdio.h>

#include <math.h>

#include <avr/io.h>

#include <header.h>

#include <avr/interrupt.h>

#include <avr/signal.h>

#include <inttypes.h>



lcdinitroutine() and cmdroutine() are for LCD..


any comments plzzzzzz

guys it did work using.. the ISR as

SIGNAL (SIG_UART_RECV)

{

unsigned char data;



/* Read the received data */

data = UDR;

cmdroutine(0xC0);

dataroutine(data);

}


thanks

niyaz

You might be also interested in:

:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086
:: Traffic light control system using 8086

Trouble with Atmega32's USART BaudRate ?

If there is some problem with usart baudRate then.

I want to set the USART Baud Rate to 9600 bps using 8-N-1 config.

The atmega32 is running on its internal 1 MHz oscillator. While configuring the USART I have used:

UBRR = 6

As per the table given on the Page 165 of atmega32's datasheet.

The table has two columns for the given baudrate for U2X=0 and U2X=1... Can you tell me what does this mean? And what is U2X is referring to?

I have interfaced an Xbee transceiver by Maxstream with the USART which is set to work on 9600 bps but apparently the data is not being Tx/Rx correctly. Any inputs?

Answer :

Well, let's tell if you use 1MHz internal crystal, you will have about 7% error which is not reliable at all. If you want a ZERO error rate you need to use an external crystal which is a multiple of 1200. For example a 11.0592 MHz is a multiply of 1200


( 11059200 / 1200 = 9216 )

you may understand why this is so.

Anyway, this is configuration for UART port of ATMEGA32 ( no interrupt )

UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x06;


you may check it in ATMEGA32 datasheet. You will surely understand how these values are selected.

In another note , as a starter I suggest you to work with CodeVision AVR. You can write ANSI C in this compiler.
But if you are going to go forward I suggest you to use IAR AVR. That is the only C++ compiler for AVR. It would be amazing if you want to write C++ codes. Also you can use it's JTAG debugger which is a miracle. You can connect a JTAGICE to your micro and you can place breakepoints on lines you want your program to be break and the you can check EVERYTHING at breakpoints. For example you want to see when you arrive to a line in your program what is the value of X. You will simply drag and drop X to the watch list and you will see the value of X. You can even see you memory IN CIRCUIT.


You might be also interested in:

:: Answers of Microprocessor(8085) & Electronics FAQ
:: The 8085 Microprocessor Architecture Microprocessors & Interfacing
:: How to add two binary numbers without carry

decimal addition program for 8086

This program will add two decimal numbers

LXI H,2200H
MOV A,M
INX H
ADD M
DAA
STA 2300H
HLT

DAA will convert HEX to valid BCD number
now the program can be easily understood

You might be also interested in:


:: 8051 or PIC microcontroller which is better
:: Effective addresses
:: Floating Point Initializations

serial Port interfacing with atmega

This is the program for the serial communication with my atmega32.


.include"m32def.inc"
.org 0000
rjmp main


main: ldi r16,low(ramend)
out SPL,r16
ldi r16,high(ramend)
out SPH,r16

ldi r18,0x00
out UBRRH,r18
ldi r18,0x19 ;setting baud rate of 2400 for 1MHZ
out UBRRL,r18
ldi r19,0x18
out UCSRB,r19 ;enabling RX & TX bits
ldi r19,0x86
out UCSRC,r19 ;setting aychronous mode with 1 stop
;& 1start bit & no parity
again: rcall usart_rx
rcall usart_tx
rjmp again




usart_rx: sbis UCSRA,RXC
rjmp usart_rx
in r17,UDR

ret


usart_tx: sbis UCSRA,UDRE
rjmp usart_tx
out UDR,r17
ret

;*************************

and set the settings in hyper terminal as

baud rate:2400
flow control:none

You might be also interested in:

:: Answers of Microprocessor(8085) & Electronics FAQ
:: The 8085 Microprocessor Architecture Microprocessors & Interfacing
:: How to add two binary numbers without carry

Jul 4, 2008

Subtraction of two 16 bit numbers using Indirect Addressing

The following is the program for addition of two sixteen bit numbers using indirect addressing. Source Index and Destination Index are set to 2000 and 4000 respectively. The input is given as four 8 bit numbers AL , AH and BL , BH.
i.e
AH+AL = AX
and
BH+BL=BX

The program code is as follows:
------------------------------------
MOV SI 2000
MOV DI 4000
MOV AX,[SI]
MOV BX, [ SI+2]
SUB AX,BX
MOV [DI],AX
INT A5
------------------------------------
Input

2000: 05
2001: 00
2002: 03
2003:00

Output
4000: 02

Similar to the above code just by replacing SUB by ADD addition of two 16 bit numbers can be performed using indirect addressing.

You might be also interested in:

:: 8051 or PIC microcontroller which is better
:: Effective addresses
:: Floating Point Initializations