עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

עזרה דחוף בתוכנה לחיבור לוח מקשים 3x4 ל-atmega32- שפת c

Featured Replies

פורסם

שלום,

אני מנסה לרשום בשפת c תוכנית ללוח מקשים 3x4 שבסופו הוא ידליק לי לדים שחיברתי לערכה לפי הסדר ובהתאם למספר שלחצתי עליו.

לדוגמא: אם לחצתי על לחצן '3' אז הנורות ידלקו לפי הסדר הבא: 0011.

הנה התוכנית שכתבתי וכל הזמן ה-avr studio רושם שיש שגיאה:

#define __BIT_DEF_H__

#include "avr/io.h"

#define R1 PIND0

#define R2 PIND1

#define R3 PIND2

#define R4 PIND3

#define C1 PIND4

#define C2 PIND5

#define C3 PIND6

void (main)

{

DDRA=0xff;

DDRB=0x00;

while(1)

{

C1=1;

C2=1;

C3=1;

if((R1==0)&(R2==1)&(R3==1)&(R4==1))

{

PORTA=0x01;

}

if((R1==1)&(R2==0)&(R3==1)&(R4==1))

{

PORTA=0x04;

}

if((R1==1)&(R2==1)&(R3==0)&(R4==1))

{

PORTA=0x07;

}

if((R1==1)&(R2==1)&(R3==1)&(R4==0))

{

PORTA=0x00;

}

C1=1;

C2=0;

C3=1;

if((R1==0)&(R2==1)&(R3==1)&(R4==1))

{

PORTA=0x02;

}

if((R1==1)&(R2==0)&(R3==1)&(R4==1))

{

PORTA=0x05;

}

if((R1==1)&(R2==1)&(R3==0)&(R4==1))

{

PORTA=0x08;

}

if((R1==1)&(R2==1)&(R3==1)&(R4==0))

{

PORTA=0x00;

}

C1=1;

C2=1;

C3=0;

if((R1==0)&(R2==1)&(R3==1)&(R4==1))

{

PORTA=0x03;

}

if((R1==1)&(R2==0)&(R3==1)&(R4==1))

{

PORTA=0x06;

}

if((R1==1)&(R2==1)&(R3==0)&(R4==1))

{

PORTA=0x09;

}

if((R1==1)&(R2==1)&(R3==1)&(R4==0))

{

PORTA=0x00;

}

}

}

פורסם

שלום וברוך הבא לפורום.

קודם כל, ערוך בבקשה את הכותרת ותעיף את ה"דחוף". שום דבר לא דחוף.

חוץ מזה, שים את הקוד בתוך טג קוד (בחלון העריכה המתקדם, סמן את הקוד ולחץ על הכפתור עם ציור #) כדי שיהיה יותר קריא.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.