[ Log In ]
Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Qty:
Image of the Atmega324p

Atmega324P

$8.50
Qty:

10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

$0.85
Qty:
16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

$12.50
Qty:
White prototyping breadboard with 30 tie strips and two power rails on each side.

White Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$7.95
Qty:
Clear Semi Transparent Breadboard

Clear Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$8.50
Qty:
Red Through Hole LED (Light emitting diode)

Single Red Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Green through hole LED (light emitting diode)

Single Green Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Yellow through hole LED (light emitting diode)

Single Yellow Through Hole LED (Light Emitting Diode)

$0.34
Qty:
Skip Navigation Links

UART Tutorial: One Way Communication from Chip-to-Chip

The Transmitting Chip's Program:

#define numberOfButtons 1

include <avr/io.h>
#include"ButtonPress.h"

int main(void)
{
DDRB |= 1 << PINB1;
DDRB &= ~(1 << PINB0);
PORTB |= 1 << PINB0;

int UBBRValue = 25;

//Put the upper part of the baud number here (bits 8 to 11)
UBRR0H = (unsigned char) (UBBRValue >> 8);

//Put the remaining part of the baud number here
UBRR0L = (unsigned char) UBBRValue;

//Enable the receiver and transmitter
UCSR0B = (1 << RXEN0) | (1 << TXEN0);

//Set 2 stop bits and data bit length is 8-bit
UCSR0C = (1 << USBS0) | (3 << UCSZ00);

while (1)
{
if (ButtonPressed(0, PINB, 0, 100))
{
PORTB ^= 1 << PINB1;

//Wait until the Transmitter is ready
while (! (UCSR0A & (1 << UDRE0)) );

//Get that data outa here!
UDR0 = 0b11110000;
}
}
}

You might notice a few differences from the program in the video. The button presses are put into a library and the program calls the functions in the library. If you want to see how I did this, just look at this video.

The Receiving Chip's Program:

include <avr/io.h>
int main(void)
{
DDRB |= (1 << PINB0);

//Communication UART specifications (Parity, stop bits, data bit length)
int UBRR_Value = 25; //This is for 2400 baud
UBRR0H = (unsigned char) (UBRR_Value >> 8);
UBRR0L = (unsigned char) UBRR_Value;
UCSR0B = (1 << RXEN0) | (1 << TXEN0);
UCSR0C = (1 << USBS0) | (3 << UCSZ00);

unsigned char receiveData;
while (1)
{
while (! (UCSR0A & (1 << RXC0)) );

receiveData = UDR0;

if (receiveData == 0b11110000) PORTB ^= (1 << PINB0);
}
}