Zdravím,
mám problém s mikrokontrolérem Atmega16. Není mi schopný dát dostatečný výstupní proud pro sepnutí tranzistoru( potřebuji 5 až 10mA) . Jako výstup používám port A a port C. Mám spojené AVCC s VCC kvůli napájení portu A. Netuším, jestli mám problém v elektronice ( odpory, tranzistor, Atmega16 …), nebo v programu. V datasheetu atmegy je napsaný výstupní proud 40mA tak nevím. Myslím, že spálený není, signalizační diodu v pohodě rozsvítí a zkoušel jsem 2 exempláře a chovají se úplně stejně. Používám tranzistor bc237.Tady je program pro úplnost:
#include <avr/io.h>
#include <util/delay.h>
#define F_CPU 4000000
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
void delay(unsigned int doba)
{
volatile unsigned int z;
for (z = 0; z < doba; z++);
}
int main (void)
{
uint8_t RecByte;
uint8_t StateByte;
uint8_t ByteOn;
uint8_t ByteOff;
unsigned int i,z;
int j;
i = 1;
z = 1;
DDRA = 0xFF;
PORTA = 0xAA;
DDRC = 0xFF;
PORTC = 0x55;
DDRD = 0x00;
UCSRB |= (1 << RXEN);
UCSRC |= (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes - URSEL bit set to select the UCRSC register
UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
for (;;){ /.......some working....its long to copy there
…...
}
Fórum › Mikrokontroléry
Atmega16 - malý výstupní proud

nejdulezitejsi je schema... to by chtelo dat sem...
pak pocitej s tim ze 5V je u megy, 0,7V ubytek na tranzistoru a odpor to chce 4.3/0.010 takze kdyz vemu podle rad bude to tak kolem 470ohmu
otestuj schvalne s normalni LED.. treba pres 150ohmu nejakou modrou... nebo kolem 220/330ohmu cervenou

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 4 hosté
Podobná vlákna
Proud kroucenou dvojlinkou? — založil Mrkev
Jak změřit proud pomocí napětí? — založil Luke
Pointer - výstupní parametr — založil radek-46
Spustitelný výstupní soubor — založil RoboHK
Zajímavé příklady do školy (vstupní a výstupní soubory) — založil Lada
Moderátoři diskuze