Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * GccApplication4.c
- *
- * Created: 28.10.2022 08:54:14
- * Author : Student_PL
- */
- #include <avr/io.h>
- #include <util/delay.h>
- int main(void)
- {
- DDRA = 0xFF;
- //int state = 0;
- DDRB = 0xF0; //
- PORTB = 0x0F; //
- //PORTD &=~(1<<4);
- PORTA=3;
- while (1)
- {
- _delay_ms(3);
- if((PINB&(1<<0))==0){
- PORTA=0b00000001;
- }
- if((PINB&(1<<1))==0){
- PORTA=0b00000002;
- }
- if((PINB&(1<<2))==0){
- PORTA=0b00000003;
- }
- if((PINB&(1<<3))==0){
- PORTA=0b00000004;
- }
- // while((PIND & 0x0F) != 0x0F) {
- // PORTD &= 0x0F;
- // }
- // while((PIND & 0x0F) == 0x0F) {
- // while((PIND & 0x0F) == 0x0F) {
- // _delay_ms(20);
- // }
- // _delay_ms (40);
- // }
- // PORTD = 0xEF;
- // if((PIND & 0x0F) != 0x0F) {
- // state = 1;
- // }
- // if (state == 1) {
- // PORTA = 0b00000001;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement