3 days ago, I finally bought myself a programmer. It's quite hard to find a programmer locally and buying online isn't a viable solution knowing how effective is the Russian post.
The programer is can be found over here.
Unfortunately, I couldn't yet get it to work. Linux, OSx and Windows seems to recognize it correctly but I couldn't get it to work on my old TV-B-Gone board.
Whenever I connected my cable to the TV-B-Gone, the green light (which display pc connection) stopped lighting. On windows, usb ports completely stopped working unless I rebooted the computer.
This programmer can supply either USB voltage, 3.3v or nothing. I then checked if any voltage was supplied. Then tried to plug the current to my board. It almost burned the board. I then realized that the ICSP connector isn't configured like a standart AVR ICSP connector. Reading trough the documentation, I realized that the VCC and GND pins were reversed, and all other pins are using a different configuration from the one recommended by AVR.
If you buy yourself a programmer, make sure to check how is configured the ICSP connector. I feel lucky that it didn't kill the chip.
Now that I know why nothing worked and I almost killed my tiny85. I have to make an apapter to the AVR standard to programmer configuration.
Here's a picture of what I got after some time. I made the red board bellow and it should be compatible with most arduino shield. If the shield have long pins, it should be possible to stack them up easily. When the pins are short, it will be harder because the arduino board isn't build with constant space between the row of pins. I guess it will depends on the shields but I got mine to work. The difference between my board and an arduino board is that I can extend it very well and can ditch the shields at some point and replace it to something similar to a breadboard. I'm looking forward to add a powersupply and possibly a usb port.
Here is the first program I got to work on my AVR board:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
/* * Physic4.asm * * Created: 5/19/2013 11:48:31 PM * Author: llacroix */ /* * AssemblerApplication1.asm * * Created: 5/1/2013 9:17:23 PM * Author: loic */ .NOLIST .INCLUDE "m8def.inc" .LIST .cseg ; Start of code segment .org 0 rjmp main .org 0x26 ; After the reset/interrupt table main: ldi r16, LOW(RAMEND) ; Setting up the SP (stack pointer) ldi r17, HIGH(RAMEND) out SPL, r16 out SPH, r17 ldi r17, 0x0F ; This goes to DDRC ldi r16, 0b00 ; This goes to PORTC out DDRC, r17 out PORTC, r16 main_loop: ; pin 1 ldi r24, 1 rcall light_pin ; pin 2 ldi r24, 2 rcall light_pin ; pin3 ldi r24, 4 rcall light_pin ; pin4 ldi r24, 8 rcall light_pin ; pin5 ldi r24, 16 rcall light_pin ; pin6 ldi r24, 32 rcall light_pin ; pin7 ldi r24, 64 rcall light_pin ;ldi r24, 128 ;rcall light_pin rjmp main_loop light_pin: out PORTC, r24 ldi r26, 100 rcall wait ldi r24, 0 out PORTC, r24 ldi r26, 50 rcall wait wait: nop nop sbiw r26, 1 brne wait ret
It's probably my first program written only in assembler. This program is lighting some leds in order. It use the PORTC as output and light one pin after an other. I use the register 24 to store the content of what should have the portc.
It's easy to understand here that each pin is a bit of the PORTC. When the bit is on (1), it means that it will output 5volts. If the pin is 0 it will be to the ground. If you'd like to light multiple leds. You'd have to output to PORTC something like this:
0b000011 to light the first and second led.
Before you can use the pins as Output, you have to make sure that the DDRC is correctly set. I won't explain in detail the program yet but I will probably explain more program later.
light_pin section is used to transfer the value stored in register 24 to PORTC. At the end of the section, it will call wait using the register 26. The wait section subtract the register 26 until it reaches something less than 1 and then return to where it was called. The
nop instructions are used to make it wait longer. A
not is wasting one processor cycle on atmega8. On each loop, the
wait function should waste around 4 cycles. 2 nop and 2 for the test. If r26 is 100, it will take 400 cycles to return.