но стоит послать тот же символ на uart1 и всё колом, не идеть на плате,
а протеусе идет...
фуза м103с - 0
может не туда гляжу?
Код
#include <iom64.h>
#include <inavr.h>
#define FOSC 11059200
#define BAUD 4800
#define MYUBRR FOSC/16/BAUD-1
#define on PIND_Bit0
#define button_press PORTB_Bit0
void uart0_init(unsigned int ubrr){
UCSR0B = 0x00; //disable while setting baud rate
UCSR0A = 0x00;
UBRR0H = (unsigned char)(ubrr>>8);
UBRR0L = (unsigned char)ubrr;
UCSR0B = (1<<RXEN0)|(1<<TXEN0); // rx, tx enabled
UCSR0C = 0x86; //8bit,1stop
}
void uart1_init(unsigned int ubrr){
UCSR1B = 0x00; //disable while setting baud rate
UCSR1A = 0x00;
UBRR1H = (unsigned char)(ubrr>>8);
UBRR1L = (unsigned char)ubrr;
UCSR1B = (1<<RXEN1)|(1<<TXEN1); // rx, tx enabled
UCSR1C = 0x86; //8bit,1stop
}
void transmit0 (unsigned char data){
while (!(UCSR0A&(1<<UDRE0)));
UDR0=data;
}
void transmit1 (unsigned char data){
while (!(UCSR1A&(1<<UDRE1)));
UDR1=data;
}
int main (void){
uart0_init(MYUBRR);
uart1_init(MYUBRR);
DDRC=0xff; PORTC=0xff;
DDRD=0x00; PORTD=0x03;
DDRE=0x00;
DDRA=0xff; PORTA=0xff;
DDRB=0xff; PORTB=0x00;
DDRF=0x00; PORTF=0x00;
button_press=0;
while(1){
if (on==0){
transmit1('X');
button_press=!button_press;
while (on==0){};
}
}
}
#include <inavr.h>
#define FOSC 11059200
#define BAUD 4800
#define MYUBRR FOSC/16/BAUD-1
#define on PIND_Bit0
#define button_press PORTB_Bit0
void uart0_init(unsigned int ubrr){
UCSR0B = 0x00; //disable while setting baud rate
UCSR0A = 0x00;
UBRR0H = (unsigned char)(ubrr>>8);
UBRR0L = (unsigned char)ubrr;
UCSR0B = (1<<RXEN0)|(1<<TXEN0); // rx, tx enabled
UCSR0C = 0x86; //8bit,1stop
}
void uart1_init(unsigned int ubrr){
UCSR1B = 0x00; //disable while setting baud rate
UCSR1A = 0x00;
UBRR1H = (unsigned char)(ubrr>>8);
UBRR1L = (unsigned char)ubrr;
UCSR1B = (1<<RXEN1)|(1<<TXEN1); // rx, tx enabled
UCSR1C = 0x86; //8bit,1stop
}
void transmit0 (unsigned char data){
while (!(UCSR0A&(1<<UDRE0)));
UDR0=data;
}
void transmit1 (unsigned char data){
while (!(UCSR1A&(1<<UDRE1)));
UDR1=data;
}
int main (void){
uart0_init(MYUBRR);
uart1_init(MYUBRR);
DDRC=0xff; PORTC=0xff;
DDRD=0x00; PORTD=0x03;
DDRE=0x00;
DDRA=0xff; PORTA=0xff;
DDRB=0xff; PORTB=0x00;
DDRF=0x00; PORTF=0x00;
button_press=0;
while(1){
if (on==0){
transmit1('X');
button_press=!button_press;
while (on==0){};
}
}
}
Ой я придурок! Вот дебил, весь день бился, а фузу так и нет попробовал сменить, причем ту на которую как на памятник смотрел.
Извените меня пожалуйста за M103C, больше постараюсь так не ошибаться
---
можно тему закрыть : ) или оставить в назидание : )