реклама на сайте
подробности

 
 
> mega128+VMLAB+TTY
Rattlesnake
сообщение Apr 19 2007, 12:49
Сообщение #1





Группа: Новичок
Сообщений: 2
Регистрация: 19-04-07
Пользователь №: 27 169



ПЛЗ, ткните что я не так делаю.. Начинаю разбираться с МП, а тут затык..
Хочу вывести на TTY "Hello, world", но ни чего не получается..
prnt.c:
#include <mega128.h>
#include <stdio.h>
void main(void)
{
// USART0 initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART0 Receiver: Off
// USART0 Transmitter: On
// USART0 Mode: Asynchronous
// USART0 Baud rate: 38400
UCSR0B=0x00;
UCSR0A=0x00;
UCSR0C=0x86;
UBRR0H=0x00;
UBRR0L=0x0C;
UCSR0B=0x08;
//#asm("sei")

while (1)
{
printf("hello");
};
}

VMLAB:
prnt_vm.prj:
.MICRO "ATmega128"
.TARGET "prnt.hex"
.TOOLCHAIN "GENERIC"
.COFF "prnt.cof" ; " "
.SOURCE "prnt__.c"

.TRACE ; Activate micro trace

; Following lines are optional; if not included
; exactly these values are taken by default
; ------------------------------------------------------------
.POWER VDD=5 VSS=0 ; Power nodes
.CLOCK 1meg ; Micro clock
.STORE 250m ; Trace (micro+signals) storage time


X1 TTY(38400 8) PD0 PD1


Где я что неправильно делаю?
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
WHALE
сообщение Apr 19 2007, 20:18
Сообщение #2


Знающий
****

Группа: Свой
Сообщений: 902
Регистрация: 2-01-06
Из: Краснодар
Пользователь №: 12 768



Я так понимаю,это Кодвижн?
Тогда можно просто взять пример из хэлпа по выводу в UART,используя putchar()
#include <stdio.h>
flash char string_Hello "Hello";
unsigned char index_uart_tx;
while(string_Hello[index_uart_tx]) putchar(string_Hello[index_uart_tx++]);


--------------------
"Hello, word!" - 17 errors 56 warnings
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 22nd July 2025 - 06:10
Рейтинг@Mail.ru


Страница сгенерированна за 0.0136 секунд с 7
ELECTRONIX ©2004-2016