עבור לתוכן
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.

nuvoton isd1760 arduino mega

Featured Replies

פורסם

היי

אני עובד עם ארדואינו מגה 2560 ומודול כרטיס קול isd1760

20144182003917990.jpg

אני משתמש בקוד הבא:

//define pins

#define DATAOUT 11 //mosi

#define DATAIN 12 //miso

#define SPICLOCK 13 //sck

#define SLAVESELECT 10 //ss

//opcodes

#define PU 0x01

#define STOP 0x02

#define RESET 0x03

#define CLR_INT 0x04

#define RD_STATUS 0x05

#define RD_PLAY_PTR 0x06

#define PD 0x07

#define RD_REC_PTR 0x08

#define DEVID 0x09

#define PLAY 0x40

#define REC 0x41

#define ERASE 0x42

#define G_ERASE 0x43

#define RD_APC 0x44

#define WR_APC1 0x45

#define WR_APC2 0x65

#define WR_NVCFG 0x46

#define LD_NVCFG 0x47

#define FWD 0x48

#define CHK_MEM 0x49

#define EXTCLK 0x4A

#define SET_PLAY 0x49

#define SET_REC 0x81

#define SET_ERASE 0x82

void setup() {

byte clr;

pinMode(DATAOUT, OUTPUT);

pinMode(DATAIN, INPUT);

pinMode(SPICLOCK,OUTPUT);

pinMode(SLAVESELECT,OUTPUT);

digitalWrite(SLAVESELECT,HIGH); //disable device

SPCR = B01111111; //data lsb, clock high when idle, samples on falling

clr=SPSR;

clr=SPDR;

delay(10);

//start serial

//Serial.begin(57600);

digitalWrite(SLAVESELECT,LOW);

spi_transfer(PU); // power up

spi_transfer(0x00); // data byte

digitalWrite(SLAVESELECT,HIGH);

delay(100);

digitalWrite(SLAVESELECT,LOW);

spi_transfer(CLR_INT); // clear interupt and eom bit

spi_transfer(0x00); // data byte

digitalWrite(SLAVESELECT,HIGH);

delay(100);

}

void loop() {

digitalWrite(SLAVESELECT,LOW);

spi_transfer(PLAY); // clear interupt and eom bit

spi_transfer(0x00); // data byte

digitalWrite(SLAVESELECT,HIGH);

ready_wait();

digitalWrite(SLAVESELECT,LOW);

spi_transfer(FWD); // clear interupt and eom bit

spi_transfer(0x00); // data byte

digitalWrite(SLAVESELECT,HIGH);

}

void ready_wait(){

byte byte1;

byte byte2;

byte byte3;

while(byte3<<7 != 128){

digitalWrite(SLAVESELECT,LOW);

byte1 = spi_transfer(RD_STATUS); // clear interupt and eom bit

byte2 = spi_transfer(0x00); // data byte

byte3 = spi_transfer(0x00); // data byte

digitalWrite(SLAVESELECT,HIGH);

}

delay(100);

}

char spi_transfer(volatile char data)

{

SPDR = data; // Start the transmission

while (!(SPSR & (1<<SPIF))) // Wait for the end of the transmission

{

};

return SPDR; // return the received byte

}

זה עבד לי בארדואינו UNO אבל כשניסיתי להעביר למגה אז זה לא עובד

ראיתי באתר של ארדואינו על המגה שהכניסות מתחלפות לכניסות 50-53 בארדואינו מגה אבל זה עדיין לא עבד לי

תודה לעוזרים

פורסם
  • מחבר

מישהו?

ארכיון

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

דיונים חדשים

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.