2.1. Experiment to read data from PORTB and outpu to the PORTC

# include <mega8535.h>
# include <delay.h>

void main(void)
{
DDRB=0×00;
PORTB=0xFF;
DDRC=0xFF;
#asm(“nop”);

while (1)
{
PORTC=PINB;
};
}

Posted in Tutorial AVR C Codevision | 1 Comment

1.3. Experiments turn on the LED and the shift to right

In this experiment an LED that is connected to PORTC will be turned on alternately

# include <mega8535.h>
# include <delay.h>
int temp;
void main(void)
{
DDRC=0xFF;
temp=1<<7; //bit ke-7 diberi logika 1
PORTC=~temp;
delay_ms(100);

while (1)
{
// Place your code here
delay_ms(100);
temp>>=1; //geser ke kanan satu kali
PORTC=~temp;
if(temp==0)
{
temp=1<<7; //bit ke-7 diberi logika 1 kenbali
}
};
}

Posted in Tutorial AVR C Codevision | 1 Comment

1.2. Experiment to turn on/off using BIT

In this experiment led is connected to PORTC will be turned on and off with the instruction BIT

# include <mega8535.h>
# include <delay.h>

// Declare your global variables here

void main(void)
{
DDRC=0XFF;
while (1)
{
// Place your code here
PORTC.0=0;
delay_ms(100);
PORTC.0=1;
delay_ms(100);

};
}

Posted in Tutorial AVR C Codevision | 1 Comment

1.1. Experiment turn on/off LED

In the following experiment portC functioned as an output and eight LED will turn on and off continuously, using delay subrutine.

# include <mega8535.h>
# include <delay.h>
// Declare your global variables here
void main(void)
{
PORTC=0XFF;
while (1)
{
// Place your code here
PORTC=0xFF;
delay_ms(1000);
PORTC=0×00;
delay_ms(1000);
};
}

Posted in Tutorial AVR C Codevision | 3 Comments

Testing programmer AVRISP MKII with Codevision

After successfully using AVRISP MKII programmer using the AVR Studio 4 for purposes of programming, debugging and downloading to the device, then the next step is to use the Software codevision to do programming using C language, debugging and downloading to the device, with the following steps.

1. Open the program Codevision 2:03:09, as shown in the following figure.

2. In the c compiler Tab, select the chip that will be used, the clock circuit used target

3. For the filling process files to the device, perform the selection of HEX files on the File menu, as shown in the following figure:

4. If step 3 has been done then the HEX file will be ready to be loaded into the device, select the icon programmer to do the process of filling the hex files to the devices that we use as a target, which must first be selected device that we will use, and select the button for all program began a process of filling the HEX file to the device, remove, fill and verify

Posted in Programmer AVR | 1 Comment

Testing Programmer AVRISP USB MKII with AVR Studio 4

If the steps have been undertaken and manufacture hardware driver installation AVRISP MKII programmer has finished, the next step is to conduct the trial process by using the AVR Studio software, go to the AVR Studio software, create a new file, or open files that already exist. So will we get the following program display

1. Select the icon that reads AVR, AVR programmer to select the connection used, as shown in the following figure.

2. Choose a programmer to be used, because we will use the AVR ISP programmer MK II, the piliih programmers, with the port to be used is USB

3. Select Device to be used, it appears there is still a device for 80C51, 89S51 and 89s52

4. If you use the device for the AVR family, you can choose the device as you need, in this experiment, the device that I use is ATMEGA8535

Posted in Programmer AVR | 1 Comment

Building Programmer AVRISP USB MKII Part II

After the process of making a series of hardware AVRISP USB MK II is completed, and has filled the firmware, then the next step is to install the drivers on your computer or laptop, but first it must be ensured that the AVR Studio 4 software has been installed on your computer or your notebook, because the software , also include didalamnnya USB driver for AVR ISP programmer USB MK II. The next installation steps are as follows:
1. Connect the programmer with a USB cable extension, in this step, the programmer does not need to be connected to a series of targets.

2.When the programmer AVRISP MKII has been detected as the image on the bottom right corner, next will come out the icon that indicates the type of AVR programmer MK II, with drawings as follows:

3. When the image appears in the display above, the programmers have been recognized by the driver comes from AVR Studio 4, the next will come out the icon that indicates that the programmers have been recognized, and ready to install drivers

4. Follow the installation steps with the Wizard of existing software, the radiobutton, select the installation software automatically, select the next to go on the next wizard dialog:


5. Next windows will perform automatic installation of the software in accordance with AVRISP MKII programmer drivers.

6. When the installation is complete it will come out the icon that gives information that the hardware has been found and Ready to Use, which means it is ready for use.

7. To determine whether the driver has been installed, it can be seen in Device Manager, will be shown as follows.

Posted in Programmer AVR | 1 Comment

Building Programmer AVRISP with serial using Ponyprog

To make filling the firmware on the ATmega8 that will be used on the MK II programmer AVRISP then you need a programmer who can you make another in a simple, inexpensive enough to use components, resistors, zener, capacitors and transistors, may be sufficient with $10. This programmer must be connected to the COM port of your PC, if you connect with a USB to Serial RS232 Converter, but the process can downloadingnya very long time.

Download Ponyprog

Posted in Programmer AVR | Leave a comment

Building Programmer AVRISP MKII USB Part I

Here is a series of AVR programmer using the USB port, the circuit is a modification of USBasp I have it simple, with firmware AVRISP MKII, so the circuit, compatible with AVR Studio 4, and codevision which already include downloader programmer
If your computer has been the installation of AVR Studio 4 or codevision, then you no longer need the USB drivers for your windows, in order to get support for drivers when using windows vista or windows seven, then make sure you have downloaded the latest software on the site atmel.com

download firmware

download AVR Studio 4

Download Codevision 3.02.9

Posted in Programmer AVR | 15 Comments

4.5. Experiment Using SW to shift character to the left or right

In this experiment will print a character on the lcd screen character, and by using a switch then the character can be shifted right and left.

.include “m8535def.inc”
.org 0×0000
;
ldi r16,low(RAMEND)
out SPL,r16
ldi r16,high(RAMEND)
out SPH,r16
;
ldi r16,0b11111111
out ddrc,r16
sbi ddrd,3;rs
sbi ddrd,4;en
cbi ddrb,7
sbi portb,7
;
rcall Init_LCD
main:
ldi r16,0×80
rcall write_inst
ldi r16,’A’
rcall write_data
;
cek:sbis PINB,7
rcall shift_right
sbis PINB,6
rcall shift_left
rjmp cek
;
stop:rjmp stop

Init_LCD:
ldi r16,0b00000001
rcall write_inst
ldi r16,0b00111000
rcall write_inst
ldi r16,0b00001100
rcall write_inst
ldi r16,0b00000110
rcall write_inst
ret
;
write_inst:
cbi portd,3
Out portC,r16
sbi portd,4
rcall delay
cbi portd,4
ret
;
write_data:
sbi portd,3
Out portC,r16
sbi portd,4
rcall delay
cbi portd,4
ret
;
shift_left:
ldi r16,0×18
rcall write_inst
rcall ldelay
ret
;
shift_right:
ldi r16,0x1f
rcall write_inst
rcall ldelay
ret

delay:
; provides some delay so that the LED is visible
; =============================
; delay loop
; 499998 cycles: about 1/2 seconds
; —————————-
; delaying 499995 cycles:
ldi R29, $0f
WGLOOP0: ldi R30, $0f
WGLOOP1: ldi R31, $10
WGLOOP2: dec R31
brne WGLOOP2
dec R30
brne WGLOOP1
dec R29
brne WGLOOP0
ret
LDelay:
; provides some delay so that the LED is visible
; =============================
; delay loop
; 499998 cycles: about 1/2 seconds
; —————————-
; delaying 499995 cycles:
ldi R29, $02
WGLOOP3: ldi R30, $f0
WGLOOP4: ldi R31, $f0
WGLOOP5: dec R31
brne WGLOOP5
dec R30
brne WGLOOP4
dec R29
brne WGLOOP3
ret

Posted in Tutorial AVR Asembly | 2 Comments