Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with loop For
29-03-2013, 02:17 PM,
RE: Problem with loop For
(29-03-2013, 11:13 AM)regis Wrote: Hi,

Hi Regis,

Thanks for helping.

I'm really a bad programmer. In fact, I barelly understand C or C++. Yes, I have to study a lot yet!

I will respond point 1 later.

Quote:2- in void setup(), you call resetModule() which is defined after your call. You should prototype your functions before. This is actually what Wtv020sd16p.h is done for so just add void resetModule(); in your header file.

Done this, and thanks for tip about prototyping functions.

Quote:3- With SDCC, you can't write :
for (unsigned int mask = 0x8000; mask > 0; mask >>= 1)
You should write this instead :
unsigned int mask;
for (mask = 0x8000; mask > 0; mask >>= 1)

I take your advice and paste these contents in header file:

#ifndef Wtv020sd16p_h
#define Wtv020sd16p_h

  Wtv020sd16p(int resetPin,int clockPin,int dataPin,int busyPin);
  void reset();
  void playVoice(int voiceNumber);
  void asyncPlayVoice(int voiceNumber);
  void stopVoice();
  void pauseVoice();
  void mute();
  void unmute();
  void sendCommand(unsigned int command);
  int _resetPin;
  int _clockPin;
  int _dataPin;
  int _busyPin;
  int _busyPinState;


After that, I modified the pde file with your tip on mask function. Again, when I try to compile, the result is that some error still persist.

If I comment the include at begin of pde file (#include <Wtv020sd16p.h>) and the mask function (between lines 70 and 95), I can compile but, if one of these are uncommented, then no hex is compiled.

Quote:4- I can't see all functions defined in Wtv020sd16p.h in your code ...

My fail.

At the time I posted my question I was very tired.

Attached is my new code (Wtv020sd16p - and the original code for arduino (Wtv020sd16p - just for comparision.

Quote:Good luck.

Sorry for so many questions, and thanks a lot for your tips.


Attached Files
.zip   Wtv020sd16p - (Size: 1.1 KB / Downloads: 5)
.zip   Wtv020sd16p - (Size: 3.98 KB / Downloads: 13)

Messages In This Thread
Problem with loop For - by plautz - 28-03-2013, 05:49 AM
RE: Problem with loop For - by regis - 29-03-2013, 11:13 AM
RE: Problem with loop For - by plautz - 29-03-2013, 02:17 PM
RE: Problem with loop For - by latcakir - 20-05-2013, 09:53 AM
RE: Problem with loop For - by plautz - 21-05-2013, 09:24 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)