tpetar
Advanced Member level 7
- Joined
- Sep 27, 2010
- Messages
- 6,417
- Helped
- 1,713
- Reputation
- 3,456
- Reaction score
- 1,673
- Trophy points
- 1,393
- Location
- Pancevo-Belgrade, Serbia
- Activity points
- 37,363
The maximum voltage and current that can run through the armature and the armature contacts
#include<avr/io.h>
#include<util/delay.h>
#define F_CPU 16000000
void main()
{
DDRA = 0b00000000;
DDRB = 0b00000001;
While(1)
{
int x = PINA & 0b00000001;
If (x = 0b00000001)
{
PORTB = 0b00000001;
}
else
{
PORTB = 0b00000000;
}
}
}
On what event relay should be activated ?
........I found this in one of the study materials for atmega 16.
- - - Updated - - -
Code:#include<avr/io.h> #include<util/delay.h> #define F_CPU 16000000 void main() { DDRA = 0b00000000; DDRB = 0b00000001; While(1) { int x = PINA & 0b00000001; If (x = 0b00000001) { PORTB = 0b00000001; } else { PORTB = 0b00000000; } } }
I coded in C for many years, though not an 'atmega16' programmer. I do not see that the code does anything. Is there a reason to define 'x' inside the loop? usually this is seen as poor practise.
Why assign DDRA and DDRB values and not use them?
I am using the 7805 but I am not getting the output. I connected the output (live) of the adapter to the input of 7805 and ground of adapter to the ground terminal of 7805 but I am getting nothing at the output terminal. Maybe its because too much current. output current of Adapter is 1 amp.
Hey thanxs a lot but if I have 10 uF, 50 V instead of 10uF 35 V, will it work?
#include<avr/io.h>
#include<util/delay.h>
#define F_CPU 16000000
void main()
{
DDRA = 0b00000000; // [COLOR="#FF0000"]Set PORTA for Input[/COLOR]
DDRB = 0b00000001; // [COLOR="#FF0000"]Set Pin 0 of PORTB for Output, the Rest of PORTB for Input[/COLOR]
While(1) // [COLOR="#FF0000"]Repeatedly Poll and Set Pins[/COLOR]
{
int x = PINA & 0b00000001; //[COLOR="#FF0000"] Mask PORTA for Pin 0 Only and store state in shadow register x[/COLOR]
If (x = 0b00000001) // [COLOR="#FF0000"]If Pin0 Was High[/COLOR]
{
PORTB = 0b00000001; // [COLOR="#FF0000"]Set Pin0 of PORTB High[/COLOR]
}
else
{
PORTB = 0b00000000; //[COLOR="#FF0000"] Else Set Pin0 of PORTB Low [/COLOR]
}
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?