I know that the octopus is coming with its own firmware and its own
software libraries to control it from the PC.
Nevertheless my goal is to first gather some experience with the
ATmega128 that it contains. Therefore I loaded my own AVR program
instead of the firmware.
Actually the program does not behave as I am expecting: My program is
just be able to send characters and to receive some. To see the result I
write the bits "PORTC = 0xEF;" which drives the LEDs.
My Code was successfully charged on the Octopus Board.
For the application I have a Hterm on PC instaliert.
The Octopus Device ist recognized on my Pc. Because on System>System
Control>Hardware-Manager I can see "LibUSB-Win32Devices" --> "OtopusUSB
Interface Converter and I/O Extension".
although that, when I write the name of the port "LibUSB-Win32Devices"
or "OtopusUSB Interface Converter and I/O Extension" on my Hterm, he
doesn't recognize it. I don't know witch Port the Octopus have. Or I
must proceed in another art.
Please help me I am a beginner and want to work mit Octopus.
thanks for reading.
#warning "F_CPU was not defined yet, now make up with 4000000"
#define F_CPU 4000000L // Systemtakt in Hz - define as long>> Without errors in the computation
#define BAUD 9600L
#define UBRR_VAL ((F_CPU+BAUD * 8)/(BAUD*16)-1) //clever round
#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) //real baud rate
#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD-1000) //Error per thousand
#error Systematic error in the baud rate more than 1% and thus too high!
UBRR0H = (unsigned char)(UBRR_VAL>>8); // Set baud rate
UBRR0L = (unsigned char)UBRR_VAL;
UCSR0B |= (1<<RXEN)|(1<<TXEN); // Enable receiver and transmitter
UCSR0C = (1<<UCSZ00)|(1<<UCSZ01); // Set frame format: 8data, 1stop bit
void USART_Putc(unsigned char c)
while (!(UCSR0A & (1<<UDRE0))); // Do nothing until data have been transmited
UDR0 = c; // Put data into Buffer, sends the data
//function which send a String Through uart
void USART_Puts (char *string)
while( *string != '\0' ) //as long as *string != '\0' so unlike the "stringer end-character"
unsigned char UART_Getc()
while( !(UCSR0A & (1<<RXC)) ); // Do nothing until data have been recieved and is ready to be read from UDR
return UDR0; //Get and receive data from Buffer
DDRC = 0xFF; // define as output
USART_Puts("Messung gestartet:"); // receives data
unsigned char received;
received = UART_Getc(); // sends data
PORTC = 0xEF
if(received == 0x0D) // = ENTER-Taste
if( (received >= 0x61 && received <= 0x7A) //a bis z
|| (received >= 0x41 && received <= 0x5A) //A bis Z
|| (received >= 0x30 && received <= 0x39) //0 bis 9
|| (received == 0x20) ) //<SPACE>
} //end main()