diff --git a/docs/Embedded Programming.md b/docs/Embedded Programming.md index 190d62b8d25db96c65a27efeaee8bb09ddb10fc2..39bb403a47d2e031fafdc5051be1be6b468cbdcb 100644 --- a/docs/Embedded Programming.md +++ b/docs/Embedded Programming.md @@ -109,7 +109,8 @@ For this after uploading the code using the FabISP, it needs to be removed and c TX (hello) and RX(FTDI board) are connected and RX (hello board) to TX (FTDI board) are connected. Basically when one transmits, the other receives. -FTDI is the protocol for communication. It can be connected in various ways. +FTDI is the protocol for communication. It can be connected in various ways: + 1. Through a commercial board like this:  @@ -120,11 +121,17 @@ FTDI is the protocol for communication. It can be connected in various ways.  I use a DIY board I borrowed from Steven. -You can use this schematic to make a ftdi board. - +You can use [this schematic](./images/empro/ch330_ftdi.zip) to make a ftdi board. + +I also attempted at making my own using Stevens simple design. +Traces: + + +Outline: + I used a t45 based hello board as well. -So after uploading the blink code + serial, connect the ftdi board to hello board, and on pening the serial monitor, it should show the status of the LED. +So after uploading the blink code + serial, connect the ftdi board to hello board, and on opening the serial monitor, it should show the status of the LED.  @@ -133,7 +140,7 @@ So after uploading the blink code + serial, connect the ftdi board to hello boar I used Arduino IDE and the same physical setup (FabISP+ribbon cable+ hello board) and wrote the code in avr-gcc. Arduino IDE operates avr-gcc in the background. And has an interface over it. So it works easily. -This is the [code file](docs/images/empro/t45-blink-avr-gcc.zip). +This is the [code file for t45](./images/empro/t45-blink-avr-gcc.zip) ``` #include <avr/io.h> #include <util/delay.h> @@ -154,19 +161,35 @@ const int sw=PB3; } ``` -Basically you inlcude avr/io and delay libraries so that you can use the arduino commands. + and [for t44](./images/ep/hello.ftdi.44.blink.zip) with the makefile. +``` +#include <avr/io.h> +#include <util/delay.h> +// #define F_CPU 1000000UL // 1 MHz internal RC + +int main(void){ + DDRB |= 1<<PB2; // set PB2 as output + PORTB |= ~(1<<PB2); // turn LED off + + while (1){ + PORTB = ~(PINB & (1<<PB2)); // invert LED status + _delay_ms(1000); // 1 sec delay + } +} +``` + +Basically you include avr/io and delay libraries so that you can use the arduino commands. Also, the pin numbers are recognised by their ports PB# instead of pin #.  5. Programming with Atmel Studio --- -Can't in mac. will do this later on a windows system... - +Can't do this in macOS. Will try to do this later on a windows system... -5. References ---- 6. Code files --- -[Code (sketch) for programming with FabISP + Arduino IDE](docs/images/empro/led-button-44.zip) +[Code (sketch) for programming with FabISP + Arduino IDE](./images/empro/led-button-44.zip) +[avr-gcc blink for t44](./images/ep/hello.ftdi.44.blink.zip) +[avr-gcc blink for t45](./images/empro/t45-blink-avr-gcc.zip) diff --git a/docs/images/empro/ch330_ftdi.zip b/docs/images/empro/ch330_ftdi.zip new file mode 100644 index 0000000000000000000000000000000000000000..ac9336d1239dfa6a889fe53c5804d2a20f0059e0 Binary files /dev/null and b/docs/images/empro/ch330_ftdi.zip differ diff --git a/docs/images/ep/hello.ftdi.44.blink.zip b/docs/images/ep/hello.ftdi.44.blink.zip new file mode 100644 index 0000000000000000000000000000000000000000..b3a0f9b80c5dc5c3eb7d52cf4178f7979b212d72 Binary files /dev/null and b/docs/images/ep/hello.ftdi.44.blink.zip differ diff --git a/docs/images/ep/outline.jpeg b/docs/images/ep/outline.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ba1f30905171263662552b3fb0afe3d40cd64b4a Binary files /dev/null and b/docs/images/ep/outline.jpeg differ diff --git a/docs/images/ep/trace.jpeg b/docs/images/ep/trace.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..7b77f86f0b722705215ceb0ae4e484cde0138f2f Binary files /dev/null and b/docs/images/ep/trace.jpeg differ